Port /tg/ move manager, drift and jetpack components. (#27698)

* Port /tg/ move manager, drift and jetpack components.

* don't add go through newtonian movement if not moved to a turf

* various cleans for blood drifts and mob speed

* fix slow meteors

* why on fuck's earth aren't speedbikes vehicles

* style lint

* also wtf

* okay i'm an idiot

* fix meaty ore speed and blood decal double stepping

* fix not unbuckling pulled object occupants

* don't bother dealing with immovable rods just yet

* exclude bubblegum and vetus from move manager for now

* fix issues related to null weightless blood icons

* reset blood icon state properly

* fuck it, we'll deal with mobs when basic mobs happen

* break infinite loop in decal splat
This commit is contained in:
warriorstar-orion
2025-01-22 22:49:58 +00:00
committed by GitHub
parent 3954981ff2
commit 157276d6cb
105 changed files with 2366 additions and 538 deletions
@@ -2,7 +2,7 @@
name = "xeno blood"
desc = "It's green and acidic. It looks like... <i>blood?</i>"
icon = 'icons/effects/blood.dmi'
basecolor = "#05EE05"
basecolor = COLOR_BLOOD_XENO
bloodiness = BLOOD_AMOUNT_PER_DECAL
blood_state = BLOOD_STATE_XENO
@@ -15,11 +15,7 @@
desc = "Gnarly..."
icon_state = "xgib1"
random_icon_states = list("xgib1", "xgib2", "xgib3", "xgib4", "xgib5", "xgib6")
basecolor = "#05EE05"
/obj/effect/decal/cleanable/blood/gibs/xeno/update_icon()
color = "#FFFFFF"
. = ..(NONE)
basecolor = COLOR_BLOOD_XENO
/obj/effect/decal/cleanable/blood/gibs/xeno/up
random_icon_states = list("xgib1", "xgib2", "xgib3", "xgib4", "xgib5", "xgib6", "xgibup1", "xgibup1", "xgibup1")
@@ -37,7 +33,7 @@
random_icon_states = list("xgibmid1", "xgibmid2", "xgibmid3")
/obj/effect/decal/cleanable/blood/xtracks
basecolor = "#05EE05"
basecolor = COLOR_BLOOD_XENO
/// this is the alien blood file, slimes are aliens.
/obj/effect/decal/cleanable/blood/slime
@@ -14,6 +14,7 @@
random_icon_states = list("mfloor1", "mfloor2", "mfloor3", "mfloor4", "mfloor5", "mfloor6", "mfloor7")
blood_DNA = list()
var/base_icon = 'icons/effects/blood.dmi'
base_icon_state = "mfloor1"
var/blood_state = BLOOD_STATE_HUMAN
bloodiness = BLOOD_AMOUNT_PER_DECAL
var/basecolor = "#A10808" // Color when wet.
@@ -21,7 +22,8 @@
var/dry_timer = 0
var/off_floor = FALSE
var/image/weightless_image
inertia_move_delay = 1 // so they dont collide with who emitted them
var/weightless_icon = 'icons/effects/blood_weightless.dmi'
inertia_move_delay = 5 // so they dont collide with who emitted them
/obj/effect/decal/cleanable/blood/replace_decal(obj/effect/decal/cleanable/blood/C)
if(C == src)
@@ -33,18 +35,32 @@
C.bloodiness += bloodiness
return ..()
/obj/effect/decal/cleanable/blood/Initialize(mapload)
/obj/effect/decal/cleanable/blood/Initialize(mapload, decal_color)
. = ..()
weightless_image = new()
if(decal_color)
basecolor = decal_color
else
if(basecolor == "rainbow")
basecolor = "#[pick("FF0000","FF7F00","FFFF00","00FF00","0000FF","4B0082","8F00FF")]"
color = basecolor
base_icon_state = icon_state
var/turf/T = get_turf(src)
check_gravity(T)
update_icon()
if(!gravity_check)
if(gravity_check)
if(!. && !QDELETED(src))
dry_timer = addtimer(CALLBACK(src, PROC_REF(dry)), DRYING_TIME * (amount+1), TIMER_STOPPABLE)
else
if(prob(50))
animate_float(src, -1, rand(30,120))
else
animate_levitate(src, -1, rand(30,120))
//weightless blood cannot dry
return
if(!. && !QDELETED(src))
dry_timer = addtimer(CALLBACK(src, PROC_REF(dry)), DRYING_TIME * (amount+1), TIMER_STOPPABLE)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_atom_entered),
)
@@ -56,38 +72,32 @@
QDEL_NULL(weightless_image)
return ..()
/obj/effect/decal/cleanable/blood/update_icon()
var/turf/T = get_turf(src)
check_gravity(T)
/obj/effect/decal/cleanable/blood/update_overlays()
. = ..()
if(gravity_check)
return
if(!weightless_image)
color = COLOR_WHITE
weightless_image = image(weightless_icon, base_icon_state)
weightless_image.icon += basecolor
. += weightless_image
/obj/effect/decal/cleanable/blood/update_icon()
if(should_be_off_floor())
off_floor = TRUE
layer = ABOVE_MOB_LAYER
plane = GAME_PLANE
if(basecolor == "rainbow")
basecolor = "#[pick("FF0000","FF7F00","FFFF00","00FF00","0000FF","4B0082","8F00FF")]"
color = basecolor
if(!gravity_check)
if(prob(50))
animate_float(src, -1, rand(30,120))
else
animate_levitate(src, -1, rand(30,120))
if(weightless_image && weightless_image.icon_state)
icon_state = weightless_image.icon_state
overlays -= weightless_image
color = "#FFFFFF"
icon = 'icons/effects/blood_weightless.dmi'
weightless_image = image(icon, icon_state)
icon_state = "empty"
weightless_image.icon += basecolor
overlays += weightless_image
if(gravity_check)
icon = initial(icon)
icon_state = base_icon_state
color = basecolor
else
overlays.Cut()
icon_state = null
..()
/obj/effect/decal/cleanable/blood/proc/should_be_off_floor()
@@ -116,32 +126,17 @@
return
if(loc != T)
forceMove(T) //move to the turf to splatter on
animate(src) //stop floating
gravity_check = ALWAYS_IN_GRAVITY
icon = initial(icon)
icon_state = weightless_image.icon_state
layer = initial(layer)
plane = initial(plane)
animate(src)
update_icon()
/obj/effect/decal/cleanable/blood/Process_Spacemove(movement_dir)
/obj/effect/decal/cleanable/blood/Process_Spacemove(movement_dir = 0, continuous_move = FALSE)
if(gravity_check)
return TRUE
if(has_gravity(src))
if(!gravity_check)
splat(get_step(src, movement_dir))
return TRUE
if(pulledby && !pulledby.pulling)
return TRUE
if(throwing)
return TRUE
return FALSE
return ..()
/obj/effect/decal/cleanable/blood/Bump(atom/A)
if(gravity_check)
@@ -162,8 +157,11 @@
return ..()
/obj/effect/decal/cleanable/blood/proc/bloodyify_human(mob/living/carbon/human/H)
if(inertia_dir && H.inertia_dir == inertia_dir) //if they are moving the same direction we are, no collison
return
// Originally this code would check to see if both us and the human
// we collided with had inertia in the same direction, and avoided collision
// if so. This might be possible with movement loops but, realistically,
// if we've gotten here, the objects have collided no matter what direction
// they were going in.
var/list/obj/item/things_to_potentially_bloody = list()
var/count = amount + 1
@@ -317,17 +315,21 @@
mergeable_decal = TRUE
/obj/effect/decal/cleanable/blood/gibs/proc/streak(list/directions)
set waitfor = 0
var/delay = 2
var/range = pick(1, 200; 2, 150; 3, 50; 4)
var/direction = pick(directions)
for(var/i = 0, i < pick(1, 200; 2, 150; 3, 50; 4), i++)
sleep(3)
if(i > 0)
var/obj/effect/decal/cleanable/blood/b = new /obj/effect/decal/cleanable/blood/splatter(loc)
b.basecolor = src.basecolor
b.update_icon()
if(step_to(src, get_step(src, direction), 0))
break
var/datum/move_loop/loop = GLOB.move_manager.move_to(src, get_step(src, direction), delay = delay, timeout = range * delay, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
RegisterSignal(loop, COMSIG_MOVELOOP_POSTPROCESS, PROC_REF(spread_movement_effects))
/obj/effect/decal/cleanable/blood/gibs/proc/spread_movement_effects(datum/move_loop/has_target/source)
SIGNAL_HANDLER // COMSIG_MOVELOOP_POSTPROCESS
var/obj/effect/decal/cleanable/blood/target = source.target
var/obj/effect/decal/cleanable/blood/splatter/splatter = new(loc, istype(target) ? target.basecolor : basecolor)
if(istype(target))
splatter.basecolor = target.basecolor
splatter.update_icon()
/obj/effect/decal/cleanable/blood/old/Initialize(mapload)
. = ..()
@@ -159,9 +159,8 @@
/obj/effect/decal/cleanable/vomit/Initialize(mapload)
. = ..()
var/turf/T = get_turf(src)
gravity_check = has_gravity(src, T)
if(loc != T)
forceMove(T)
check_gravity(T)
if(!gravity_check)
layer = MOB_LAYER
plane = GAME_PLANE
@@ -177,9 +176,17 @@
AddElement(/datum/element/connect_loc, loc_connections)
/obj/effect/decal/cleanable/vomit/Bump(atom/A)
. = ..()
if(A.density)
if(gravity_check)
return ..()
if(iswallturf(A) || istype(A, /obj/structure/window))
splat(A)
return
else if(A.density)
splat(get_turf(A))
return
return ..()
/obj/effect/decal/cleanable/vomit/proc/on_atom_entered(datum/source, atom/movable/entered)
if(!gravity_check)
@@ -204,22 +211,11 @@
plane = initial(plane)
animate(src)
/obj/effect/decal/cleanable/vomit/Process_Spacemove(movement_dir)
/obj/effect/decal/cleanable/vomit/Process_Spacemove(movement_dir = 0, continuous_move = FALSE)
if(gravity_check)
return 1
return TRUE
if(has_gravity(src))
if(!gravity_check)
splat(get_step(src, movement_dir))
return 1
if(pulledby && !pulledby.pulling)
return 1
if(throwing)
return 1
return 0
return ..()
/obj/effect/decal/cleanable/vomit/green
name = "green vomit"
@@ -12,6 +12,19 @@
/obj/effect/decal/chempuff/blob_act(obj/structure/blob/B)
return
/obj/effect/decal/chempuff/proc/loop_ended(datum/source)
SIGNAL_HANDLER // COMSIG_PARENT_QDELETING
if(QDELETED(src))
return
qdel(src)
/obj/effect/decal/chempuff/proc/check_move(datum/move_loop/source, succeeded)
SIGNAL_HANDLER // COMSIG_MOVELOOP_POSTPROCESS
var/turf/our_turf = get_turf(src)
reagents.reaction(our_turf)
for(var/atom/T in our_turf)
reagents.reaction(T)
/obj/effect/decal/snow
name = "snow"
density = FALSE
@@ -1,3 +1,59 @@
/datum/effect_system/trail_follow
var/turf/oldposition
var/active = FALSE
var/allow_overlap = FALSE
var/auto_process = TRUE
var/qdel_in_time = 10
var/fadetype = "ion_fade"
var/fade = TRUE
var/nograv_required = FALSE
/datum/effect_system/trail_follow/set_up(atom/atom)
attach(atom)
oldposition = get_turf(atom)
/datum/effect_system/trail_follow/Destroy()
oldposition = null
stop()
return ..()
/datum/effect_system/trail_follow/proc/stop()
oldposition = null
STOP_PROCESSING(SSfastprocess, src)
active = FALSE
return TRUE
/datum/effect_system/trail_follow/start()
oldposition = get_turf(holder)
if(!check_conditions())
return FALSE
if(auto_process)
START_PROCESSING(SSfastprocess, src)
active = TRUE
return TRUE
/datum/effect_system/trail_follow/process()
generate_effect()
/datum/effect_system/trail_follow/generate_effect()
if(!check_conditions())
return stop()
if(oldposition && !(oldposition == get_turf(holder)))
if(!has_gravity(oldposition) || !nograv_required)
var/obj/effect/E = new effect_type(oldposition)
set_dir(E)
if(fade)
flick(fadetype, E)
E.icon_state = ""
if(qdel_in_time)
QDEL_IN(E, qdel_in_time)
oldposition = get_turf(holder)
/datum/effect_system/trail_follow/proc/check_conditions()
if(!get_turf(holder))
return FALSE
return TRUE
/// Ion trails for jetpacks, ion thrusters and other space-flying things
/obj/effect/particle_effect/ion_trails
name = "ion trails"
@@ -8,6 +64,17 @@
dir = targetdir
QDEL_IN(src, 0.6 SECONDS)
/datum/effect_system/trail_follow/ion
effect_type = /obj/effect/particle_effect/ion_trails
nograv_required = TRUE
qdel_in_time = 20
/datum/effect_system/trail_follow/proc/set_dir(obj/effect/particle_effect/ion_trails/I)
I.setDir(holder.dir)
/datum/effect_system/trail_follow/ion/grav_allowed
nograv_required = FALSE
//Reagent-based explosion effect
/datum/effect_system/reagents_explosion
var/amount // TNT equivalent
+5 -2
View File
@@ -97,7 +97,7 @@ GLOBAL_LIST_INIT(meteors_gore, list(/obj/effect/meteor/meaty = 5, /obj/effect/me
if(timerid)
deltimer(timerid)
GLOB.meteor_list -= src
walk(src, 0) //this cancels the walk_towards() proc
GLOB.move_manager.stop_looping(src) //this cancels the GLOB.move_manager.home_onto() proc
return ..()
/obj/effect/meteor/Initialize(mapload, target)
@@ -109,6 +109,9 @@ GLOBAL_LIST_INIT(meteors_gore, list(/obj/effect/meteor/meaty = 5, /obj/effect/me
timerid = QDEL_IN(src, lifetime)
chase_target(target)
/obj/effect/meteor/Process_Spacemove(movement_dir, continuous_move)
return TRUE
/obj/effect/meteor/Bump(atom/A)
if(A)
ram_turf(get_turf(A))
@@ -158,7 +161,7 @@ GLOBAL_LIST_INIT(meteors_gore, list(/obj/effect/meteor/meaty = 5, /obj/effect/me
/obj/effect/meteor/proc/chase_target(atom/chasing, delay = 1)
set waitfor = FALSE
if(chasing)
walk_towards(src, chasing, delay)
GLOB.move_manager.home_onto(src, chasing, delay)
/obj/effect/meteor/proc/meteor_effect()
if(heavy)
@@ -140,7 +140,7 @@
/obj/effect/spawner/random/bluespace_tap/cultural_rare
name = "rare cultural artifacts"
loot = list(
/obj/vehicle/space/speedbike/red,
/obj/tgvehicle/speedbike/red,
/obj/item/gun/projectile/automatic/l6_saw/toy,
/obj/item/gun/projectile/automatic/sniper_rifle/toy,
/obj/item/bedsheet/centcom,
@@ -181,8 +181,8 @@
/obj/vehicle/motorcycle,
/obj/vehicle/snowmobile,
/obj/vehicle/snowmobile/blue,
/obj/vehicle/space/speedbike/red,
/obj/vehicle/space/speedbike,
/obj/tgvehicle/speedbike/red,
/obj/tgvehicle/speedbike,
)
/obj/effect/spawner/random/traders/vehicle/make_item(spawn_loc, type_path_to_make)
@@ -47,7 +47,7 @@
icon_state = "clusterbang_segment_active"
payload = payload_type
active = TRUE
walk_away(src, loc, rand(1,4))
GLOB.move_manager.move_away(src, loc, rand(1,4))
spawn(rand(15,60))
prime()
@@ -69,7 +69,7 @@
var/obj/item/grenade/P = new type(loc)
if(istype(P, /obj/item/grenade))
P.active = TRUE
walk_away(P,loc,rand(1,4))
GLOB.move_manager.move_away(P,loc,rand(1,4))
spawn(rand(15,60))
if(!QDELETED(P))
@@ -107,12 +107,11 @@
/obj/item/grenade/attack_hand()
///We need to clear the walk_to on grabbing a moving grenade to have it not leap straight out of your hand
walk(src, null, null)
GLOB.move_manager.stop_looping(src)
..()
/obj/item/grenade/Destroy()
///We need to clear the walk_to on destroy to allow a grenade which uses walk_to or related to properly GC
walk_to(src, 0)
GLOB.move_manager.stop_looping(src)
return ..()
/obj/item/grenade/cmag_act(mob/user)
@@ -348,8 +348,7 @@
// Make each item scatter a bit
for(var/obj/item/I in oldContents)
I.forceMove(M)
INVOKE_ASYNC(src, PROC_REF(scatter_tray_items), I)
do_scatter(I)
if(prob(50))
playsound(M, 'sound/items/trayhit1.ogg', 50, 1)
@@ -359,13 +358,18 @@
if(ishuman(M) && prob(10))
M.KnockDown(4 SECONDS)
/obj/item/storage/bag/tray/proc/scatter_tray_items(obj/item/I)
if(!I)
return
/obj/item/storage/bag/tray/proc/do_scatter(obj/item/tray_item)
var/delay = rand(2, 4)
var/datum/move_loop/loop = GLOB.move_manager.move_rand(tray_item, GLOB.cardinal, delay, timeout = rand(1, 2) * delay, flags = MOVEMENT_LOOP_START_FAST)
//This does mean scattering is tied to the tray. Not sure how better to handle it
RegisterSignal(loop, COMSIG_MOVELOOP_POSTPROCESS, PROC_REF(change_speed))
for(var/i in 1 to rand(1, 2))
step(I, pick(NORTH,SOUTH,EAST,WEST))
sleep(rand(2, 4))
/obj/item/storage/bag/tray/proc/change_speed(datum/move_loop/source)
SIGNAL_HANDLER // COMSIG_MOVELOOP_POSTPROCESS
var/new_delay = rand(2, 4)
var/count = source.lifetime / source.delay
source.lifetime = count * new_delay
source.delay = new_delay
/obj/item/storage/bag/tray/update_icon_state()
return
@@ -415,7 +419,7 @@
I.forceMove(dropspot)
// If there is no table, dump the contents of the tray at our feet like we're doing the service equivilent of a micdrop.
if(!found_table && isturf(dropspot))
INVOKE_ASYNC(src, PROC_REF(scatter_tray_items), I)
INVOKE_ASYNC(src, PROC_REF(do_scatter), I)
if(found_table)
user.visible_message("<span class='notice'>[user] unloads [user.p_their()] serving tray.</span>")
@@ -10,8 +10,37 @@
actions_types = list(/datum/action/item_action/set_internals, /datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization)
var/gas_type = "oxygen"
var/on = FALSE
var/stabilizers = FALSE
var/volume_rate = 500 //Needed for borg jetpack transfer
var/stabilize = FALSE
var/thrust_callback
/obj/item/tank/jetpack/Initialize(mapload)
. = ..()
thrust_callback = CALLBACK(src, PROC_REF(allow_thrust), 0.01)
configure_jetpack(stabilize)
/obj/item/tank/jetpack/Destroy()
thrust_callback = null
return ..()
/**
* configures/re-configures the jetpack component
*
* Arguments
* stabilize - Should this jetpack be stabalized
*/
/obj/item/tank/jetpack/proc/configure_jetpack(stabilize)
src.stabilize = stabilize
AddComponent( \
/datum/component/jetpack, \
src.stabilize, \
COMSIG_JETPACK_ACTIVATED, \
COMSIG_JETPACK_DEACTIVATED, \
JETPACK_ACTIVATION_FAILED, \
thrust_callback, \
/datum/effect_system/trail_follow/ion \
)
/obj/item/tank/jetpack/populate_gas()
if(gas_type)
@@ -37,8 +66,8 @@
/obj/item/tank/jetpack/proc/toggle_stabilization(mob/user)
if(on)
stabilizers = !stabilizers
to_chat(user, "<span class='notice'>You turn [src]'s stabilization [stabilizers ? "on" : "off"].</span>")
configure_jetpack(!stabilize)
to_chat(user, "<span class='notice'>You turn [src]'s stabilization [stabilize ? "on" : "off"].</span>")
/obj/item/tank/jetpack/proc/cycle(mob/user)
if(user.incapacitated())
@@ -54,31 +83,40 @@
var/datum/action/A = X
A.UpdateButtons()
/obj/item/tank/jetpack/proc/turn_on(mob/user)
if(SEND_SIGNAL(src, COMSIG_JETPACK_ACTIVATED, user) & JETPACK_ACTIVATION_FAILED)
return FALSE
on = TRUE
icon_state = "[initial(icon_state)]-on"
/obj/item/tank/jetpack/proc/turn_off(mob/user)
SEND_SIGNAL(src, COMSIG_JETPACK_DEACTIVATED, user)
on = FALSE
stabilizers = FALSE
icon_state = initial(icon_state)
/obj/item/tank/jetpack/proc/allow_thrust(num, mob/living/user)
if(!on)
return 0
/obj/item/tank/jetpack/dropped(mob/user, silent)
. = ..()
if(on)
turn_off(user)
/obj/item/tank/jetpack/proc/allow_thrust(num)
if(!ismob(loc))
return FALSE
var/mob/user = loc
if((num < 0.005 || air_contents.total_moles() < num))
turn_off(user)
return 0
return FALSE
var/datum/gas_mixture/removed = air_contents.remove(num)
if(removed.total_moles() < 0.005)
turn_off(user)
return 0
return FALSE
var/turf/T = get_turf(user)
T.blind_release_air(removed)
return 1
return TRUE
/obj/item/tank/jetpack/improvised
name = "improvised jetpack"
+1 -1
View File
@@ -43,7 +43,7 @@
REMOVE_TRAIT(loc, TRAIT_TURF_COVERED, UNIQUE_TRAIT_SOURCE(src))
return ..()
/obj/structure/Move()
/obj/structure/Move(atom/newloc, direct = 0, glide_size_override = 0, update_dir = TRUE)
var/atom/old = loc
if(!..())
return FALSE
+2 -2
View File
@@ -311,7 +311,7 @@
if(pass_info.is_movable)
. = . || pass_info.pass_flags & PASSTABLE
/obj/structure/m_tray/Process_Spacemove(movement_dir)
/obj/structure/m_tray/Process_Spacemove(movement_dir = 0, continuous_move = FALSE)
return TRUE
/*
@@ -582,7 +582,7 @@ GLOBAL_LIST_EMPTY(crematoriums)
connected = null
return ..()
/obj/structure/c_tray/Process_Spacemove(movement_dir)
/obj/structure/c_tray/Process_Spacemove(movement_dir = 0, continuous_move = FALSE)
return TRUE
// Crematorium switch
@@ -32,7 +32,7 @@
W.setDir(dir)
qdel(src)
/obj/structure/chair/Move(atom/newloc, direct)
/obj/structure/chair/Move(atom/newloc, direct = 0, glide_size_override = 0, update_dir = TRUE)
. = ..()
handle_rotation()
@@ -73,8 +73,6 @@
if(!buckled_mob.Move(get_step(buckled_mob, direction), direction))
loc = buckled_mob.loc //we gotta go back
last_move = buckled_mob.last_move
inertia_dir = last_move
buckled_mob.inertia_dir = last_move
. = 0
else
@@ -50,7 +50,7 @@
stop_following()
return ..()
/obj/structure/transit_tube_pod/Process_Spacemove()
/obj/structure/transit_tube_pod/Process_Spacemove(movement_dir = 0, continuous_move = FALSE)
if(moving) //No drifting while moving in the tubes
return TRUE
else return ..()