mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user