Skip to content

Commit

Permalink
mousing
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Jan 20, 2025
1 parent 639a644 commit 5f01542
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 114 deletions.
11 changes: 10 additions & 1 deletion code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,18 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
//non-mob traits
/// Used for limb-based paralysis, where replacing the limb will fix it.
#define TRAIT_PARALYSIS "paralysis"

/// Is this atom being actively shocked? Used to prevent repeated shocks.
#define TRAIT_BEING_SHOCKED "shocked"
#define TRAIT_HEARING_SENSITIVE "hearing_sensitive"

/* Traits for ventcrawling.
* Both give access to ventcrawling, but *_NUDE requires the user to be
* wearing no clothes and holding no items. If both present, *_ALWAYS
* takes precedence.
*/
#define TRAIT_VENTCRAWLER_ALWAYS "ventcrawler_always"
#define TRAIT_VENTCRAWLER_NUDE "ventcrawler_nude"

/*
* Used for movables that need to be updated, via COMSIG_ENTER_AREA and COMSIG_EXIT_AREA, when transitioning areas.
* Use [/atom/movable/proc/become_area_sensitive(trait_source)] to properly enable it. How you remove it isn't as important.
Expand Down
1 change: 1 addition & 0 deletions code/_onclick/other_mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
*/
/mob/living/UnarmedAttack(atom/A)
A.attack_animal(src)
return TRUE

/atom/proc/attack_animal(mob/user)
SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_ANIMAL, user)
Expand Down
28 changes: 3 additions & 25 deletions code/modules/mob/living/basic/vermin/mouse.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
//can_be_held = TRUE
//held_w_class = WEIGHT_CLASS_TINY
//mob_biotypes = MOB_ORGANIC|MOB_BEAST
//gold_core_spawnable = FRIENDLY_SPAWN
faction = list(FACTION_RAT)
butcher_results = list(/obj/item/reagent_containers/food/snacks/meat/slab/mouse = 1)

Expand All @@ -40,13 +39,12 @@
. = ..()
if(contributes_to_ratcap)
SSmobs.cheeserats |= src
//ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)

if(isnull(body_color))
body_color = pick("brown", "gray", "white")
held_state = "mouse_[body_color]" // not handled by variety element
AddElement(/datum/element/animal_variety, "mouse", body_color, FALSE)
//AddElement(/datum/element/swabable, CELL_LINE_TABLE_MOUSE, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 10)
AddComponent(/datum/component/squeak, list('sound/effects/mousesqueek.ogg' = 1), 100, extrarange = SHORT_RANGE_SOUND_EXTRARANGE) //as quiet as a mouse or whatever

var/static/list/loc_connections = list(
Expand All @@ -58,24 +56,6 @@
SSmobs.cheeserats -= src
return ..()

/mob/living/basic/mouse/examine(mob/user)
. = ..()

var/sameside = user.faction_check_mob(src, exact_match = TRUE)
/*
if(isregalrat(user))
if(sameside)
. += span_notice("This rat serves under you.")
else
. += span_warning("This peasant serves a different king! Strike [p_them()] down!")
else if(user != src && ismouse(user))
if(sameside)
. += span_notice("You both serve the same king.")
else
. += span_warning("This fool serves a different king!")
*/

/// Kills the rat and changes its icon state to be splatted (bloody).
/mob/living/basic/mouse/proc/splat()
icon_dead = "mouse_[body_color]_splat"
Expand Down Expand Up @@ -110,11 +90,9 @@
var/obj/item/food/deadmouse/mouse = new(loc)
mouse.name = name
mouse.icon_state = icon_dead
/*
if(HAS_TRAIT(src, TRAIT_BEING_SHOCKED))
mouse.desc = "They're toast."
mouse.add_atom_colour("#3A3A3A", FIXED_COLOUR_PRIORITY)
*/
qdel(src)

/mob/living/basic/mouse/UnarmedAttack(atom/attack_target, proximity_flag, list/modifiers)
Expand All @@ -135,7 +113,7 @@

/// Signal proc for [COMSIG_ATOM_ENTERED]. Sends a lil' squeak to chat when someone walks over us.
/mob/living/basic/mouse/on_entered(datum/source, atom/movable/entered)
SIGNAL_HANDLER
. = ..()

if(ishuman(entered) && stat == CONSCIOUS)
to_chat(entered, span_notice("[icon2html(src, entered)] Squeak!"))
Expand Down Expand Up @@ -180,7 +158,7 @@
span_hear("You hear electricity crack."),
)
// Finely toasted
//ADD_TRAIT(src, TRAIT_BEING_SHOCKED, TRAIT_GENERIC)
ADD_TRAIT(src, TRAIT_BEING_SHOCKED, TRAIT_GENERIC)
// Unfortunately we can't check the return value of electrocute_act before displaying a message,
// as it's possible the damage from electrocution results in our hunter being deleted.
// But what are the odds of the shock failing? Hahaha...
Expand Down
93 changes: 5 additions & 88 deletions code/modules/mob/living/simple_animal/hostile/regalrat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
var/mob/living/A = the_target
if(istype(the_target, /mob/living/simple_animal/hostile/regalrat) && A.stat == CONSCIOUS)
return TRUE
if(istype(the_target, /mob/living/simple_animal/hostile/rat) && A.stat == CONSCIOUS)
var/mob/living/simple_animal/hostile/rat/R = the_target
if(istype(the_target, /mob/living/basic/mouse/rat) && A.stat == CONSCIOUS)
var/mob/living/basic/mouse/rat/R = the_target
if(R.faction_check_mob(src, TRUE))
return FALSE
else
Expand All @@ -74,8 +74,8 @@

