Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple mobs now can be hit with bolas and beartraps #3444

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions code/game/objects/items/handcuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,11 @@
snap = FALSE

var/def_zone = BODY_ZONE_CHEST
if(snap && iscarbon(L))
if(snap && isanimal(L))
var/mob/living/simple_animal/SA = L
if(SA.mob_size <= MOB_SIZE_TINY) //don't close the trap if they're as small as a mouse.
snap = FALSE
if(snap && (iscarbon(L) || isanimal(L)))
var/mob/living/carbon/C = L
if(C.body_position == STANDING_UP)
def_zone = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
Expand All @@ -305,10 +309,6 @@
C.update_equipment_speed_mods()
C.update_inv_legcuffed()
SSblackbox.record_feedback("tally", "handcuffs", 1, type)
else if(snap && isanimal(L))
var/mob/living/simple_animal/SA = L
if(SA.mob_size <= MOB_SIZE_TINY) //don't close the trap if they're as small as a mouse.
snap = FALSE
if(snap)
close_trap()
L.visible_message("<span class='danger'>[L] gets caught by \the [src]!</span>", \
Expand Down Expand Up @@ -357,7 +357,7 @@
playsound(src.loc,'sound/weapons/bolathrow.ogg', 75, TRUE)

/obj/item/restraints/legcuffs/bola/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
if(..() || !iscarbon(hit_atom))//if it gets caught or the target can't be cuffed,
if(..() || !(iscarbon(hit_atom) || isanimal(hit_atom)))//if it gets caught or the target can't be cuffed,
return//abort
ensnare(hit_atom)

Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/carbon/carbon_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
var/dreaming = 0 ///How many dream images we have left to send

var/obj/item/handcuffed = null ///Whether or not the mob is handcuffed
var/obj/item/legcuffed = null ///Same as handcuffs but for legs. Bear traps use this.

var/disgust = 0

Expand Down
1 change: 1 addition & 0 deletions code/modules/mob/living/living_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
var/metabolism_efficiency = 1 ///more or less efficiency to metabolize helpful/harmful reagents and regulate body temperature..
var/has_limbs = 0 ///does the mob have distinct limbs?(arms,legs, chest,head)

var/obj/item/legcuffed = null ///Same as handcuffs but for legs. Bear traps and bolas use this.
///How many legs does this mob have by default. This shouldn't change at runtime.
var/default_num_legs = 2
///How many legs does this mob currently have. Should only be changed through set_num_legs()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/simple_animal/hostile/hostile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@
approaching_target = TRUE
else
approaching_target = FALSE
if(legcuffed)
delay += legcuffed?.slowdown
walk_to(src, target, minimum_distance, delay)

/mob/living/simple_animal/hostile/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
Expand Down Expand Up @@ -457,6 +459,8 @@
if(dodging && approaching_target && prob(dodge_prob) && moving_diagonally == 0 && isturf(loc) && isturf(newloc))
return dodge(newloc,dir)
else
if(legcuffed)
resist_restraints()
return ..()

/mob/living/simple_animal/hostile/proc/dodge(moving_to,move_direction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
layer = LARGE_MOB_LAYER //Looks weird with them slipping under mineral walls and cameras and shit otherwise
mouse_opacity = MOUSE_OPACITY_OPAQUE // Easier to click on in melee, they're giant targets anyway
flags_1 = PREVENT_CONTENTS_EXPLOSION_1
legcuff_resist_chance = 50
var/mob_trophy
var/achievement_type
var/crusher_achievement_type
Expand Down
39 changes: 38 additions & 1 deletion code/modules/mob/living/simple_animal/simple_animal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
var/my_z
///What kind of footstep this mob should have. Null if it shouldn't have any.
var/footstep_type
var/legcuff_resist_chance = 5

/mob/living/simple_animal/Initialize(mapload)
. = ..()
Expand All @@ -159,7 +160,8 @@

/mob/living/simple_animal/Destroy()
GLOB.simple_animals[AIStatus] -= src

if(legcuffed)
QDEL_NULL(legcuffed)
LAZYREMOVEASSOC(SSidlenpcpool.idle_mobs_by_virtual_level, "[virtual_z()]", src)
if (SSnpcpool.state == SS_PAUSED && LAZYLEN(SSnpcpool.currentrun))
SSnpcpool.currentrun -= src
Expand Down Expand Up @@ -539,6 +541,41 @@
return
sync_lighting_plane_alpha()

/mob/living/simple_animal/get_item_by_slot(slot_id)
switch(slot_id)
if(ITEM_SLOT_LEGCUFFED)
return legcuffed
return null

/mob/living/simple_animal/get_slot_by_item(obj/item/looking_for)
if(looking_for == legcuffed)
return ITEM_SLOT_LEGCUFFED
return ..()

/mob/living/simple_animal/equipped_speed_mods()
. = ..()
if(legcuffed)
var/obj/item/legcuff = legcuffed
. += legcuff?.slowdown

/mob/living/simple_animal/update_inv_legcuffed()
clear_alert("legcuffed")
if(legcuffed)
throw_alert("legcuffed", /atom/movable/screen/alert/restrained/legcuffed, new_master = src.legcuffed)

/mob/living/simple_animal/resist_restraints()
if(legcuffed)
visible_message("<span class='warning'>[src] attempts to free [p_them()]self!</span>", \
span_notice("YYou attempt to free yourself..."))
if(prob(legcuff_resist_chance))
visible_message(span_warning("[src] is able free [p_them()]self!"), \
span_notice("You free yourself!"))
legcuffed.forceMove(drop_location())
legcuffed.dropped(src)
legcuffed = null
update_inv_legcuffed()
return TRUE

/mob/living/simple_animal/get_idcard(hand_first)
return access_card

Expand Down
Loading