mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Ring of fire now expands outwards (#17177)
This commit is contained in:
committed by
Pieter-Jan Briers
parent
469dd22da9
commit
05f94dea7c
@@ -27,6 +27,14 @@ proc/arctan(x)
|
||||
/proc/Ceiling(x, y = 1)
|
||||
. = -round(-x / y) * y
|
||||
|
||||
/proc/sgn(const/i)
|
||||
if(i > 0)
|
||||
return 1
|
||||
else if(i < 0)
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
|
||||
//Moved to macros.dm to reduce pure calling overhead, this was being called shitloads, like, most calls of all procs.
|
||||
/*
|
||||
/proc/Clamp(const/val, const/min, const/max)
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
update_lock(AM)
|
||||
AM.change_dir(owner.dir, owner)
|
||||
|
||||
/datum/locking_category/proc/update_locks()
|
||||
for(var/atom/A in locked)
|
||||
update_lock(A)
|
||||
|
||||
// Updates the position for AM.
|
||||
/datum/locking_category/proc/update_lock(var/atom/movable/AM)
|
||||
var/new_loc = owner.loc
|
||||
|
||||
@@ -320,6 +320,7 @@
|
||||
C.name = id
|
||||
locking_categories_name[id] = C
|
||||
locking_categories += C
|
||||
return C
|
||||
|
||||
/atom/movable/proc/get_lock_cat(var/category = /datum/locking_category)
|
||||
locking_init()
|
||||
|
||||
@@ -75,13 +75,36 @@
|
||||
/obj/effect/ring_of_fire/New(loc, list/locations, duration)
|
||||
..()
|
||||
|
||||
var/list/processing_locking_cats = list()
|
||||
|
||||
for(var/turf/T in locations)
|
||||
//Create the flames at their intended location
|
||||
var/obj/effect/fire_blast/ring_of_fire/F = new /obj/effect/fire_blast/ring_of_fire(T, fire_duration = duration)
|
||||
|
||||
var/lock_id = "\ref[F]"
|
||||
add_lock_cat(/datum/locking_category/ring_of_fire, lock_id)
|
||||
var/datum/locking_category/ring_of_fire/locking_cat = add_lock_cat(/datum/locking_category/ring_of_fire, lock_id)
|
||||
//Lock_atom notes their intended location, and moves all of them to the caster's turf
|
||||
lock_atom(F, lock_id)
|
||||
|
||||
processing_locking_cats.Add(locking_cat)
|
||||
|
||||
//This subprocess moves all flames to their intended location
|
||||
spawn()
|
||||
while(processing_locking_cats.len)
|
||||
for(var/datum/locking_category/ring_of_fire/ROF in processing_locking_cats)
|
||||
if(ROF.x_offset == ROF.target_x_offset && ROF.y_offset == ROF.target_y_offset)
|
||||
processing_locking_cats.Remove(ROF)
|
||||
continue
|
||||
if(!ROF.locked || !ROF.locked.len || !ROF.owner || !ROF.owner.loc)
|
||||
processing_locking_cats.Remove(ROF)
|
||||
continue
|
||||
|
||||
ROF.x_offset += sgn(ROF.target_x_offset - ROF.x_offset)
|
||||
ROF.y_offset += sgn(ROF.target_y_offset - ROF.y_offset)
|
||||
ROF.update_locks()
|
||||
|
||||
sleep(5)
|
||||
|
||||
spawn(duration)
|
||||
qdel(src)
|
||||
|
||||
@@ -90,9 +113,13 @@
|
||||
spread = 0
|
||||
|
||||
/datum/locking_category/ring_of_fire
|
||||
var/target_x_offset
|
||||
var/target_y_offset
|
||||
|
||||
/datum/locking_category/ring_of_fire/lock(atom/movable/AM)
|
||||
x_offset = AM.x - owner.x
|
||||
y_offset = AM.y - owner.y
|
||||
target_x_offset = AM.x - owner.x
|
||||
target_y_offset = AM.y - owner.y
|
||||
x_offset = 0
|
||||
y_offset = 0
|
||||
|
||||
..()
|
||||
|
||||
Reference in New Issue
Block a user