/mob/living/simple_animal/hostile/regalrat/examine(mob/user)
. = ..()
if(istype(user,/mob/living/simple_animal/hostile/rat))
var/mob/living/simple_animal/hostile/rat/ratself = user
if(istype(user,/mob/living/basic/mouse/rat))
var/mob/living/basic/mouse/rat/ratself = user
if(ratself.faction_check_mob(src, TRUE))
. += "<span class='notice'>This is your king. Long live his majesty!</span>"
else
Expand Down Expand Up @@ -146,7 +146,7 @@
var/cap = CONFIG_GET(number/ratcap)
var/something_from_nothing = FALSE
for(var/mob/living/basic/mouse/M in oview(owner, 5))
var/mob/living/simple_animal/hostile/rat/new_rat = new(get_turf(M))
var/mob/living/basic/mouse/rat/new_rat = new(get_turf(M))
something_from_nothing = TRUE
if(M.mind && M.stat == CONSCIOUS)
M.mind.transfer_to(new_rat)
Expand All @@ -163,86 +163,3 @@
else
owner.visible_message("<span class='warning'>[owner] commands its army to action, mutating them into rats!</span>")
StartCooldown()

/mob/living/simple_animal/hostile/rat
name = "rat"
desc = "It's a nasty, ugly, evil, disease-ridden rodent with anger issues."
icon_state = "mouse_gray"
icon_living = "mouse_gray"
icon_dead = "mouse_gray_dead"
speak = list("Skree!","SKREEE!","Squeak?")
speak_emote = list("squeaks")
emote_hear = list("Hisses.")
emote_see = list("runs in a circle.", "stands on its hind legs.")
melee_damage_lower = 3
melee_damage_upper = 5
obj_damage = 5
speak_chance = 1
turns_per_move = 5
see_in_dark = 6
maxHealth = 15
health = 15
butcher_results = list(/obj/item/reagent_containers/food/snacks/meat/slab/mouse = 1)
density = FALSE
ventcrawler = VENTCRAWLER_ALWAYS
pass_flags = PASSTABLE | PASSGRILLE | PASSMOB
mob_size = MOB_SIZE_TINY
mob_biotypes = MOB_ORGANIC|MOB_BEAST
faction = list("rat")

/mob/living/simple_animal/hostile/rat/Initialize()
. = ..()
SSmobs.cheeserats += src

/mob/living/simple_animal/hostile/rat/Destroy()
SSmobs.cheeserats -= src
return ..()

/mob/living/simple_animal/hostile/rat/examine(mob/user)
. = ..()
if(istype(user,/mob/living/simple_animal/hostile/rat))
var/mob/living/simple_animal/hostile/rat/ratself = user
if(ratself.faction_check_mob(src, TRUE))
. += "<span class='notice'>You both serve the same king.</span>"
else
. += "<span class='warning'>This fool serves a different king!</span>"
else if(istype(user,/mob/living/simple_animal/hostile/regalrat))
var/mob/living/simple_animal/hostile/regalrat/ratking = user
if(ratking.faction_check_mob(src, TRUE))
. += "<span class='notice'>This rat serves under you.</span>"
else
. += "<span class='warning'>This peasant serves a different king! Strike him down!</span>"

/mob/living/simple_animal/hostile/rat/CanAttack(atom/the_target)
if(istype(the_target,/mob/living/simple_animal))
var/mob/living/A = the_target
if(istype(the_target, /mob/living/simple_animal/hostile/regalrat) && A.stat == CONSCIOUS)
var/mob/living/simple_animal/hostile/regalrat/ratking = the_target
if(ratking.faction_check_mob(src, TRUE))
return FALSE
else
return TRUE
if(istype(the_target, /mob/living/simple_animal/hostile/rat) && A.stat == CONSCIOUS)
var/mob/living/simple_animal/hostile/rat/R = the_target
if(R.faction_check_mob(src, TRUE))
return FALSE
else
return TRUE
return ..()

/mob/living/simple_animal/hostile/rat/handle_automated_action()
. = ..()
if(prob(40))
var/turf/open/floor/F = get_turf(src)
if(istype(F) && !F.intact)
var/obj/structure/cable/C = locate() in F
if(C && prob(15))
if(C.avail())
visible_message("<span class='warning'>[src] chews through the [C]. It's toast!</span>")
playsound(src, 'sound/effects/sparks2.ogg', 100, TRUE)
C.deconstruct()
death()
else if(C && C.avail())
visible_message("<span class='warning'>[src] chews through the [C]. It looks unharmed!</span>")
playsound(src, 'sound/effects/sparks2.ogg', 100, TRUE)
C.deconstruct()

0 comments on commit 5f01542

Please sign in to comment.