This commit is contained in:
kevinz000
2020-02-24 01:59:45 -07:00
parent f6542b381c
commit 424eb48d9e
11 changed files with 95 additions and 57 deletions

View File

@@ -28,7 +28,6 @@
var/list/managed_overlays
var/datum/proximity_monitor/proximity_monitor
var/buckle_message_cooldown = 0
var/fingerprintslast
var/list/filter_data //For handling persistent filters
@@ -356,11 +355,12 @@
. = list()
SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_OVERLAYS, .)
/atom/proc/relaymove(mob/user)
if(buckle_message_cooldown <= world.time)
buckle_message_cooldown = world.time + 50
/atom/proc/relaymove(mob/living/user)
if(!istype(user))
return //why are you buckling nonliving mobs to atoms?
if(user.buckle_message_cooldown <= world.time)
user.buckle_message_cooldown = world.time + 50
to_chat(user, "<span class='warning'>You can't move while buckled to [src]!</span>")
return
/atom/proc/contents_explosion(severity, target)
return //For handling the effects of explosions on contents that would not normally be effected

View File

@@ -941,7 +941,6 @@
/obj/mecha/container_resist(mob/living/user)
go_out()
/obj/mecha/Exited(atom/movable/M, atom/newloc)
if(occupant && occupant == M) // The occupant exited the mech without calling go_out()
go_out(TRUE, newloc)

View File

@@ -511,7 +511,7 @@
user.visible_message("<span class='warning'>[src] begins to shake violently!</span>", \
"<span class='notice'>You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)</span>", \
"<span class='italics'>You hear banging from [src].</span>")
if(do_after(user,(breakout_time), target = src))
if(do_after(user,(breakout_time), target = src, required_mobility_flags = MOBILITY_RESIST))
if(!user || user.stat != CONSCIOUS || user.loc != src || opened || (!locked && !welded) )
return
//we check after a while whether there is a point of resisting anymore and whether the user is capable of resisting

View File

@@ -69,11 +69,11 @@
playsound(src, 'sound/voice/hiss5.ogg', 40, 1, 1) //Alien roars when starting to break free
..(I, cuff_break = INSTANT_CUFFBREAK)
/mob/living/carbon/alien/humanoid/resist_grab(moving_resist)
if(pulledby.grab_state)
/mob/living/carbon/alien/humanoid/do_resist_grab(moving_resist, forced, silent = FALSE)
if(pulledby.grab_state && !silent)
visible_message("<span class='danger'>[src] has broken free of [pulledby]'s grip!</span>")
pulledby.stop_pulling()
. = 0
return TRUE
/mob/living/carbon/alien/humanoid/get_standard_pixel_y_offset(lying = 0)
if(leaping)

View File

@@ -281,19 +281,23 @@
return FALSE
/mob/living/carbon/resist_buckle()
. = FALSE
if(restrained())
changeNext_move(CLICK_CD_BREAKOUT)
last_special = world.time + CLICK_CD_BREAKOUT
// too soon.
if(last_special > world.time)
return
var/buckle_cd = 600
if(handcuffed)
var/obj/item/restraints/O = src.get_item_by_slot(SLOT_HANDCUFFED)
buckle_cd = O.breakouttime
changeNext_move(min(CLICK_CD_BREAKOUT, buckle_cd))
last_special = world.time + min(CLICK_CD_BREAKOUT, buckle_cd)
visible_message("<span class='warning'>[src] attempts to unbuckle [p_them()]self!</span>", \
"<span class='notice'>You attempt to unbuckle yourself... (This will take around [round(buckle_cd/600,1)] minute\s, and you need to stay still.)</span>")
if(do_after(src, buckle_cd, 0, target = src, required_mobility_flags = MOBILITY_RESIST))
if(!buckled)
return
buckled.user_unbuckle_mob(src,src)
buckled.user_unbuckle_mob(src, src)
else
if(src && buckled)
to_chat(src, "<span class='warning'>You fail to unbuckle yourself!</span>")
@@ -313,9 +317,12 @@
ExtinguishMob()
return
/mob/living/carbon/resist_restraints()
/mob/living/carbon/resist_restraints(ignore_delay = FALSE)
var/obj/item/I = null
var/type = 0
if(!ignore_delay && (last_special > world.time))
to_chat(src, "<span class='warning'>You don't have the energy to resist your restraints that fast!</span>")
return
if(handcuffed)
I = handcuffed
type = 1
@@ -324,14 +331,13 @@
type = 2
if(I)
if(type == 1)
changeNext_move(CLICK_CD_BREAKOUT)
changeNext_move(min(CLICK_CD_BREAKOUT, I.breakouttime))
last_special = world.time + CLICK_CD_BREAKOUT
if(type == 2)
changeNext_move(CLICK_CD_RANGE)
changeNext_move(min(CLICK_CD_RANGE, I.breakouttime))
last_special = world.time + CLICK_CD_RANGE
cuff_resist(I)
/mob/living/carbon/proc/cuff_resist(obj/item/I, breakouttime = 600, cuff_break = 0)
if(I.item_flags & BEING_REMOVED)
to_chat(src, "<span class='warning'>You're already attempting to remove [I]!</span>")

