diff --git a/code/datums/components/anti_magic.dm b/code/datums/components/anti_magic.dm
index 47cc5fa24cc..c5c672e6ce4 100644
--- a/code/datums/components/anti_magic.dm
+++ b/code/datums/components/anti_magic.dm
@@ -129,7 +129,7 @@
antimagic_color = LIGHT_COLOR_DARK_BLUE
playsound(user, 'sound/magic/magic_block_mind.ogg', 50, TRUE)
- user.mob_light(_range = 2, _color = antimagic_color, _duration = 5 SECONDS)
+ user.mob_light(range = 2, color = antimagic_color, duration = 5 SECONDS)
user.add_overlay(antimagic_effect)
addtimer(CALLBACK(user, TYPE_PROC_REF(/atom, cut_overlay), antimagic_effect), 50)
diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm
index 3d9c49524eb..c00df24a164 100644
--- a/code/datums/mutations/body.dm
+++ b/code/datums/mutations/body.dm
@@ -230,47 +230,47 @@
quality = POSITIVE
text_gain_indication = "Your skin begins to glow softly."
instability = 5
- var/obj/effect/dummy/luminescent_glow/glowth //shamelessly copied from luminescents
- var/glow = 2.5
- var/range = 2.5
- var/glow_color
power_coeff = 1
conflicts = list(/datum/mutation/human/glow/anti)
+ var/glow_power = 2.5
+ var/glow_range = 2.5
+ var/glow_color
+ var/obj/effect/dummy/lighting_obj/moblight/glow
/datum/mutation/human/glow/on_acquiring(mob/living/carbon/human/owner)
. = ..()
if(.)
return
- glow_color = glow_color()
- glowth = new(owner)
+ glow_color = get_glow_color()
+ glow = owner.mob_light()
modify()
// Override modify here without a parent call, because we don't actually give an action.
/datum/mutation/human/glow/modify()
- if(!glowth)
+ if(!glow)
return
- glowth.set_light_range_power_color(range * GET_MUTATION_POWER(src), glow, glow_color)
-
-/// Returns the color for the glow effect
-/datum/mutation/human/glow/proc/glow_color()
- return pick(COLOR_RED, COLOR_BLUE, COLOR_YELLOW, COLOR_GREEN, COLOR_PURPLE, COLOR_ORANGE)
+ glow.set_light_range_power_color(glow_range * GET_MUTATION_POWER(src), glow_power, glow_color)
/datum/mutation/human/glow/on_losing(mob/living/carbon/human/owner)
. = ..()
if(.)
return
- QDEL_NULL(glowth)
+ QDEL_NULL(glow)
+
+/// Returns a color for the glow effect
+/datum/mutation/human/glow/proc/get_glow_color()
+ return pick(COLOR_RED, COLOR_BLUE, COLOR_YELLOW, COLOR_GREEN, COLOR_PURPLE, COLOR_ORANGE)
/datum/mutation/human/glow/anti
name = "Anti-Glow"
desc = "Your skin seems to attract and absorb nearby light creating 'darkness' around you."
- text_gain_indication = "Your light around you seems to disappear."
+ text_gain_indication = "The light around you seems to disappear."
glow = -1.5
conflicts = list(/datum/mutation/human/glow)
locked = TRUE
-/datum/mutation/human/glow/anti/glow_color()
+/datum/mutation/human/glow/anti/get_glow_color()
return COLOR_BLACK
/datum/mutation/human/strong
diff --git a/code/datums/status_effects/debuffs/fire_stacks.dm b/code/datums/status_effects/debuffs/fire_stacks.dm
index 41fcaf0dcc8..03e2d1145bb 100644
--- a/code/datums/status_effects/debuffs/fire_stacks.dm
+++ b/code/datums/status_effects/debuffs/fire_stacks.dm
@@ -152,12 +152,12 @@
/// If we're on fire
var/on_fire = FALSE
- /// A weakref to the mob light emitter
- var/datum/weakref/firelight_ref
- /// Type of mob light emitter we use when on fire
- var/firelight_type = /obj/effect/dummy/lighting_obj/moblight/fire
/// Stores current fire overlay icon state, for optimisation purposes
var/last_icon_state
+ /// Reference to the mob light emitter itself
+ var/obj/effect/dummy/lighting_obj/moblight
+ /// Type of mob light emitter we use when on fire
+ var/moblight_type = /obj/effect/dummy/lighting_obj/moblight/fire
/datum/status_effect/fire_handler/fire_stacks/tick(seconds_per_tick, times_fired)
if(stacks <= 0)
@@ -249,8 +249,10 @@
if(!silent)
owner.visible_message(span_warning("[owner] catches fire!"), span_userdanger("You're set on fire!"))
- if(firelight_type)
- firelight_ref = WEAKREF(new firelight_type(owner))
+ if(moblight_type)
+ if(moblight)
+ qdel(moblight)
+ moblight = new moblight_type(owner)
SEND_SIGNAL(owner, COMSIG_LIVING_IGNITED, owner)
cache_stacks()
@@ -263,9 +265,7 @@
*/
/datum/status_effect/fire_handler/fire_stacks/proc/extinguish()
- if(firelight_ref)
- qdel(firelight_ref)
-
+ QDEL_NULL(moblight)
on_fire = FALSE
owner.clear_mood_event("on_fire")
SEND_SIGNAL(owner, COMSIG_LIVING_EXTINGUISHED, owner)
@@ -290,6 +290,11 @@
. = ..()
update_overlay()
+/obj/effect/dummy/lighting_obj/moblight/fire
+ name = "fire"
+ light_color = LIGHT_COLOR_FIRE
+ light_range = LIGHT_RANGE_FIRE
+
/datum/status_effect/fire_handler/wet_stacks
id = "wet_stacks"
diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm
index c50b54687c9..377c8470480 100644
--- a/code/game/objects/effects/effects.dm
+++ b/code/game/objects/effects/effects.dm
@@ -55,7 +55,7 @@
/obj/effect/abstract/singularity_act()
return
-/obj/effect/abstract/has_gravity(turf/T)
+/obj/effect/abstract/has_gravity(turf/gravity_turf)
return FALSE
/obj/effect/dummy/singularity_pull()
diff --git a/code/game/objects/effects/lighting.dm b/code/game/objects/effects/lighting.dm
new file mode 100644
index 00000000000..4e95e72f429
--- /dev/null
+++ b/code/game/objects/effects/lighting.dm
@@ -0,0 +1,42 @@
+/**
+ * Basically, a fake object that emits light.
+ *
+ * Why is this used sometimes instead of giving atoms light values directly?
+ * Because using these, you can have multiple light sources in a single object.
+ */
+/obj/effect/dummy/lighting_obj
+ name = "lighting"
+ desc = "Tell a coder if you're seeing this."
+ icon_state = "nothing"
+ light_system = MOVABLE_LIGHT
+ light_range = MINIMUM_USEFUL_LIGHT_RANGE
+ light_color = COLOR_WHITE
+ blocks_emissive = EMISSIVE_BLOCK_NONE
+ mouse_opacity = MOUSE_OPACITY_TRANSPARENT
+
+/obj/effect/dummy/lighting_obj/Initialize(mapload, range, power, color, duration)
+ . = ..()
+ if(!isnull(range))
+ set_light_range(range)
+ if(!isnull(power))
+ set_light_power(power)
+ if(!isnull(color))
+ set_light_color(color)
+ if(duration)
+ QDEL_IN(src, duration)
+
+/obj/effect/dummy/lighting_obj/moblight
+ name = "mob lighting"
+
+/obj/effect/dummy/lighting_obj/moblight/Initialize(mapload, range, power, color, duration)
+ . = ..()
+ if(!ismob(loc))
+ return INITIALIZE_HINT_QDEL
+
+/obj/effect/dummy/lighting_obj/moblight/fire
+ name = "mob fire lighting"
+ light_color = LIGHT_COLOR_FIRE
+ light_range = LIGHT_RANGE_FIRE
+
+/obj/effect/dummy/lighting_obj/moblight/species
+ name = "species lighting"
diff --git a/code/game/objects/effects/misc.dm b/code/game/objects/effects/misc.dm
index 4b801a61daf..5a23ff32b09 100644
--- a/code/game/objects/effects/misc.dm
+++ b/code/game/objects/effects/misc.dm
@@ -78,33 +78,3 @@
/obj/effect/abstract/marker/intercom
name = "intercom range marker"
color = COLOR_YELLOW
-
-/obj/effect/dummy/lighting_obj
- name = "lighting fx obj"
- desc = "Tell a coder if you're seeing this."
- icon_state = "nothing"
- light_system = MOVABLE_LIGHT
- light_range = MINIMUM_USEFUL_LIGHT_RANGE
- light_color = COLOR_WHITE
- mouse_opacity = MOUSE_OPACITY_TRANSPARENT
- blocks_emissive = EMISSIVE_BLOCK_NONE
-
-/obj/effect/dummy/lighting_obj/Initialize(mapload, _range, _power, _color, _duration)
- . = ..()
- if(!isnull(_range))
- set_light_range(_range)
- if(!isnull(_power))
- set_light_power(_power)
- if(!isnull(_color))
- set_light_color(_color)
- if(_duration)
- QDEL_IN(src, _duration)
-
-/obj/effect/dummy/lighting_obj/moblight
- name = "mob lighting fx"
-
-/obj/effect/dummy/lighting_obj/moblight/Initialize(mapload, _color, _range, _power, _duration)
- . = ..()
- if(!ismob(loc))
- return INITIALIZE_HINT_QDEL
-
diff --git a/code/modules/antagonists/cult/blood_magic.dm b/code/modules/antagonists/cult/blood_magic.dm
index be3fed1803c..30c3b278dbb 100644
--- a/code/modules/antagonists/cult/blood_magic.dm
+++ b/code/modules/antagonists/cult/blood_magic.dm
@@ -407,9 +407,7 @@
if(IS_CULTIST(user))
user.visible_message(span_warning("[user] holds up [user.p_their()] hand, which explodes in a flash of red light!"), \
span_cultitalic("You attempt to stun [target] with the spell!"))
-
- user.mob_light(_range = 3, _color = LIGHT_COLOR_BLOOD_MAGIC, _duration = 0.2 SECONDS)
-
+ user.mob_light(range = 3, color = LIGHT_COLOR_BLOOD_MAGIC, duration = 0.2 SECONDS)
if(IS_HERETIC(target))
to_chat(user, span_warning("Some force greater than you intervenes! [target] is protected by the Forgotten Gods!"))
to_chat(target, span_warning("You are protected by your faith to the Forgotten Gods."))
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index 9b7602877a9..4145ae7fa76 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -310,9 +310,4 @@
/obj/effect/hotspot/singularity_pull()
return
-/obj/effect/dummy/lighting_obj/moblight/fire
- name = "fire"
- light_color = LIGHT_COLOR_FIRE
- light_range = LIGHT_RANGE_FIRE
-
#undef INSUFFICIENT
diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm
index 989a5ac4ac9..ecaf7dec57f 100644
--- a/code/modules/lighting/lighting_atom.dm
+++ b/code/modules/lighting/lighting_atom.dm
@@ -42,7 +42,6 @@
else
light = new/datum/light_source(src, .)
-
/**
* Updates the atom's opacity value.
*
@@ -56,7 +55,6 @@
. = opacity
opacity = new_opacity
-
/atom/movable/set_opacity(new_opacity)
. = ..()
if(isnull(.) || !isturf(loc))
@@ -67,35 +65,23 @@
else
RemoveElement(/datum/element/light_blocking)
-
/turf/set_opacity(new_opacity)
. = ..()
if(isnull(.))
return
recalculate_directional_opacity()
-/atom/proc/flash_lighting_fx(_range = FLASH_LIGHT_RANGE, _power = FLASH_LIGHT_POWER, _color = COLOR_WHITE, _duration = FLASH_LIGHT_DURATION)
- return
+/atom/proc/flash_lighting_fx(range = FLASH_LIGHT_RANGE, power = FLASH_LIGHT_POWER, color = COLOR_WHITE, duration = FLASH_LIGHT_DURATION, light_type = /obj/effect/dummy/lighting_obj)
+ if(!duration)
+ stack_trace("Lighting FX obj created on \[[type]\] without a duration")
+ var/obj/effect/dummy/light_obj = new light_type(get_turf(src), range, power, color, duration)
+ return light_obj
+/mob/living/flash_lighting_fx(range = FLASH_LIGHT_RANGE, power = FLASH_LIGHT_POWER, color = COLOR_WHITE, duration = FLASH_LIGHT_DURATION, light_type = /obj/effect/dummy/lighting_obj/moblight)
+ return mob_light(range, power, color, duration)
-/turf/flash_lighting_fx(_range = FLASH_LIGHT_RANGE, _power = FLASH_LIGHT_POWER, _color = COLOR_WHITE, _duration = FLASH_LIGHT_DURATION)
- if(!_duration)
- stack_trace("Lighting FX obj created on a turf without a duration")
- new /obj/effect/dummy/lighting_obj (src, _range, _power, _color, _duration)
-
-
-/obj/flash_lighting_fx(_range = FLASH_LIGHT_RANGE, _power = FLASH_LIGHT_POWER, _color = COLOR_WHITE, _duration = FLASH_LIGHT_DURATION)
- if(!_duration)
- stack_trace("Lighting FX obj created on a obj without a duration")
- new /obj/effect/dummy/lighting_obj (get_turf(src), _range, _power, _color, _duration)
-
-
-/mob/living/flash_lighting_fx(_range = FLASH_LIGHT_RANGE, _power = FLASH_LIGHT_POWER, _color = COLOR_WHITE, _duration = FLASH_LIGHT_DURATION)
- mob_light(_range, _power, _color, _duration)
-
-
-/mob/living/proc/mob_light(_range, _power, _color, _duration)
- var/obj/effect/dummy/lighting_obj/moblight/mob_light_obj = new (src, _range, _power, _color, _duration)
+/mob/living/proc/mob_light(range, power, color, duration, light_type = /obj/effect/dummy/lighting_obj/moblight)
+ var/obj/effect/dummy/lighting_obj/moblight/mob_light_obj = new light_type(src, range, power, color, duration)
return mob_light_obj
/// Setter for the light power of this atom.
diff --git a/code/modules/mob/living/carbon/human/species_types/ethereal.dm b/code/modules/mob/living/carbon/human/species_types/ethereal.dm
index da9e9884d9d..bd03f4fc940 100644
--- a/code/modules/mob/living/carbon/human/species_types/ethereal.dm
+++ b/code/modules/mob/living/carbon/human/species_types/ethereal.dm
@@ -61,14 +61,10 @@
var/obj/effect/dummy/lighting_obj/ethereal_light
var/default_color
-
-
/datum/species/ethereal/Destroy(force)
- if(ethereal_light)
- QDEL_NULL(ethereal_light)
+ QDEL_NULL(ethereal_light)
return ..()
-
/datum/species/ethereal/on_species_gain(mob/living/carbon/new_ethereal, datum/species/old_species, pref_load)
. = ..()
if(!ishuman(new_ethereal))
@@ -81,7 +77,7 @@
RegisterSignal(ethereal, COMSIG_ATOM_EMAG_ACT, PROC_REF(on_emag_act))
RegisterSignal(ethereal, COMSIG_ATOM_EMP_ACT, PROC_REF(on_emp_act))
RegisterSignal(ethereal, COMSIG_LIGHT_EATER_ACT, PROC_REF(on_light_eater))
- ethereal_light = ethereal.mob_light()
+ ethereal_light = ethereal.mob_light(light_type = /obj/effect/dummy/lighting_obj/moblight/species)
spec_updatehealth(ethereal)
new_ethereal.set_safe_hunger_level()
update_mail_goodies(ethereal)
diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
index db353a21908..e68bbe0d7fa 100644
--- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
+++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm
@@ -497,7 +497,7 @@
/// How strong is our glow
var/glow_intensity = LUMINESCENT_DEFAULT_GLOW
/// Internal dummy used to glow (very cool)
- var/obj/effect/dummy/luminescent_glow/glow
+ var/obj/effect/dummy/lighting_obj/moblight/glow
/// The slime extract we currently have integrated
var/obj/item/slime_extract/current_extract
/// A list of all luminescent related actions we have
@@ -505,25 +505,16 @@
/// The cooldown of us using exteracts
COOLDOWN_DECLARE(extract_cooldown)
-//Species datums don't normally implement destroy, but JELLIES SUCK ASS OUT OF A STEEL STRAW
-/datum/species/jelly/luminescent/Destroy(force, ...)
+//Species datums don't normally implement destroy, but JELLIES SUCK ASS OUT OF A STEEL STRAW and have to i guess
+/datum/species/jelly/luminescent/Destroy(force)
current_extract = null
QDEL_NULL(glow)
QDEL_LIST(luminescent_actions)
return ..()
-
-/datum/species/jelly/luminescent/on_species_loss(mob/living/carbon/C)
- . = ..()
- if(current_extract)
- current_extract.forceMove(C.drop_location())
- current_extract = null
- QDEL_NULL(glow)
- QDEL_LIST(luminescent_actions)
-
/datum/species/jelly/luminescent/on_species_gain(mob/living/carbon/new_jellyperson, datum/species/old_species)
. = ..()
- glow = new(new_jellyperson)
+ glow = new_jellyperson.mob_light(light_type = /obj/effect/dummy/lighting_obj/moblight/species)
update_glow(new_jellyperson)
luminescent_actions = list()
@@ -540,26 +531,19 @@
extract_major.Grant(new_jellyperson)
luminescent_actions += integrate_extract
-/// Updates the glow of our internal glow thing.
-/datum/species/jelly/luminescent/proc/update_glow(mob/living/carbon/C, intensity)
+/datum/species/jelly/luminescent/on_species_loss(mob/living/carbon/C)
+ . = ..()
+ if(current_extract)
+ current_extract.forceMove(C.drop_location())
+ current_extract = null
+ QDEL_NULL(glow)
+ QDEL_LIST(luminescent_actions)
+
+/// Updates the glow of our internal glow object
+/datum/species/jelly/luminescent/proc/update_glow(mob/living/carbon/human/glowie, intensity)
if(intensity)
glow_intensity = intensity
- glow.set_light_range_power_color(glow_intensity, glow_intensity, C.dna.features["mcolor"])
-
-/obj/effect/dummy/luminescent_glow
- name = "luminescent glow"
- desc = "Tell a coder if you're seeing this."
- icon_state = "nothing"
- light_system = MOVABLE_LIGHT
- light_range = LUMINESCENT_DEFAULT_GLOW
- light_power = 2.5
- light_color = COLOR_WHITE
-
-/obj/effect/dummy/luminescent_glow/Initialize(mapload)
- . = ..()
- if(!isliving(loc))
- return INITIALIZE_HINT_QDEL
-
+ glow.set_light_range_power_color(glow_intensity, glow_intensity, glowie.dna.features["mcolor"])
/datum/action/innate/integrate_extract
name = "Integrate Extract"
diff --git a/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm b/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm
index 9533e407a09..6b87eb03ffd 100644
--- a/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm
+++ b/code/modules/mob/living/simple_animal/hostile/heretic_monsters.dm
@@ -222,7 +222,7 @@
return ..()
// We are literally a vessel of otherworldly destruction, we bring our own gravity unto this plane
-/mob/living/simple_animal/hostile/heretic_summon/armsy/has_gravity(turf/T)
+/mob/living/simple_animal/hostile/heretic_summon/armsy/has_gravity(turf/gravity_turf)
return TRUE
/mob/living/simple_animal/hostile/heretic_summon/armsy/can_be_pulled()
diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm
index 189b63e8566..69e835086f8 100644
--- a/code/modules/mob/mob_movement.dm
+++ b/code/modules/mob/mob_movement.dm
@@ -352,7 +352,7 @@
continue
return rebound
-/mob/has_gravity()
+/mob/has_gravity(turf/gravity_turf)
return mob_negates_gravity() || ..()
/**
diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm
index 4894c3d4faf..43edd3296b4 100644
--- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm
+++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm
@@ -294,7 +294,7 @@
var/range = created_volume/3
if(isatom(holder.my_atom))
var/atom/A = holder.my_atom
- A.flash_lighting_fx(_range = (range + 2))
+ A.flash_lighting_fx(range = (range + 2))
for(var/mob/living/C in get_hearers_in_view(range, location))
if(C.flash_act(affect_silicon = TRUE))
if(get_dist(C, location) < 4)
@@ -314,7 +314,7 @@
var/range = created_volume/10
if(isatom(holder.my_atom))
var/atom/A = holder.my_atom
- A.flash_lighting_fx(_range = (range + 2))
+ A.flash_lighting_fx(range = (range + 2))
for(var/mob/living/C in get_hearers_in_view(range, location))
if(C.flash_act(affect_silicon = TRUE))
if(get_dist(C, location) < 4)
diff --git a/modular_skyrat/modules/clock_cult/code/scriptures/servitude/kindle.dm b/modular_skyrat/modules/clock_cult/code/scriptures/servitude/kindle.dm
index f718c0ad622..b97923d3b9d 100644
--- a/modular_skyrat/modules/clock_cult/code/scriptures/servitude/kindle.dm
+++ b/modular_skyrat/modules/clock_cult/code/scriptures/servitude/kindle.dm
@@ -30,7 +30,7 @@
// Chaplains are understandably 100% immune
if(hit_mob.can_block_magic(MAGIC_RESISTANCE_HOLY))
- hit_mob.mob_light(_color = LIGHT_COLOR_HOLY_MAGIC, _range = 2, _duration = 10 SECONDS)
+ hit_mob.mob_light(color = LIGHT_COLOR_HOLY_MAGIC, range = 2, duration = 10 SECONDS)
var/mutable_appearance/forbearance = mutable_appearance('icons/effects/genetics.dmi', "servitude", -MUTATIONS_LAYER)
hit_mob.add_overlay(forbearance)
@@ -44,7 +44,7 @@
//To make battles more fun, both sides can't bullshit stun hand the other
if(IS_CULTIST(hit_mob))
- hit_mob.mob_light(_color = LIGHT_COLOR_BLOOD_MAGIC, _range = 2, _duration = 30 SECONDS)
+ hit_mob.mob_light(color = LIGHT_COLOR_BLOOD_MAGIC, range = 2, duration = 30 SECONDS)
hit_mob.adjust_stutter(15 SECONDS)
hit_mob.adjust_jitter(15 SECONDS)
@@ -62,7 +62,7 @@
return TRUE
//Successful Invokation
- invoker.mob_light(_color = LIGHT_COLOR_CLOCKWORK, _range = 2, _duration = 1 SECONDS)
+ invoker.mob_light(color = LIGHT_COLOR_CLOCKWORK, range = 2, duration = 1 SECONDS)
if(issilicon(hit_mob))
var/mob/living/silicon/borgo = hit_mob
diff --git a/tgstation.dme b/tgstation.dme
index b3337fe192c..b817a4356c3 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -1807,6 +1807,7 @@
#include "code\game\objects\effects\glowshroom.dm"
#include "code\game\objects\effects\info.dm"
#include "code\game\objects\effects\landmarks.dm"
+#include "code\game\objects\effects\lighting.dm"
#include "code\game\objects\effects\mines.dm"
#include "code\game\objects\effects\misc.dm"
#include "code\game\objects\effects\overlays.dm"