mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-26 17:41:05 +00:00
* [NO GBP] Jetpack and spacedrift: Fixes and niceties (#66628) * Jetpack and spacedrift: Fixes and niceties Ok so when I ported spacemovement onto movement loop, I neglected to port this behavior that existed to support jetpacks. Basically, if something that lets you move while spacedrifing completes a move while you're spacedrifting, the drift should "disable" to let it complete, and then later restart. I neglected to add support for that, so that's what this does. There's some other stuff going on here, mostly things to let jetpacks ignore some of drift's extra behavior, since when a jetpack is not on stablized, we want both to coexist. It's a bit of a mess, I'm sorry about that. Oh and at temporal's suggestion I've moved the visual_delay set from newtonian move to an istype on the drift component, that was a good idea, thanks quiet * Makes dropping a pull while drifting carry the momentum into the pulled thing\ * Adds some extra context to Process_Spacemove, fixes a bunch of stupid space bugs It used to be, if you called Process_Spacemove with a direction, it assumed you were an "action", so a client or mob trying to move in a direction. Unfortuantely for it, I needed to be able to use direction to make mob pull drifting work. So we now actually pass in a second variable called continuous_move, which tracks if this Process_Spacemove is on behalf of a continuous move or not In addition to this, I've added logic to bumping "off" someone to prevent backbumping if that makes sense, since the bump is in the form of a newtonian move that's run before the thing that's bumping actually moves, we need some way to exclude it from holding the other object in place. * Adds a jetpack component, uses it to unify all three versions of jetpacking I hate you fikou There were three copies of the same behavior, which made it hard to fix stuff. Let's just componentize it * Fixes jetpacks stabalizing even without fuel This is mildly hacky. The real fix is to do this with events, but I really don't wanna bend my brain like that. This'll do * Ensures turn_off always has a user) * Shut pu * Bulky drags no longer effect your movespeed in space, fixing a consistency issue between them and all other forms of drags * Removes some redundant code, cleans up some messy stuff * Removes redundant safety checking from jetpack code * see above * Removes redundant signals * [NO GBP] Jetpack and spacedrift: Fixes and niceties Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
79 lines
2.3 KiB
Plaintext
79 lines
2.3 KiB
Plaintext
/* This is an attempt to make some easily reusable "particle" type effect, to stop the code
|
|
constantly having to be rewritten. An item like the jetpack that uses the ion_trail_follow system, just has one
|
|
defined, then set up when it is created with New(). Then this same system can just be reused each time
|
|
it needs to create more trails.A beaker could have a steam_trail_follow system set up, then the steam
|
|
would spawn and follow the beaker, even if it is carried or thrown.
|
|
*/
|
|
|
|
|
|
/obj/effect/particle_effect
|
|
name = "particle effect"
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
|
pass_flags = PASSTABLE | PASSGRILLE
|
|
anchored = TRUE
|
|
|
|
/obj/effect/particle_effect/Initialize(mapload)
|
|
. = ..()
|
|
GLOB.cameranet.updateVisibility(src)
|
|
|
|
/obj/effect/particle_effect/Destroy()
|
|
GLOB.cameranet.updateVisibility(src)
|
|
return ..()
|
|
|
|
// Prevents effects from getting registered for SSspacedrift
|
|
/obj/effect/particle_effect/newtonian_move(direction, instant = FALSE, start_delay = 0)
|
|
return TRUE
|
|
|
|
/datum/effect_system
|
|
var/number = 3
|
|
var/cardinals_only = FALSE
|
|
var/turf/location
|
|
var/atom/holder
|
|
var/effect_type
|
|
var/total_effects = 0
|
|
var/autocleanup = FALSE //will delete itself after use
|
|
|
|
/datum/effect_system/Destroy()
|
|
holder = null
|
|
location = null
|
|
return ..()
|
|
|
|
/datum/effect_system/proc/set_up(number = 3, cardinals_only = FALSE, location)
|
|
src.number = min(number, 10)
|
|
src.cardinals_only = cardinals_only
|
|
src.location = get_turf(location)
|
|
|
|
/datum/effect_system/proc/attach(atom/atom)
|
|
holder = atom
|
|
|
|
/datum/effect_system/proc/start()
|
|
if(QDELETED(src))
|
|
return
|
|
for(var/i in 1 to number)
|
|
if(total_effects > 20)
|
|
return
|
|
generate_effect()
|
|
|
|
/datum/effect_system/proc/generate_effect()
|
|
if(holder)
|
|
location = get_turf(holder)
|
|
var/obj/effect/effect = new effect_type(location)
|
|
total_effects++
|
|
var/direction
|
|
if(cardinals_only)
|
|
direction = pick(GLOB.cardinals)
|
|
else
|
|
direction = pick(GLOB.alldirs)
|
|
var/step_amt = pick(1,2,3)
|
|
var/step_delay = 5
|
|
|
|
var/datum/move_loop/loop = SSmove_manager.move(effect, direction, step_delay, timeout = step_delay * step_amt, priority = MOVEMENT_ABOVE_SPACE_PRIORITY)
|
|
RegisterSignal(loop, COMSIG_PARENT_QDELETING, .proc/decrement_total_effect)
|
|
|
|
/datum/effect_system/proc/decrement_total_effect(datum/source)
|
|
SIGNAL_HANDLER
|
|
total_effects--
|
|
if(!autocleanup || total_effects > 0)
|
|
return
|
|
QDEL_IN(src, 2 SECONDS)
|