Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Fixes some grab jank #321

Merged
merged 6 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
35 changes: 20 additions & 15 deletions code/mob/living/critter/flock/flockdrone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

// antigrab powers
var/antigrab_counter = 0
var/antigrab_fires_at = 100
var/antigrab_fires_at = 2

var/glow_color = "#26ffe6a2"

Expand Down Expand Up @@ -386,6 +386,23 @@
return 2
return ..()

///Runs the drone's inbuilt anti-grab measures, shocking the grabber after a while
/mob/living/critter/flock/drone/proc/do_antigrab()
//if we're blocking that means we're not grabbed
if (!length(src.grabbed_by) || src.find_type_in_hand(/obj/item/grab/block))
src.antigrab_counter = 0
return

antigrab_counter++
if (antigrab_counter >= src.antigrab_fires_at)
TobleroneSwordfish marked this conversation as resolved.
Show resolved Hide resolved
playsound(src, "sound/effects/electric_shock.ogg", 40, 1, -3)
boutput(src, "<span class='flocksay'><b>\[SYSTEM: Anti-grapple countermeasures deployed.\]</b></span>")
for(var/obj/item/grab/G in src.grabbed_by)
var/mob/living/L = G.assailant
L.shock(src, 5000)
qdel(G) //in case they don't fall over from our shock
TobleroneSwordfish marked this conversation as resolved.
Show resolved Hide resolved
src.antigrab_counter = 0

/mob/living/critter/flock/drone/Life(datum/controller/process/mobs/parent)
if (..(parent))
return TRUE
Expand All @@ -399,6 +416,8 @@
if (src.dormant)
return

src.do_antigrab()
TobleroneSwordfish marked this conversation as resolved.
Show resolved Hide resolved
TobleroneSwordfish marked this conversation as resolved.
Show resolved Hide resolved

var/obj/item/I = absorber.item

if (!I)
Expand Down Expand Up @@ -456,20 +475,6 @@


/mob/living/critter/flock/drone/process_move(keys)
if(keys && length(src.grabbed_by))
if (length(src.grabbed_by) == 1 && src.find_type_in_hand(/obj/item/grab/block))
src.antigrab_counter = 0
else
++src.antigrab_counter
if(src.antigrab_counter >= src.antigrab_fires_at)
playsound(src, "sound/effects/electric_shock.ogg", 40, 1, -3)
boutput(src, "<span class='flocksay'><b>\[SYSTEM: Anti-grapple countermeasures deployed.\]</b></span>")
for(var/obj/item/grab/G in src.grabbed_by)
var/mob/living/L = G.assailant
L.shock(src, 5000)
src.antigrab_counter = 0
else
src.antigrab_counter = 0
if(keys & KEY_RUN && src.resources >= 1)
if(!src.floorrunning && isfeathertile(src.loc))
if (length(src.grabbed_by))
Expand Down
3 changes: 3 additions & 0 deletions code/turf/turf_flock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
// do not call parent, this is not an ordinary floor
if(!C || !user)
return
if (istype(C, /obj/item/grab))
grab_smash(C, user)
return
if(ispryingtool(C) && src.broken)
playsound(src, "sound/items/Crowbar.ogg", 80, 1)
src.break_tile_to_plating()
Expand Down