mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-30 00:21:11 +01:00
Movement update v2 (#20548)
Refactored (second passage) how movement works, now it's mostly in line with TG handling and avoids calling 3 gazillion Cross() Uncross() etc. on every atom in a turf. Fixed EMP protection from species not actually protecting (this includes the surge prevention for IPCs). Fixed EMP 3D calculation runtiming because I forgot to make the value absolute and it was doing the square root of a negative number. It's now possible to queue the round to start with the Start Round verb even while the system is initializing, for an even faster pain train to enter the round and test things.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////
|
||||
// Chem smoke
|
||||
/////////////////////////////////////////////
|
||||
/obj/effect/effect/smoke/chem
|
||||
/obj/effect/smoke/chem
|
||||
icon = 'icons/effects/chemsmoke.dmi'
|
||||
opacity = 0
|
||||
time_to_live = 300
|
||||
@@ -9,10 +9,10 @@
|
||||
var/splash_amount = 10 //atoms moving through a smoke cloud get splashed with up to 10 units of reagent
|
||||
var/turf/destination
|
||||
|
||||
/obj/effect/effect/smoke/chem/New(var/newloc, smoke_duration, turf/dest_turf = null, icon/cached_icon = null)
|
||||
time_to_live = smoke_duration
|
||||
/obj/effect/smoke/chem/Initialize(mapload, duration, turf/dest_turf, icon/cached_icon)
|
||||
time_to_live = duration
|
||||
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
create_reagents(500)
|
||||
|
||||
@@ -28,35 +28,35 @@
|
||||
if(destination)
|
||||
GLOB.move_manager.move_to(src, destination, priority = MOVEMENT_SPACE_PRIORITY)
|
||||
|
||||
/obj/effect/effect/smoke/chem/Destroy()
|
||||
/obj/effect/smoke/chem/Destroy()
|
||||
GLOB.move_manager.stop_looping(src)
|
||||
return ..()
|
||||
|
||||
/obj/effect/effect/smoke/chem/Move()
|
||||
/obj/effect/smoke/chem/Move()
|
||||
var/list/oldlocs = view(1, src)
|
||||
. = ..()
|
||||
if(.)
|
||||
for(var/turf/T in view(1, src) - oldlocs)
|
||||
for(var/atom/movable/AM in T)
|
||||
if(!istype(AM, /obj/effect/effect/smoke/chem))
|
||||
if(!istype(AM, /obj/effect/smoke/chem))
|
||||
reagents.splash(AM, splash_amount, copy = 1)
|
||||
if(loc == destination)
|
||||
bound_width = 96
|
||||
bound_height = 96
|
||||
|
||||
/obj/effect/effect/smoke/chem/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
|
||||
/obj/effect/smoke/chem/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
|
||||
..()
|
||||
|
||||
if(!istype(arrived, /obj/effect/effect/smoke/chem))
|
||||
if(!istype(arrived, /obj/effect/smoke/chem))
|
||||
if(istype(arrived, /obj/item/reagent_containers) && !arrived.is_open_container())
|
||||
return
|
||||
else
|
||||
reagents.splash(arrived, splash_amount, copy = 1)
|
||||
|
||||
/obj/effect/effect/smoke/chem/proc/initial_splash()
|
||||
/obj/effect/smoke/chem/proc/initial_splash()
|
||||
for(var/turf/T in view(1, src))
|
||||
for(var/atom/movable/AM in T)
|
||||
if(!istype(AM, /obj/effect/effect/smoke/chem))
|
||||
if(!istype(AM, /obj/effect/smoke/chem))
|
||||
if(istype(AM, /obj/item/reagent_containers) && !AM.is_open_container())
|
||||
return
|
||||
else
|
||||
@@ -66,7 +66,7 @@
|
||||
// Chem Smoke Effect System
|
||||
/////////////////////////////////////////////
|
||||
/datum/effect/effect/system/smoke_spread/chem
|
||||
smoke_type = /obj/effect/effect/smoke/chem
|
||||
smoke_type = /obj/effect/smoke/chem
|
||||
var/obj/chemholder
|
||||
var/range
|
||||
var/list/targetTurfs
|
||||
@@ -183,7 +183,7 @@
|
||||
for(var/turf/T in targetTurfs)
|
||||
chemholder.reagents.touch_turf(T)
|
||||
for(var/atom/A in T.contents)
|
||||
if(istype(A, /obj/effect/effect/smoke/chem) || istype(A, /mob))
|
||||
if(istype(A, /obj/effect/smoke/chem) || istype(A, /mob))
|
||||
continue
|
||||
else if(isobj(A) && !A.simulated)
|
||||
chemholder.reagents.touch_obj(A)
|
||||
@@ -253,13 +253,13 @@
|
||||
// Randomizes and spawns the smoke effect.
|
||||
// Also handles deleting the smoke once the effect is finished.
|
||||
//------------------------------------------
|
||||
/datum/effect/effect/system/smoke_spread/chem/proc/spawnSmoke(var/turf/T, var/icon/I, var/smoke_duration, var/dist = 1, var/splash_initial=0, var/obj/effect/effect/smoke/chem/passed_smoke)
|
||||
/datum/effect/effect/system/smoke_spread/chem/proc/spawnSmoke(var/turf/T, var/icon/I, var/smoke_duration, var/dist = 1, var/splash_initial=0, var/obj/effect/smoke/chem/passed_smoke)
|
||||
|
||||
var/obj/effect/effect/smoke/chem/smoke
|
||||
var/obj/effect/smoke/chem/smoke
|
||||
if(passed_smoke)
|
||||
smoke = passed_smoke
|
||||
else
|
||||
smoke = new /obj/effect/effect/smoke/chem(location, smoke_duration + rand(smoke_duration*-0.25, smoke_duration*0.25), T, I)
|
||||
smoke = new /obj/effect/smoke/chem(location, smoke_duration + rand(smoke_duration*-0.25, smoke_duration*0.25), T, I)
|
||||
|
||||
if(LAZYLEN(chemholder?.reagents?.reagent_volumes))
|
||||
chemholder.reagents.trans_to_obj(smoke, chemholder.reagents.total_volume / dist, copy = 1) //copy reagents to the smoke so mob/breathe() can handle inhaling the reagents
|
||||
@@ -270,7 +270,7 @@
|
||||
|
||||
|
||||
/datum/effect/effect/system/smoke_spread/chem/spores/spawnSmoke(var/turf/T, var/icon/I, var/smoke_duration, var/dist = 1)
|
||||
var/obj/effect/effect/smoke/chem/spores = new /obj/effect/effect/smoke/chem(location)
|
||||
var/obj/effect/smoke/chem/spores = new /obj/effect/smoke/chem(location)
|
||||
if(spores && seed)
|
||||
spores.name = "cloud of [seed.seed_name] [seed.seed_noun]"
|
||||
..(T, I, smoke_duration, dist, spores)
|
||||
|
||||
@@ -93,7 +93,7 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
/////////////////////////////////////////////
|
||||
|
||||
|
||||
/obj/effect/effect/smoke
|
||||
/obj/effect/smoke
|
||||
name = "smoke"
|
||||
icon_state = "smoke"
|
||||
opacity = 1
|
||||
@@ -108,8 +108,9 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
|
||||
/obj/effect/effect/smoke/New(var/loc, var/duration = 0)
|
||||
..()
|
||||
/obj/effect/smoke/Initialize(mapload, duration = 0)
|
||||
. = ..()
|
||||
|
||||
if (duration)
|
||||
time_to_live = duration
|
||||
addtimer(CALLBACK(src, PROC_REF(kill)), time_to_live)
|
||||
@@ -120,19 +121,19 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
|
||||
AddElement(/datum/element/connect_loc, loc_connections)
|
||||
|
||||
/obj/effect/effect/smoke/proc/kill()
|
||||
/obj/effect/smoke/proc/kill()
|
||||
animate(src, alpha = 0, time = 2 SECONDS, easing = QUAD_EASING)
|
||||
set_opacity(FALSE)
|
||||
|
||||
QDEL_IN(src, 2.5 SECONDS)
|
||||
|
||||
/obj/effect/effect/smoke/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
|
||||
/obj/effect/smoke/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(istype(arrived, /mob/living/carbon))
|
||||
affect(arrived)
|
||||
|
||||
/obj/effect/effect/smoke/proc/affect(var/mob/living/carbon/M)
|
||||
/obj/effect/smoke/proc/affect(var/mob/living/carbon/M)
|
||||
if (istype(M))
|
||||
return 0
|
||||
if (M.internal != null)
|
||||
@@ -149,13 +150,13 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
// Illumination
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/smoke/illumination
|
||||
/obj/effect/smoke/illumination
|
||||
name = "illumination"
|
||||
opacity = 0
|
||||
icon = 'icons/effects/effects.dmi'
|
||||
icon_state = "sparks"
|
||||
|
||||
/obj/effect/effect/smoke/illumination/New(var/newloc, var/brightness=15, var/lifetime=10)
|
||||
/obj/effect/smoke/illumination/New(var/newloc, var/brightness=15, var/lifetime=10)
|
||||
time_to_live=lifetime
|
||||
..()
|
||||
set_light(brightness)
|
||||
@@ -164,15 +165,15 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
// Bad smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/smoke/bad
|
||||
/obj/effect/smoke/bad
|
||||
time_to_live = 200
|
||||
|
||||
/obj/effect/effect/smoke/bad/Move()
|
||||
..()
|
||||
/obj/effect/smoke/bad/Move()
|
||||
. = ..()
|
||||
for(var/mob/living/carbon/M in get_turf(src))
|
||||
affect(M)
|
||||
|
||||
/obj/effect/effect/smoke/bad/affect(var/mob/living/carbon/M)
|
||||
/obj/effect/smoke/bad/affect(var/mob/living/carbon/M)
|
||||
if (!..())
|
||||
return 0
|
||||
M.drop_item()
|
||||
@@ -183,7 +184,7 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
spawn ( 20 )
|
||||
M.coughedtime = 0
|
||||
|
||||
/obj/effect/effect/smoke/bad/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
/obj/effect/smoke/bad/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
if(air_group || (height==0))
|
||||
return TRUE
|
||||
|
||||
@@ -199,14 +200,14 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
// Sleep smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/smoke/sleepy
|
||||
/obj/effect/smoke/sleepy
|
||||
|
||||
/obj/effect/effect/smoke/sleepy/Move()
|
||||
..()
|
||||
/obj/effect/smoke/sleepy/Move()
|
||||
. = ..()
|
||||
for(var/mob/living/carbon/M in get_turf(src))
|
||||
affect(M)
|
||||
|
||||
/obj/effect/effect/smoke/sleepy/affect(mob/living/carbon/M)
|
||||
/obj/effect/smoke/sleepy/affect(mob/living/carbon/M)
|
||||
if (!..())
|
||||
return 0
|
||||
|
||||
@@ -222,16 +223,16 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
/////////////////////////////////////////////
|
||||
|
||||
|
||||
/obj/effect/effect/smoke/mustard
|
||||
/obj/effect/smoke/mustard
|
||||
name = "mustard gas"
|
||||
icon_state = "mustard"
|
||||
|
||||
/obj/effect/effect/smoke/mustard/Move()
|
||||
..()
|
||||
/obj/effect/smoke/mustard/Move()
|
||||
. = ..()
|
||||
for(var/mob/living/carbon/human/R in get_turf(src))
|
||||
affect(R)
|
||||
|
||||
/obj/effect/effect/smoke/mustard/affect(var/mob/living/carbon/human/R)
|
||||
/obj/effect/smoke/mustard/affect(var/mob/living/carbon/human/R)
|
||||
if (!..())
|
||||
return 0
|
||||
if (R.wear_suit != null)
|
||||
@@ -253,7 +254,7 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
/datum/effect/effect/system/smoke_spread
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
var/smoke_type = /obj/effect/effect/smoke
|
||||
var/smoke_type = /obj/effect/smoke
|
||||
var/smoke_duration
|
||||
|
||||
/datum/effect/effect/system/smoke_spread/set_up(n = 5, c = 0, loca, direct, duration = 0)
|
||||
@@ -277,7 +278,7 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effect/effect/smoke/smoke = new smoke_type(src.location)
|
||||
var/obj/effect/smoke/smoke = new smoke_type(src.location)
|
||||
src.total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
@@ -294,14 +295,14 @@ would spawn and follow the beaker, even if it is carried or thrown.
|
||||
|
||||
|
||||
/datum/effect/effect/system/smoke_spread/bad
|
||||
smoke_type = /obj/effect/effect/smoke/bad
|
||||
smoke_type = /obj/effect/smoke/bad
|
||||
|
||||
/datum/effect/effect/system/smoke_spread/sleepy
|
||||
smoke_type = /obj/effect/effect/smoke/sleepy
|
||||
smoke_type = /obj/effect/smoke/sleepy
|
||||
|
||||
|
||||
/datum/effect/effect/system/smoke_spread/mustard
|
||||
smoke_type = /obj/effect/effect/smoke/mustard
|
||||
smoke_type = /obj/effect/smoke/mustard
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//////// Attach a steam trail to an object (eg. a reacting beaker) that will follow it
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
return
|
||||
|
||||
/obj/effect/expl_particles/Move()
|
||||
..()
|
||||
. = ..()
|
||||
return
|
||||
|
||||
/obj/effect/expl_particles/Destroy()
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
var/virtual_epicenter = locate(epicenter.x, epicenter.y, z)
|
||||
|
||||
//We assume each zlevel to be 9 meters tall, and apply the pythagorean theorem to obtain the radius of the sphere at that vertical distance from the epicenter
|
||||
var/virtual_heavy_range = abs(epicenter.z - z) ? ( sqrt(((heavy_range*heavy_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : heavy_range
|
||||
var/virtual_light_range = abs(epicenter.z - z) ? ( sqrt(((light_range*light_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : light_range
|
||||
var/virtual_heavy_range = abs(epicenter.z - z) ? ( sqrt(abs((heavy_range*heavy_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : heavy_range
|
||||
var/virtual_light_range = abs(epicenter.z - z) ? ( sqrt(abs((light_range*light_range)-((9*(epicenter.z - z))*(9*(epicenter.z - z))))) ) : light_range
|
||||
|
||||
#ifdef EMPDEBUG
|
||||
log_and_message_admins("EMPDEBUG: Heavy range for explosion at Z-level [z] is [virtual_heavy_range]")
|
||||
|
||||
@@ -415,9 +415,9 @@ pixel_x = 8;
|
||||
set_on(has_power) // has_power is given by our listener machinery
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/radio/intercom/forceMove(atom/dest)
|
||||
power_interface.forceMove(dest)
|
||||
..(dest)
|
||||
/obj/item/device/radio/intercom/forceMove(atom/destination)
|
||||
power_interface.forceMove(destination)
|
||||
. = ..()
|
||||
|
||||
/obj/item/device/radio/intercom/update_icon()
|
||||
ClearOverlays()
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
B.update_icon()
|
||||
|
||||
single_spark(T)
|
||||
new /obj/effect/effect/smoke/illumination(T, brightness=15)
|
||||
new /obj/effect/smoke/illumination(T, brightness=15)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/grenade/flashbang/explode_in_hand(var/mob/living/carbon/human/victim, var/obj/item/organ/external/exploded_hand)
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
return
|
||||
|
||||
/obj/item/reagent_containers/spray/chemsprayer/mister/Move()
|
||||
..()
|
||||
. = ..()
|
||||
if(loc != tank.loc)
|
||||
forceMove(tank.loc)
|
||||
|
||||
|
||||
@@ -670,7 +670,7 @@
|
||||
..()
|
||||
|
||||
/obj/item/trap/animal/Move()
|
||||
..()
|
||||
. = ..()
|
||||
if(captured)
|
||||
var/datum/M = captured.resolve()
|
||||
if(isliving(M))
|
||||
|
||||
@@ -113,7 +113,8 @@
|
||||
return ..()
|
||||
|
||||
/obj/structure/closet/crate/Move(var/turf/destination, dir)
|
||||
if(..())
|
||||
. = ..()
|
||||
if(.)
|
||||
if (locate(/obj/structure/table) in destination)
|
||||
if(locate(/obj/structure/table/rack) in destination)
|
||||
set_tablestatus(ABOVE_TABLE)
|
||||
|
||||
@@ -122,10 +122,10 @@
|
||||
painted_colour = new_colour
|
||||
return painted_colour != last_colour
|
||||
|
||||
/obj/structure/bed/forceMove(atom/dest)
|
||||
/obj/structure/bed/forceMove(atom/destination)
|
||||
. = ..()
|
||||
if(buckled)
|
||||
buckled.forceMove(dest)
|
||||
buckled.forceMove(destination)
|
||||
|
||||
/obj/structure/bed/ex_act(severity)
|
||||
switch(severity)
|
||||
@@ -519,7 +519,7 @@
|
||||
collapse()
|
||||
|
||||
/obj/structure/bed/roller/Move()
|
||||
..()
|
||||
. = ..()
|
||||
if(buckled)
|
||||
if(buckled.buckled_to == src)
|
||||
buckled.forceMove(src.loc)
|
||||
|
||||
@@ -400,7 +400,7 @@
|
||||
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
set_dir(ini_dir)
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
|
||||
Reference in New Issue
Block a user