mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 09:54:52 +00:00
Makes the chemical smoke machine use stock parts for things
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
#define REAGENTS_BASE_VOLUME 100 // actual volume is REAGENTS_BASE_VOLUME plus REAGENTS_BASE_VOLUME * rating for each matterbin
|
||||
|
||||
/obj/machinery/smoke_machine
|
||||
name = "smoke machine"
|
||||
desc = "A machine with a centrifuge installed into it. It produces smoke with any reagents you put into the machine."
|
||||
@@ -11,14 +13,13 @@
|
||||
var/cooldown = 0
|
||||
var/screen = "home"
|
||||
var/useramount = 30 // Last used amount
|
||||
var/volume = 300
|
||||
var/setting = 3
|
||||
var/list/possible_settings = list(3,6,9)
|
||||
var/setting = 1 // displayed range is 3 * setting
|
||||
var/max_range = 3 // displayed max range is 3 * max range
|
||||
|
||||
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting = 3, efficiency = 10, loc)
|
||||
amount = setting
|
||||
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting=1, efficiency=10, loc)
|
||||
amount = setting * 3
|
||||
carry.copy_to(chemholder, 20)
|
||||
carry.remove_any(setting * 16 / efficiency)
|
||||
carry.remove_any(amount * 16 / efficiency)
|
||||
location = loc
|
||||
|
||||
/datum/effect_system/smoke_spread/chem/smoke_machine
|
||||
@@ -28,10 +29,11 @@
|
||||
opaque = FALSE
|
||||
alpha = 100
|
||||
|
||||
|
||||
/obj/machinery/smoke_machine/Initialize()
|
||||
. = ..()
|
||||
create_reagents(volume)
|
||||
create_reagents(REAGENTS_BASE_VOLUME)
|
||||
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
|
||||
reagents.maximum_volume += REAGENTS_BASE_VOLUME * B.rating
|
||||
|
||||
/obj/machinery/smoke_machine/update_icon()
|
||||
if((!is_operational()) || (!on) || (reagents.total_volume == 0))
|
||||
@@ -41,13 +43,20 @@
|
||||
. = ..()
|
||||
|
||||
/obj/machinery/smoke_machine/RefreshParts()
|
||||
efficiency = 6
|
||||
var/new_volume = REAGENTS_BASE_VOLUME
|
||||
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
|
||||
efficiency += B.rating
|
||||
new_volume += REAGENTS_BASE_VOLUME * B.rating
|
||||
reagents.maximum_volume = new_volume
|
||||
if(new_volume < reagents.total_volume)
|
||||
reagents.reaction(loc, TOUCH) // if someone manages to downgrade it without deconstructing
|
||||
reagents.clear_reagents()
|
||||
efficiency = 9
|
||||
for(var/obj/item/stock_parts/capacitor/C in component_parts)
|
||||
efficiency += C.rating
|
||||
max_range = 1
|
||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||
efficiency += M.rating
|
||||
max_range += M.rating
|
||||
max_range = max(3, max_range)
|
||||
|
||||
/obj/machinery/smoke_machine/process()
|
||||
..()
|
||||
@@ -78,6 +87,11 @@
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/smoke_machine/deconstruct()
|
||||
reagents.reaction(loc, TOUCH)
|
||||
reagents.clear_reagents()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/smoke_machine/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
@@ -99,6 +113,7 @@
|
||||
data["active"] = on
|
||||
data["setting"] = setting
|
||||
data["screen"] = screen
|
||||
data["maxSetting"] = max_range
|
||||
return data
|
||||
|
||||
/obj/machinery/smoke_machine/ui_act(action, params)
|
||||
@@ -110,7 +125,7 @@
|
||||
. = TRUE
|
||||
if("setting")
|
||||
var/amount = text2num(params["amount"])
|
||||
if (locate(amount) in possible_settings)
|
||||
if(amount in 1 to max_range)
|
||||
setting = amount
|
||||
. = TRUE
|
||||
if("power")
|
||||
@@ -122,3 +137,5 @@
|
||||
if("goScreen")
|
||||
screen = params["screen"]
|
||||
. = TRUE
|
||||
|
||||
#undef REAGENTS_BASE_VOLUME
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
{{#if data.screen == "home"}}
|
||||
<ui-display title='Dispersal Tank'>
|
||||
<ui-section label='Power'>
|
||||
<ui-button icon='{{data.active ? "power-off" : "close"}}'
|
||||
style='{{data.active ? "selected" : null}}'
|
||||
state='{{data.isTankLoaded ? null : "disabled"}}'
|
||||
action='power'>{{data.active ? "On" : "Off"}}
|
||||
</ui-button>
|
||||
</ui-section>
|
||||
<ui-section label='Smoke Radius Setting'>
|
||||
<div class='content' style='float:left'>
|
||||
<ui-button icon='plus' state='{{data.setting == 3 ? "selected" : null}}' action='setting' params='{"amount": 3}'>3</ui-button>
|
||||
<ui-button icon='plus' state='{{data.setting == 6 ? "selected" : null}}' action='setting' params='{"amount": 6}'>6</ui-button>
|
||||
<ui-button icon='plus' state='{{data.setting == 9 ? "selected" : null}}' action='setting' params='{"amount": 9}'>9</ui-button>
|
||||
<ui-button icon='plus' state='{{data.setting == 12 ? "selected" : null}}' action='setting' params='{"amount": 12}'>12</ui-button>
|
||||
<ui-button icon='plus' state='{{data.setting == 15 ? "selected" : null}}' action='setting' params='{"amount": 15}'>15</ui-button>
|
||||
</div>
|
||||
</ui-section>
|
||||
<ui-section label='Contents'>
|
||||
{{#if data.isTankLoaded}}
|
||||
<span>{{Math.round(adata.TankCurrentVolume)}}/{{data.TankMaxVolume}} Units</span>
|
||||
<br/>
|
||||
<ui-section label='Power'>
|
||||
<ui-button icon='{{data.active ? "power-off" : "close"}}'
|
||||
style='{{data.active ? "selected" : null}}'
|
||||
state='{{data.isTankLoaded ? null : "disabled"}}'
|
||||
action='power'>{{data.active ? "On" : "Off"}}
|
||||
</ui-button>
|
||||
</ui-section>
|
||||
<ui-section label='Smoke Radius Setting'>
|
||||
<div class='content' style='float:left'>
|
||||
<ui-button icon='plus' state='{{data.maxSetting >= 1 ? null : "disabled"}}' style='{{data.setting == 1 ? "selected" : null}}' action='setting' params='{"amount": 1}'>3</ui-button>
|
||||
<ui-button icon='plus' state='{{data.maxSetting >= 2 ? null : "disabled"}}' style='{{data.setting == 2 ? "selected" : null}}' action='setting' params='{"amount": 2}'>6</ui-button>
|
||||
<ui-button icon='plus' state='{{data.maxSetting >= 3 ? null : "disabled"}}' style='{{data.setting == 3 ? "selected" : null}}' action='setting' params='{"amount": 3}'>9</ui-button>
|
||||
<ui-button icon='plus' state='{{data.maxSetting >= 4 ? null : "disabled"}}' style='{{data.setting == 4 ? "selected" : null}}' action='setting' params='{"amount": 4}'>12</ui-button>
|
||||
<ui-button icon='plus' state='{{data.maxSetting >= 5 ? null : "disabled"}}' style='{{data.setting == 5 ? "selected" : null}}' action='setting' params='{"amount": 5}'>15</ui-button>
|
||||
</div>
|
||||
</ui-section>
|
||||
<ui-section label='Contents'>
|
||||
{{#if data.isTankLoaded}}
|
||||
<span>{{Math.round(adata.TankCurrentVolume)}}/{{data.TankMaxVolume}} Units</span>
|
||||
<br/>
|
||||
<br/>
|
||||
{{#each adata.TankContents}}
|
||||
<span class='highlight' intro-outro='fade'>{{Math.fixed(volume, 2)}} units of {{name}}</span><br/>
|
||||
{{/each}}
|
||||
{{#each adata.TankContents}}
|
||||
<span class='highlight' intro-outro='fade'>{{Math.fixed(volume, 2)}} units of {{name}}</span><br/>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<span class='bad'>Tank Empty</span>
|
||||
<span class='bad'>Tank Empty</span>
|
||||
{{/if}}
|
||||
<ui-button icon='{{data.isTankLoaded ? "Eject" : "Close"}}'
|
||||
style='{{data.isTankLoaded ? "selected" : null}}'
|
||||
|
||||
Reference in New Issue
Block a user