Stop adjusting cooldown directly

This commit is contained in:
Aronai Sieyes
2020-04-30 15:43:58 -04:00
parent a280d35970
commit f5cbd8c35e
3 changed files with 24 additions and 33 deletions
+2 -8
View File
@@ -56,18 +56,12 @@
return
BSACooldown = 1
spawn(50)
BSACooldown = 0
VARSET_IN(global, BSACooldown, FALSE, 5 SECONDS)
to_chat(target,"You've been hit by bluespace artillery!")
log_and_message_admins("[key_name(target)] has been hit by Bluespace Artillery fired by [key_name(user ? user : usr)]")
var/obj/effect/stop/S
S = new /obj/effect/stop
S.victim = target
S.loc = target.loc
spawn(20)
qdel(S)
target.setMoveCooldown(2 SECONDS)
var/turf/simulated/floor/T = get_turf(target)
if(istype(T))
+20 -23
View File
@@ -74,30 +74,27 @@
// Respects move cooldowns as if it had a client.
// Also tries to avoid being superdumb with moving into certain tiles (unless that's desired).
/mob/living/proc/IMove(turf/newloc, safety = TRUE)
if(check_move_cooldown())
// if(!newdir)
// newdir = get_dir(get_turf(src), newloc)
if(!checkMoveCooldown())
return MOVEMENT_ON_COOLDOWN
// Check to make sure moving to newloc won't actually kill us. e.g. we're a slime and trying to walk onto water.
if(istype(newloc))
if(safety && !newloc.is_safe_to_enter(src))
return MOVEMENT_FAILED
// Move()ing to another tile successfully returns 32 because BYOND. Would rather deal with TRUE/FALSE-esque terms.
// Note that moving to the same tile will be 'successful'.
var/turf/old_T = get_turf(src)
// An adjacency check to avoid mobs phasing diagonally past windows.
// This might be better in general movement code but I'm too scared to add it, and most things don't move diagonally anyways.
if(!old_T.Adjacent(newloc))
// Check to make sure moving to newloc won't actually kill us. e.g. we're a slime and trying to walk onto water.
if(istype(newloc))
if(safety && !newloc.is_safe_to_enter(src))
return MOVEMENT_FAILED
. = SelfMove(newloc) ? MOVEMENT_SUCCESSFUL : MOVEMENT_FAILED
if(. == MOVEMENT_SUCCESSFUL)
set_dir(get_dir(old_T, newloc))
// Apply movement delay.
// Player movement has more factors but its all in the client and fixing that would be its own project.
setMoveCooldown(movement_delay())
return
// Move()ing to another tile successfully returns 32 because BYOND. Would rather deal with TRUE/FALSE-esque terms.
// Note that moving to the same tile will be 'successful'.
var/turf/old_T = get_turf(src)
. = MOVEMENT_ON_COOLDOWN // To avoid superfast mobs that aren't meant to be superfast. Is actually -1.
// An adjacency check to avoid mobs phasing diagonally past windows.
// This might be better in general movement code but I'm too scared to add it, and most things don't move diagonally anyways.
if(!old_T.Adjacent(newloc))
return MOVEMENT_FAILED
. = SelfMove(newloc) ? MOVEMENT_SUCCESSFUL : MOVEMENT_FAILED
if(. == MOVEMENT_SUCCESSFUL)
set_dir(get_dir(old_T, newloc))
// Apply movement delay.
// Player movement has more factors but its all in the client and fixing that would be its own project.
setMoveCooldown(movement_delay())
return
+2 -2
View File
@@ -745,12 +745,12 @@
/mob/proc/facedir(var/ndir)
if(!canface() || (client && (client.moving || (world.time < move_delay))))
if(!canface() || (client && (client.moving || !checkMoveCooldown())))
return 0
set_dir(ndir)
if(buckled && buckled.buckle_movable)
buckled.set_dir(ndir)
move_delay += movement_delay()
setMoveCooldown(movement_delay())
return 1