mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 09:08:30 +01:00
[MIRROR] Rigged to Blow: Lightbulb Rigging/Reagent Handling Overhaul [MDB IGNORE] (#16330)
* Rigged to Blow: Lightbulb Rigging/Reagent Handling Overhaul (#69833) About The Pull Request First and foremost, guts out the previous, arguably cursed "rigged" functionality from light tubes. Light tubes now have a capacity of 20 reagents. Light tubes will now splash their contents upon shattering, instead of just releasing plasma gas into the air (if rigged). Lightbulbs with reagents inside of them will now transfer with them to the light fixture they're inserted into, which will slowly heat the contents to a maximum of 1000 degrees. Heating the plasma reagent manually leads to it harmlessly boiling out of the container and dissipating, effectively ruining the original functionality. To account for plasma boiling over (when it should be bursting into flames) a SEALED_CONTAINER reagent container flag has been added. This is mostly just to prevent the plasma from leaving the container until it is ignition-ready. As a result, light tubes rigged the old way no longer harmlessly explode, and instead produce a small, (mostly) self-contained fire in the area surrounding the light. Light tubes (and light fixtures with reagents in their lightbulb) now show their reagent contents upon examine. It's only fair to reward attentive people with a chance to avoid impending disaster, but on the other hand lightbulbs are transparent and you should just be able to look through them anyways. As a bonus, all of this SHOULD be handled in a way that doesn't put any unnecessary strain on machine processing or anything. Rejoice. Why It's Good For The Game Lightbulbs being reagent holders was a huge missed opportunity, with their only use being for the disappointingly ineffective plasma-rigging functionality. This expands on the idea, and reworks the original functionality to be much more interactive. Bigger sandbox! Deeper sandbox! Changelog cl add: Rigging light fixtures now works with more reagents than just plasma. Light fixtures will heat the reagents of their inserted lightbulb, up to a maximum of 1000 degrees. Lightbulb tubes now hold 20 reagents to make this more usable. add: Lightbulbs will now splash their contents on whatever they're shattered by. Their contents are also now visible upon examination. * Rigged to Blow: Lightbulb Rigging/Reagent Handling Overhaul * fix modular Co-authored-by: Rhials <Datguy33456@gmail.com> Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#define LIGHT_POWER_GAIN 35
|
||||
|
||||
///How many reagents the lights can hold
|
||||
#define LIGHT_REAGENT_CAPACITY 5
|
||||
#define LIGHT_REAGENT_CAPACITY 20
|
||||
|
||||
//Status for light constructs
|
||||
#define LIGHT_CONSTRUCT_EMPTY 1
|
||||
@@ -9,13 +9,16 @@
|
||||
#define DRAINABLE (1<<3) // Makes it possible to remove reagents through any reagent container.
|
||||
#define DUNKABLE (1<<4) // Allows items to be dunked into this container for transfering reagents. Used in conjunction with the dunkable component.
|
||||
|
||||
#define TRANSPARENT (1<<5) // Used on containers which you want to be able to see the reagents off.
|
||||
#define TRANSPARENT (1<<5) // Used on containers which you want to be able to see the reagents of.
|
||||
#define AMOUNT_VISIBLE (1<<6) // For non-transparent containers that still have the general amount of reagents in them visible.
|
||||
#define NO_REACT (1<<7) // Applied to a reagent holder, the contents will not react with each other.
|
||||
#define REAGENT_HOLDER_INSTANT_REACT (1<<8) // Applied to a reagent holder, all of the reactions in the reagents datum will be instant. Meant to be used for things like smoke effects where reactions aren't meant to occur
|
||||
///If the holder is "alive" (i.e. mobs and organs) - If this flag is applied to a holder it will cause reagents to split upon addition to the object
|
||||
#define REAGENT_HOLDER_ALIVE (1<<9)
|
||||
|
||||
///If the holder a sealed container - Used if you don't want reagent contents boiling out (plasma, specifically, in which case it only bursts out when at ignition temperatures)
|
||||
#define SEALED_CONTAINER (1<<10)
|
||||
|
||||
// Is an open container for all intents and purposes.
|
||||
#define OPENCONTAINER (REFILLABLE | DRAINABLE | TRANSPARENT)
|
||||
|
||||
|
||||
@@ -20,22 +20,12 @@
|
||||
//
|
||||
// EMAGGED FEATURES
|
||||
//
|
||||
// NOTICE: The Cyborg cannot use the emagged Light Replacer and the light's explosion was nerfed. It cannot create holes in the station anymore.
|
||||
// I'm not sure everyone will react the emag's features so please say what your opinions are of it. (I'm pretty sure the players like it)
|
||||
//
|
||||
// I'm not sure everyone will react the emag's features so please say what your opinions are of it.
|
||||
//
|
||||
// When emagged it will rig every light it replaces, which will explode when the light is on.
|
||||
// When emagged it will rig every light it replaces with plasma, which will slowly heat up and ignite while the light is on.
|
||||
// This is VERY noticable, even the device's name changes when you emag it so if anyone
|
||||
// examines you when you're holding it in your hand, you will be discovered.
|
||||
// It will also be very obvious who is setting all these lights off, since only Janitor Borgs and Janitors have easy
|
||||
// access to them, and only one of them can emag their device.
|
||||
//
|
||||
// The explosion cannot insta-kill anyone with 30% or more health.
|
||||
|
||||
#define LIGHT_OK 0
|
||||
#define LIGHT_EMPTY 1
|
||||
#define LIGHT_BROKEN 2
|
||||
#define LIGHT_BURNED 3
|
||||
|
||||
|
||||
/obj/item/lightreplacer
|
||||
@@ -203,14 +193,13 @@
|
||||
|
||||
target.status = L2.status
|
||||
target.switchcount = L2.switchcount
|
||||
target.rigged = (obj_flags & EMAGGED ? 1 : 0)
|
||||
target.brightness = L2.brightness
|
||||
if(obj_flags & EMAGGED)
|
||||
target.create_reagents(LIGHT_REAGENT_CAPACITY, SEALED_CONTAINER | TRANSPARENT)
|
||||
target.reagents.add_reagent(/datum/reagent/toxin/plasma, 10)
|
||||
target.on = target.has_power()
|
||||
target.update()
|
||||
qdel(L2)
|
||||
|
||||
if(target.on && target.rigged)
|
||||
target.explode()
|
||||
return
|
||||
|
||||
else
|
||||
@@ -257,8 +246,3 @@
|
||||
/obj/item/lightreplacer/cyborg/Initialize(mapload)
|
||||
. = ..()
|
||||
ADD_TRAIT(src, TRAIT_NODROP, CYBORG_ITEM_TRAIT)
|
||||
|
||||
#undef LIGHT_OK
|
||||
#undef LIGHT_EMPTY
|
||||
#undef LIGHT_BROKEN
|
||||
#undef LIGHT_BURNED
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
var/fitting = "tube"
|
||||
///Count of number of times switched on/off, this is used to calculate the probability the light burns out
|
||||
var/switchcount = 0
|
||||
///True if rigged to explode
|
||||
var/rigged = FALSE
|
||||
///Cell reference
|
||||
var/obj/item/stock_parts/cell/cell
|
||||
///If true, this fixture generates a very weak cell at roundstart
|
||||
@@ -186,6 +184,8 @@
|
||||
var/color_set = bulb_colour
|
||||
if(color)
|
||||
color_set = color
|
||||
if(reagents)
|
||||
START_PROCESSING(SSmachines, src)
|
||||
var/area/local_area = get_area(src)
|
||||
if (local_area?.fire)
|
||||
color_set = bulb_low_power_colour
|
||||
@@ -200,10 +200,7 @@
|
||||
var/matching = light && brightness_set == light.light_range && power_set == light.light_power && color_set == light.light_color
|
||||
if(!matching)
|
||||
switchcount++
|
||||
if(rigged)
|
||||
if(status == LIGHT_OK && trigger)
|
||||
explode()
|
||||
else if( prob( min(60, (switchcount**2)*0.01) ) )
|
||||
if( prob( min(60, (switchcount**2)*0.01) ) )
|
||||
if(trigger)
|
||||
burn_out()
|
||||
else
|
||||
@@ -268,13 +265,15 @@
|
||||
var/delay = rand(BROKEN_SPARKS_MIN, BROKEN_SPARKS_MAX)
|
||||
addtimer(CALLBACK(src, .proc/broken_sparks), delay, TIMER_UNIQUE | TIMER_NO_HASH_WAIT)
|
||||
|
||||
/obj/machinery/light/process()
|
||||
if (!cell)
|
||||
return PROCESS_KILL
|
||||
if(has_power())
|
||||
if (cell.charge == cell.maxcharge)
|
||||
return PROCESS_KILL
|
||||
cell.charge = min(cell.maxcharge, cell.charge + LIGHT_EMERGENCY_POWER_USE) //Recharge emergency power automatically while not using it
|
||||
/obj/machinery/light/process(delta_time)
|
||||
if(has_power()) //If the light is being powered by the station.
|
||||
if(cell)
|
||||
if(cell.charge == cell.maxcharge && !reagents) //If the cell is done mooching station power, and reagents don't need processing, stop processing
|
||||
return PROCESS_KILL
|
||||
cell.charge = min(cell.maxcharge, cell.charge + LIGHT_EMERGENCY_POWER_USE) //Recharge emergency power automatically while not using it
|
||||
if(reagents) //with most reagents coming out at 300, and with most meaningful reactions coming at 370+, this rate gives a few seconds of time to place it in and get out of dodge regardless of input.
|
||||
reagents.adjust_thermal_energy(8 * reagents.total_volume * SPECIFIC_HEAT_DEFAULT * delta_time)
|
||||
reagents.handle_reactions()
|
||||
if(low_power_mode && !use_emergency_power(LIGHT_EMERGENCY_POWER_USE))
|
||||
update(FALSE) //Disables emergency mode and sets the color to normal
|
||||
|
||||
@@ -344,17 +343,17 @@
|
||||
to_chat(user, span_notice("You replace [light_object]."))
|
||||
else
|
||||
to_chat(user, span_notice("You insert [light_object]."))
|
||||
if(length(light_object.reagents.reagent_list))
|
||||
create_reagents(LIGHT_REAGENT_CAPACITY, SEALED_CONTAINER | TRANSPARENT)
|
||||
light_object.reagents.trans_to(reagents, LIGHT_REAGENT_CAPACITY)
|
||||
status = light_object.status
|
||||
switchcount = light_object.switchcount
|
||||
rigged = light_object.rigged
|
||||
brightness = light_object.brightness
|
||||
on = has_power()
|
||||
update()
|
||||
|
||||
qdel(light_object)
|
||||
|
||||
if(on && rigged)
|
||||
explode()
|
||||
return
|
||||
|
||||
// attempt to stick weapon into light socket
|
||||
@@ -577,8 +576,10 @@
|
||||
|
||||
/obj/machinery/light/proc/drop_light_tube(mob/user)
|
||||
var/obj/item/light/light_object = new light_type()
|
||||
if(reagents)
|
||||
reagents.trans_to(light_object.reagents, LIGHT_REAGENT_CAPACITY)
|
||||
QDEL_NULL(reagents)
|
||||
light_object.status = status
|
||||
light_object.rigged = rigged
|
||||
light_object.brightness = brightness
|
||||
|
||||
// light item inherits the switchcount, then zero it
|
||||
@@ -650,16 +651,6 @@
|
||||
if(prob(max(0, exposed_temperature - 673))) //0% at <400C, 100% at >500C
|
||||
break_light_tube()
|
||||
|
||||
// explode the light
|
||||
|
||||
/obj/machinery/light/proc/explode()
|
||||
set waitfor = 0
|
||||
break_light_tube() // break it first to give a warning
|
||||
sleep(2)
|
||||
explosion(src, light_impact_range = 2, flash_range = -1)
|
||||
sleep(1)
|
||||
qdel(src)
|
||||
|
||||
/obj/machinery/light/proc/on_light_eater(obj/machinery/light/source, datum/light_eater)
|
||||
SIGNAL_HANDLER
|
||||
. = COMPONENT_BLOCK_LIGHT_EATER
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
custom_materials = list(/datum/material/glass=100)
|
||||
grind_results = list(/datum/reagent/silicon = 5, /datum/reagent/nitrogen = 10) //Nitrogen is used as a cheaper alternative to argon in incandescent lighbulbs
|
||||
///True if rigged to explode
|
||||
var/rigged = FALSE
|
||||
///How much light it gives off
|
||||
var/brightness = 2
|
||||
///LIGHT_OK, LIGHT_BURNED or LIGHT_BROKEN
|
||||
@@ -75,7 +73,7 @@
|
||||
|
||||
/obj/item/light/Initialize(mapload)
|
||||
. = ..()
|
||||
create_reagents(LIGHT_REAGENT_CAPACITY, INJECTABLE | DRAINABLE)
|
||||
create_reagents(LIGHT_REAGENT_CAPACITY, INJECTABLE | DRAINABLE | SEALED_CONTAINER | TRANSPARENT)
|
||||
AddComponent(/datum/component/caltrop, min_damage = force)
|
||||
update()
|
||||
var/static/list/loc_connections = list(
|
||||
@@ -91,49 +89,23 @@
|
||||
if(!(moving_mob.movement_type & (FLYING|FLOATING)) || moving_mob.buckled)
|
||||
playsound(src, 'sound/effects/glass_step.ogg', HAS_TRAIT(moving_mob, TRAIT_LIGHT_STEP) ? 30 : 50, TRUE)
|
||||
if(status == LIGHT_BURNED || status == LIGHT_OK)
|
||||
shatter()
|
||||
|
||||
/obj/item/light/create_reagents(max_vol, flags)
|
||||
. = ..()
|
||||
RegisterSignal(reagents, list(COMSIG_REAGENTS_NEW_REAGENT, COMSIG_REAGENTS_ADD_REAGENT, COMSIG_REAGENTS_DEL_REAGENT, COMSIG_REAGENTS_REM_REAGENT), .proc/on_reagent_change)
|
||||
RegisterSignal(reagents, COMSIG_PARENT_QDELETING, .proc/on_reagents_del)
|
||||
|
||||
/**
|
||||
* Handles rigging the cell if it contains enough plasma.
|
||||
*/
|
||||
/obj/item/light/proc/on_reagent_change(datum/reagents/holder, ...)
|
||||
SIGNAL_HANDLER
|
||||
rigged = (reagents.has_reagent(/datum/reagent/toxin/plasma, LIGHT_REAGENT_CAPACITY)) ? TRUE : FALSE //has_reagent returns the reagent datum, we don't want to hold a reference to prevent hard dels
|
||||
return NONE
|
||||
|
||||
/**
|
||||
* Handles the reagent holder datum being deleted for some reason. Probably someone making pizza lights.
|
||||
*/
|
||||
/obj/item/light/proc/on_reagents_del(datum/reagents/holder)
|
||||
SIGNAL_HANDLER
|
||||
UnregisterSignal(holder, list(
|
||||
COMSIG_PARENT_QDELETING,
|
||||
COMSIG_REAGENTS_NEW_REAGENT,
|
||||
COMSIG_REAGENTS_ADD_REAGENT,
|
||||
COMSIG_REAGENTS_REM_REAGENT,
|
||||
COMSIG_REAGENTS_DEL_REAGENT,
|
||||
))
|
||||
return NONE
|
||||
shatter(moving_mob)
|
||||
|
||||
/obj/item/light/attack(mob/living/M, mob/living/user, def_zone)
|
||||
..()
|
||||
shatter()
|
||||
shatter(M)
|
||||
|
||||
/obj/item/light/attack_atom(obj/O, mob/living/user, params)
|
||||
..()
|
||||
shatter()
|
||||
shatter(O)
|
||||
|
||||
/obj/item/light/proc/shatter()
|
||||
/obj/item/light/proc/shatter(target)
|
||||
if(status == LIGHT_OK || status == LIGHT_BURNED)
|
||||
visible_message(span_danger("[src] shatters."),span_hear("You hear a small glass object shatter."))
|
||||
status = LIGHT_BROKEN
|
||||
force = 5
|
||||
playsound(src.loc, 'sound/effects/glasshit.ogg', 75, TRUE)
|
||||
if(rigged)
|
||||
atmos_spawn_air("plasma=5") //5u of plasma are required to rig a light bulb/tube
|
||||
playsound(loc, 'sound/effects/glasshit.ogg', 75, TRUE)
|
||||
if(length(reagents.reagent_list))
|
||||
visible_message(span_danger("The contents of [src] splash onto you as you step on it!"),span_hear("You feel the contents of [src] splash onto you as you step on it!."))
|
||||
reagents.expose(target, TOUCH)
|
||||
update()
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
mytray.adjust_toxic(3) //It is still toxic, mind you, but not to the same degree.
|
||||
|
||||
#define LIQUID_PLASMA_BP (50+T0C)
|
||||
#define LIQUID_PLASMA_IG (325+T0C)
|
||||
|
||||
/datum/reagent/toxin/plasma
|
||||
name = "Plasma"
|
||||
@@ -110,7 +111,8 @@
|
||||
return
|
||||
if(!holder.my_atom)
|
||||
return
|
||||
|
||||
if((holder.flags & SEALED_CONTAINER) && (holder.chem_temp < LIQUID_PLASMA_IG))
|
||||
return
|
||||
var/atom/A = holder.my_atom
|
||||
A.atmos_spawn_air("plasma=[volume];TEMP=[holder.chem_temp]")
|
||||
holder.del_reagent(type)
|
||||
|
||||
@@ -29,10 +29,7 @@
|
||||
var/matching = light && BR == light.light_range && PO == light.light_power && CO == light.light_color
|
||||
if(!matching)
|
||||
switchcount++
|
||||
if(rigged)
|
||||
if(status == LIGHT_OK && trigger)
|
||||
explode()
|
||||
else if( prob( min(60, (switchcount**2)*0.01) ) )
|
||||
if( prob( min(60, (switchcount**2)*0.01) ) )
|
||||
if(trigger)
|
||||
burn_out()
|
||||
else
|
||||
|
||||
+1
-1
@@ -103,6 +103,7 @@
|
||||
#include "code\__DEFINES\language.dm"
|
||||
#include "code\__DEFINES\layers.dm"
|
||||
#include "code\__DEFINES\lighting.dm"
|
||||
#include "code\__DEFINES\lights.dm"
|
||||
#include "code\__DEFINES\living.dm"
|
||||
#include "code\__DEFINES\logging.dm"
|
||||
#include "code\__DEFINES\loot.dm"
|
||||
@@ -4035,7 +4036,6 @@
|
||||
#include "code\modules\power\apc\apc_mapping.dm"
|
||||
#include "code\modules\power\apc\apc_power_proc.dm"
|
||||
#include "code\modules\power\apc\apc_tool_act.dm"
|
||||
#include "code\modules\power\lighting\_light_defines.dm"
|
||||
#include "code\modules\power\lighting\light.dm"
|
||||
#include "code\modules\power\lighting\light_construct.dm"
|
||||
#include "code\modules\power\lighting\light_items.dm"
|
||||
|
||||
Reference in New Issue
Block a user