View File

@@ -646,66 +646,98 @@
..(pressure_difference, direction, pressure_resistance_prob_delta)
/mob/living/can_resist()
return !((next_move > world.time) || incapacitated(ignore_restraints = TRUE))
return !((next_move > world.time) || !CHECK_MOBILITY(src, MOBILITY_RESIST))
/// Resist verb for attempting to get out of whatever is restraining your motion. Gives you resist clickdelay if do_resist() returns true.
/mob/living/verb/resist()
set name = "Resist"
set category = "IC"
if(!can_resist())
return
changeNext_move(CLICK_CD_RESIST)
if(do_resist())
changeNext_move(CLICK_CD_RESIST)
/// The actual proc for resisting. Return TRUE to give clickdelay.
/mob/living/proc/do_resist()
SEND_SIGNAL(src, COMSIG_LIVING_RESIST, src)
//resisting grabs (as if it helps anyone...)
if(!restrained(ignore_grab = 1) && pulledby)
visible_message("<span class='danger'>[src] resists against [pulledby]'s grip!</span>")
log_combat(src, pulledby, "resisted grab")
resist_grab()
return
// only works if you're not cuffed.
if(!restrained(ignore_grab = TRUE) && pulledby)
var/old_gs = pulledby.grab_state
attempt_resist_grab(FALSE)
// Return as we should only resist one thing at a time. Give clickdelay if the grab wasn't passive.
return old_gs? TRUE : FALSE
//unbuckling yourself
// unbuckling yourself. stops the chain if you try it.
if(buckled && last_special <= world.time)
resist_buckle()
log_combat(src, buckled, "resisted buckle")
return resist_buckle()
// CIT CHANGE - climbing out of a gut
if(attempt_vr(src,"vore_process_resist",args)) return TRUE
// CIT CHANGE - climbing out of a gut.
if(attempt_vr(src,"vore_process_resist",args))
//Sure, give clickdelay for anti spam. shouldn't be combat voring anyways.
return TRUE
//Breaking out of a container (Locker, sleeper, cryo...)
else if(isobj(loc))
if(isobj(loc))
var/obj/C = loc
C.container_resist(src)
// This shouldn't give clickdelays sometime (e.g. going out of a mech/unwelded and unlocked locker/disposals bin/etc) but there's so many overrides that I am not going to bother right now.
return TRUE
else if(CHECK_BITFIELD(mobility_flags, MOBILITY_MOVE))
if(CHECK_BITFIELD(mobility_flags, MOBILITY_MOVE))
if(on_fire)
resist_fire() //stop, drop, and roll
return
if(resting) //cit change - allows resisting out of resting
resist_a_rest() // ditto
return
if(resist_embedded()) //Citadel Change for embedded removal memes
return
if(last_special <= world.time)
resist_restraints() //trying to remove cuffs.
return
// Give clickdelay
return TRUE
if(resting) //cit change - allows resisting out of resting
resist_a_rest() // ditto
// DO NOT GIVE CLCIKDELAY - resist_a_rest() handles spam prevention. Somewhat.
return FALSE
if(last_special <= world.time)
resist_restraints() //trying to remove cuffs.
// DO NOT GIVE CLICKDELAY - last_special handles this.
return FALSE
if(CHECK_MOBILITY(src, MOBILITY_USE) && resist_embedded()) //Citadel Change for embedded removal memes - requires being able to use items.
// DO NOT GIVE DEFAULT CLICKDELAY - This is a combat action.
changeNext_move(CLICK_CD_MELEE)
return FALSE
/// Proc to resist a grab. moving_resist is TRUE if this began by someone attempting to move. Return FALSE if still grabbed/failed to break out. Use this instead of resist_grab() directly.
/mob/proc/attempt_resist_grab(moving_resist, forced, log = TRUE)
if(!pulledby) //not being grabbed
return TRUE
var/old_gs = pulledby.grab_state //how strong the grab is
var/old_pulled = pulledby
var/success = do_resist_grab(moving_resist, forced)
if(log)
log_combat(src, old_pulled, "[success? "successfully broke free of" : "failed to resist"] a grab of strength [old_gs][moving_resist? " (moving)":""][forced? " (forced)":""]")
return success
/mob/proc/resist_grab(moving_resist)
return 1 //returning 0 means we successfully broke free
/*!
* Proc that actually does the grab resisting. Return TRUE if successful. Does not check that a grab exists! Use attempt_resist_grab() instead of this in general!
* Forced is if something other than the user mashing movement keys/pressing resist button did it, silent is if it makes messages (like "attempted to resist" and "broken free").
* Forced does NOT force success!
*/
/mob/living/resist_grab(moving_resist)
. = 1
/mob/proc/do_resist_grab(moving_resist, forced, silent = FALSE)
return FALSE
/mob/living/do_resist_grab(moving_resist, forced, silent = FALSE)
. = ..()
if(pulledby.grab_state)
if(CHECK_BITFIELD(mobility_flags, MOBILITY_STAND) && prob(30/pulledby.grab_state))
visible_message("<span class='danger'>[src] has broken free of [pulledby]'s grip!</span>")
log_combat(pulledby, src, "broke grab")
pulledby.stop_pulling()
return 0
if(moving_resist && client) //we resisted by trying to move
return TRUE
else if(moving_resist && client) //we resisted by trying to move // this is a horrible system and whoever thought using client instead of mob is okay is not an okay person
client.move_delay = world.time + 20
visible_message("<span class='danger'>[src] resists against [pulledby]'s grip!</span>")
else
pulledby.stop_pulling()
return 0
return TRUE
/mob/living/proc/resist_buckle()
buckled.user_unbuckle_mob(src,src)

