mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
Escaped glitches distort when interacted with (#94556)
This commit is contained in:
@@ -1,35 +1,36 @@
|
||||
/datum/component/glitch
|
||||
/// Ref of the spawning forge
|
||||
var/datum/weakref/forge_ref
|
||||
var/datum/weakref/distort_component
|
||||
|
||||
/datum/component/glitch/Initialize(obj/machinery/quantum_server/server, obj/machinery/byteforge/forge)
|
||||
if(!isliving(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
RegisterSignal(forge, COMSIG_MACHINERY_POWER_RESTORED, PROC_REF(on_forge_power_restored))
|
||||
RegisterSignals(forge, list(COMSIG_MACHINERY_BROKEN, COMSIG_MACHINERY_POWER_LOST), PROC_REF(on_forge_broken))
|
||||
forge_ref = WEAKREF(forge)
|
||||
|
||||
var/mob/living/owner = parent
|
||||
server.remove_threat(owner) // so the server doesn't dust us
|
||||
var/health_boost = 0
|
||||
|
||||
if (forge)
|
||||
RegisterSignal(forge, COMSIG_MACHINERY_POWER_RESTORED, PROC_REF(on_forge_power_restored))
|
||||
RegisterSignals(forge, list(COMSIG_MACHINERY_BROKEN, COMSIG_MACHINERY_POWER_LOST), PROC_REF(on_forge_broken))
|
||||
forge_ref = WEAKREF(forge)
|
||||
server.remove_threat(owner) // so the server doesn't dust us
|
||||
health_boost = ROUND_UP(server.threat * 0.2)
|
||||
|
||||
owner.faction.Cut()
|
||||
owner.faction += list(ROLE_GLITCH)
|
||||
|
||||
var/current_max = owner.maxHealth + ROUND_UP(server.threat * 0.2)
|
||||
owner.maxHealth = clamp(current_max, 200, 500)
|
||||
owner.maxHealth = clamp(owner.maxHealth + health_boost, 200, 500)
|
||||
owner.fully_heal()
|
||||
owner.create_digital_aura()
|
||||
|
||||
var/atom/thing = owner
|
||||
thing.create_digital_aura()
|
||||
/datum/component/glitch/RegisterWithParent()
|
||||
RegisterSignal(parent, COMSIG_LIVING_DEATH, PROC_REF(on_death))
|
||||
distort_component = WEAKREF(parent.AddComponent(/datum/component/holographic_nature))
|
||||
|
||||
/// Sakujo
|
||||
/datum/component/glitch/proc/dust_mob()
|
||||
if(QDELETED(parent))
|
||||
return
|
||||
|
||||
var/mob/living/owner = parent
|
||||
owner.dust()
|
||||
/datum/component/glitch/UnregisterFromParent()
|
||||
UnregisterSignal(parent, COMSIG_LIVING_DEATH)
|
||||
QDEL_NULL(distort_component)
|
||||
|
||||
/// We don't want digital entities just lingering around as corpses.
|
||||
/datum/component/glitch/proc/on_death()
|
||||
@@ -41,10 +42,10 @@
|
||||
var/mob/living/owner = parent
|
||||
to_chat(owner, span_userdanger("You feel a strange sensation..."))
|
||||
|
||||
var/obj/machinery/byteforge/forge = forge_ref.resolve()
|
||||
var/obj/machinery/byteforge/forge = forge_ref?.resolve()
|
||||
forge?.setup_particles()
|
||||
|
||||
addtimer(CALLBACK(src, PROC_REF(dust_mob)), 2 SECONDS, TIMER_UNIQUE|TIMER_DELETE_ME|TIMER_STOPPABLE)
|
||||
owner.fade_into_nothing(3 SECONDS, 2 SECONDS)
|
||||
|
||||
/// If the forge breaks, we take a massive slowdown
|
||||
/datum/component/glitch/proc/on_forge_broken(datum/source)
|
||||
|
||||
Reference in New Issue
Block a user