mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 16:14:08 +01:00
Finally fixed the proximity runtime (#22950)
* Finally fixed the proximity runtime Also fixed some misue of Move(d)s and destroys * Fixed remove_from_proximity_list * Fine, we'll do it your way * Should sense/update loc here as well * Assume deez nuts
This commit is contained in:
@@ -1156,16 +1156,14 @@ B --><-- A
|
||||
C.proximity_checkers[A] = TRUE
|
||||
return L
|
||||
|
||||
/proc/remove_from_proximity_list(atom/A, range)
|
||||
var/turf/T = get_turf(A)
|
||||
/proc/remove_from_proximity_list(atom/A, range, oldloc = null)
|
||||
var/turf/T = get_turf(oldloc ? oldloc : A)
|
||||
var/list/L = block(locate(T.x - range, T.y - range, T.z), locate(T.x + range, T.y + range, T.z))
|
||||
for(var/B in L)
|
||||
var/turf/C = B
|
||||
if (!C.proximity_checkers)
|
||||
continue
|
||||
C.proximity_checkers.Remove(A)
|
||||
UNSETEMPTY(C.proximity_checkers)
|
||||
|
||||
|
||||
/proc/shift_proximity(atom/checker, atom/A, range, atom/B, newrange)
|
||||
var/turf/T = get_turf(A)
|
||||
@@ -1181,7 +1179,6 @@ B --><-- A
|
||||
if (!D.proximity_checkers)
|
||||
continue
|
||||
D.proximity_checkers.Remove(checker)
|
||||
UNSETEMPTY(D.proximity_checkers)
|
||||
for(var/E in O)
|
||||
var/turf/F = E
|
||||
LAZYINITLIST(F.proximity_checkers)
|
||||
|
||||
@@ -35,15 +35,10 @@
|
||||
bulb = new /obj/item/device/assembly/flash/handheld(src)
|
||||
|
||||
/obj/machinery/flasher/Destroy()
|
||||
remove_from_proximity_list(src, range)
|
||||
if(bulb)
|
||||
qdel(bulb)
|
||||
bulb = null
|
||||
..()
|
||||
|
||||
/obj/machinery/flasher/Move()
|
||||
remove_from_proximity_list(src, range)
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/flasher/power_change()
|
||||
if (powered() && anchored && bulb)
|
||||
@@ -191,6 +186,13 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/flasher/portable/Destroy()
|
||||
remove_from_proximity_list(src, range)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/flasher/protable/Moved(oldloc)
|
||||
remove_from_proximity_list(oldloc, range)
|
||||
return ..()
|
||||
|
||||
/obj/item/wallframe/flasher
|
||||
name = "mounted flash frame"
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
|
||||
/obj/structure/alien/egg/Destroy()
|
||||
remove_from_proximity_list(src, 1)
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/obj/structure/alien/egg/attack_paw(mob/living/user)
|
||||
return attack_hand(user)
|
||||
@@ -281,9 +281,11 @@
|
||||
child.Attach(M)
|
||||
break
|
||||
|
||||
/obj/structure/alien/egg/Move()
|
||||
remove_from_proximity_list(src, 1)
|
||||
..()
|
||||
/obj/structure/alien/egg/Moved(oldloc)
|
||||
remove_from_proximity_list(oldloc, 1)
|
||||
if(status == GROWN)
|
||||
add_to_proximity_list(src, 1)
|
||||
return ..()
|
||||
|
||||
/obj/structure/alien/egg/deconstruct()
|
||||
if(!(flags & NODECONSTRUCT))
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
timing = 0
|
||||
toggle_scan(1)
|
||||
time = initial(time)
|
||||
handle_move(get_turf(loc))
|
||||
handle_move(loc)
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/dropped()
|
||||
..()
|
||||
@@ -81,7 +81,8 @@
|
||||
addtimer(CALLBACK(src, .proc/sense), 0)
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/Destroy()
|
||||
remove_from_proximity_list(src, sensitivity)
|
||||
if(scanning)
|
||||
remove_from_proximity_list(src, sensitivity, oldloc)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/toggle_scan(scan)
|
||||
@@ -98,7 +99,9 @@
|
||||
/obj/item/device/assembly/prox_sensor/proc/sensitivity_change(value)
|
||||
var/sense = min(max(sensitivity + value, 0), 5)
|
||||
if(scanning)
|
||||
shift_proximity(src, oldloc, sensitivity, loc, sense)
|
||||
if(shift_proximity(src, oldloc, sensitivity, loc, sense))
|
||||
sense()
|
||||
oldloc = loc
|
||||
sensitivity = sense
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/update_icon()
|
||||
@@ -116,13 +119,13 @@
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/proc/handle_move(atom/newloc)
|
||||
if(scanning)
|
||||
if(shift_proximity(src, oldloc, sensitivity, newloc, sensitivity))
|
||||
if(shift_proximity(src, oldloc, sensitivity, newloc, sensitivity) || newloc != oldloc)
|
||||
sense()
|
||||
oldloc = newloc
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/Move(newloc)
|
||||
/obj/item/device/assembly/prox_sensor/Moved()
|
||||
..()
|
||||
handle_move(newloc)
|
||||
handle_move(loc)
|
||||
|
||||
|
||||
/obj/item/device/assembly/prox_sensor/interact(mob/user)//TODO: Change this to the wires thingy
|
||||
|
||||
Reference in New Issue
Block a user