View File

@@ -114,4 +114,7 @@
var/drag_slowdown = TRUE //Whether the mob is slowed down when dragging another prone mob
var/rotate_on_lying = FALSE
var/rotate_on_lying = FALSE
/// Next world.time when we can get the "you can't move while buckled to [thing]" message.
var/buckle_message_cooldown = 0

View File

@@ -78,7 +78,7 @@
standupwarning = "[src] struggles to stand up."
var/usernotice = automatic ? "<span class='notice'>You are now getting up. (Auto)</span>" : "<span class='notice'>You are now getting up.</span>"
visible_message("<span class='notice'>[standupwarning]</span>", usernotice, vision_distance = 5)
if(do_after(src, totaldelay, target = src, required_mobility_flags = MOBILITY_MOVE))
if(do_after(src, totaldelay, target = src, required_mobility_flags = MOBILITY_RESIST))
set_resting(FALSE, TRUE)
attemptingstandup = FALSE
return TRUE
@@ -110,7 +110,7 @@
var/chokehold = pulledby && pulledby.grab_state >= GRAB_NECK
var/restrained = restrained()
var/pinned = resting && pulledby && pulledby.grab_state >= GRAB_AGGRESSIVE // Cit change - adds pinning for aggressive-grabbing people on the ground
var/canmove = !immobilize && !stun && conscious && !paralyze && !buckled && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && (has_arms || ignore_legs || has_legs) && !pinned && !recoveringstam
var/canmove = !immobilize && !stun && conscious && !paralyze && (!stat_softcrit || !pulledby) && !chokehold && !IsFrozen() && (has_arms || ignore_legs || has_legs) && !pinned && !recoveringstam
var/canresist = !stun && conscious && !stat_softcrit && !paralyze && (has_arms || ignore_legs || has_legs) && !recoveringstam
if(canmove)

View File

@@ -989,7 +989,7 @@
deployed_shell.undeploy()
diag_hud_set_deployed()
/mob/living/silicon/ai/resist()
/mob/living/silicon/ai/do_resist()
return
/mob/living/silicon/ai/spawned/Initialize(mapload, datum/ai_laws/L, mob/target_ai)

View File

@@ -747,8 +747,8 @@
else
return null
/mob/living/simple_animal/bot/mulebot/resist()
..()
/mob/living/simple_animal/bot/mulebot/do_resist()
. = ..()
if(load)
unload()

View File

@@ -107,9 +107,7 @@
if(P && !ismob(P) && P.density)
mob.setDir(turn(mob.dir, 180))
///Process_Grab()
///Called by client/Move()
///Checks to see if you are being grabbed and if so attemps to break it
/// Process_Grab(): checks for grab, attempts to break if so. Return TRUE to prevent movement.
/client/proc/Process_Grab()
if(mob.pulledby)
if(mob.incapacitated(ignore_restraints = 1))
@@ -120,7 +118,7 @@
to_chat(src, "<span class='warning'>You're restrained! You can't move!</span>")
return TRUE
else
return mob.resist_grab(1)
return !mob.attempt_resist_grab(TRUE)
///Process_Incorpmove
///Called by client/Move()