mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Aiming to implement the framework oranges has detailed in https://tgstation13.org/phpBB/viewtopic.php?f=10&t=19102 Moves canmove to a bitflag in a new variable called mobility_flags, that will allow finer grain control of what someone can do codewise, for example, letting them move but not stand up, or stand up but not move. Adds Immobilize()d status effect that freezes movement but does not prevent anything else. Adds Paralyze()d which is oldstun "You can't do anything at all and knock down). Stun() will now prevent any item/UI usage and movement (which is similar to before). Knockdown() will now only knockdown without preventing item usage/movement. People knocked down will be able to crawl at softcrit-speeds Refactors some /mob variables and procs to /mob/living. update_canmove() refactored to update_mobility() and will handle mobility_flags instead of the removed canmove cl rscadd: Crawling is now possible if you are down but not stunned. Obviously, you will be slower. /cl Refactors are done. I'd rather get this merged faster than try to fine tune stuff like slips. The most obvious gameplay effect this pr has will be crawling, and I believe I made tiny tweaks but I can't find it Anything I missed or weird behavior should be reported.
118 lines
3.4 KiB
Plaintext
118 lines
3.4 KiB
Plaintext
|
|
/////////////////////////////////////////////
|
|
//////// Attach a trail to any object, that spawns when it moves (like for the jetpack)
|
|
/// just pass in the object to attach it to in set_up
|
|
/// Then do start() to start it and stop() to stop it, obviously
|
|
/// and don't call start() in a loop that will be repeated otherwise it'll get spammed!
|
|
/////////////////////////////////////////////
|
|
|
|
/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(!oldposition.has_gravity() || !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
|
|
|
|
/datum/effect_system/trail_follow/steam
|
|
effect_type = /obj/effect/particle_effect/steam
|
|
|
|
/obj/effect/particle_effect/ion_trails
|
|
name = "ion trails"
|
|
icon_state = "ion_trails"
|
|
anchored = TRUE
|
|
|
|
/obj/effect/particle_effect/ion_trails/flight
|
|
icon_state = "ion_trails_flight"
|
|
|
|
/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)
|
|
|
|
//Reagent-based explosion effect
|
|
|
|
/datum/effect_system/reagents_explosion
|
|
var/amount // TNT equivalent
|
|
var/flashing = 0 // does explosion creates flash effect?
|
|
var/flashing_factor = 0 // factor of how powerful the flash effect relatively to the explosion
|
|
var/explosion_message = 1 //whether we show a message to mobs.
|
|
|
|
/datum/effect_system/reagents_explosion/set_up(amt, loca, flash = 0, flash_fact = 0, message = 1)
|
|
amount = amt
|
|
explosion_message = message
|
|
if(isturf(loca))
|
|
location = loca
|
|
else
|
|
location = get_turf(loca)
|
|
|
|
flashing = flash
|
|
flashing_factor = flash_fact
|
|
|
|
/datum/effect_system/reagents_explosion/start()
|
|
if(explosion_message)
|
|
location.visible_message("<span class='danger'>The solution violently explodes!</span>", \
|
|
"<span class='italics'>You hear an explosion!</span>")
|
|
if (amount < 1)
|
|
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
|
|
s.set_up(2, 1, location)
|
|
s.start()
|
|
|
|
for(var/mob/living/L in viewers(1, location))
|
|
if(prob(50 * amount))
|
|
to_chat(L, "<span class='danger'>The explosion knocks you down.</span>")
|
|
L.Paralyze(rand(20,100))
|
|
return
|
|
else
|
|
dyn_explosion(location, amount, flashing_factor) |