mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 21:19:00 +01:00
[TGUI] Suit Storage Unit (#15590)
* ssu tgui * change wording on UI * Update tgui.bundle.js
This commit is contained in:
@@ -314,7 +314,7 @@
|
||||
if(state_open)
|
||||
if(store_item(I, user))
|
||||
update_icon()
|
||||
updateUsrDialog()
|
||||
SStgui.update_uis(src)
|
||||
to_chat(user, "<span class='notice'>You load the [I] into the storage compartment.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You can't fit [I] into [src]!</span>")
|
||||
@@ -366,6 +366,7 @@
|
||||
helmet = null
|
||||
suit = null
|
||||
mask = null
|
||||
boots = null
|
||||
storage = null
|
||||
occupant = null
|
||||
|
||||
@@ -409,8 +410,6 @@
|
||||
if(uv_cycles)
|
||||
uv_cycles--
|
||||
uv = TRUE
|
||||
locked = TRUE
|
||||
update_icon()
|
||||
if(occupant)
|
||||
var/mob/living/mob_occupant = occupant
|
||||
if(uv_super)
|
||||
@@ -422,7 +421,6 @@
|
||||
else
|
||||
uv_cycles = initial(uv_cycles)
|
||||
uv = FALSE
|
||||
locked = FALSE
|
||||
for(var/atom/A in contents)
|
||||
A.clean_blood(radiation_clean = FALSE) // we invoke the radiation cleaning proc directly
|
||||
A.clean_radiation(12) // instead of letting clean_blood do it
|
||||
@@ -451,9 +449,10 @@
|
||||
else
|
||||
visible_message("<span class='warning'>[src]'s door slides open, barraging you with the nauseating smell of charred flesh.</span>")
|
||||
playsound(src, 'sound/machines/airlock_close.ogg', 25, 1)
|
||||
open_machine(FALSE)
|
||||
if(occupant)
|
||||
dump_contents()
|
||||
update_icon()
|
||||
SStgui.update_uis(src)
|
||||
|
||||
/obj/machinery/suit_storage_unit/relaymove(mob/user)
|
||||
if(locked)
|
||||
@@ -502,7 +501,7 @@
|
||||
if(drop)
|
||||
dropContents()
|
||||
update_icon()
|
||||
updateUsrDialog()
|
||||
SStgui.update_uis(src)
|
||||
|
||||
/obj/machinery/suit_storage_unit/dropContents()
|
||||
var/turf/T = get_turf(src)
|
||||
@@ -532,132 +531,81 @@
|
||||
if(target && !target.has_buckled_mobs() && (!isliving(target) || !mobtarget.buckled))
|
||||
occupant = target
|
||||
target.forceMove(src)
|
||||
updateUsrDialog()
|
||||
SStgui.update_uis(src)
|
||||
update_icon()
|
||||
|
||||
|
||||
////////
|
||||
|
||||
/obj/machinery/suit_storage_unit/attack_hand(mob/user)
|
||||
var/dat
|
||||
if(shocked && !(stat & NOPOWER))
|
||||
if(shock(user, 100))
|
||||
return
|
||||
if(stat & NOPOWER)
|
||||
return
|
||||
if(..())
|
||||
return
|
||||
if(panel_open) //The maintenance panel is open. Time for some shady stuff
|
||||
wires.Interact(user)
|
||||
if(uv) //The thing is running its cauterisation cycle. You have to wait.
|
||||
dat += "<HEAD><TITLE>Suit storage unit</TITLE></HEAD>"
|
||||
dat+= "<font color ='red'><B>Unit is cauterising contents with selected UV ray intensity. Please wait.</font></B><BR>"
|
||||
else
|
||||
if(!broken)
|
||||
dat+= "<B>Welcome to the Unit control panel.</B><HR>"
|
||||
dat+= text("Helmet storage compartment: <B>[]</B><BR>",(helmet ? helmet.name : "</font><font color ='grey'>No helmet detected.") )
|
||||
if(helmet && state_open)
|
||||
dat+="<A href='?src=[UID()];dispense_helmet=1'>Dispense helmet</A><BR>"
|
||||
dat+= text("Suit storage compartment: <B>[]</B><BR>",(suit ? suit.name : "</font><font color ='grey'>No exosuit detected.") )
|
||||
if(suit && state_open)
|
||||
dat+="<A href='?src=[UID()];dispense_suit=1'>Dispense suit</A><BR>"
|
||||
dat+= text("Breathmask storage compartment: <B>[]</B><BR>",(mask ? mask.name : "</font><font color ='grey'>No breathmask detected.") )
|
||||
if(mask && state_open)
|
||||
dat+="<A href='?src=[UID()];dispense_mask=1'>Dispense mask</A><BR>"
|
||||
dat+= text("Magboots storage compartment: <B>[]</B><BR>",(boots ? boots.name : "</font><font color ='grey'>No magboots detected.") )
|
||||
if(boots && state_open)
|
||||
dat+="<A href='?src=[UID()];dispense_magboots=1'>Dispense magboots</A><BR>"
|
||||
dat+= text("Tank storage compartment: <B>[]</B><BR>",(storage ? storage.name : "</font><font color ='grey'>No storage item detected.") )
|
||||
if(storage && state_open)
|
||||
dat+="<A href='?src=[UID()];dispense_storage=1'>Dispense storage item</A><BR>"
|
||||
if(occupant)
|
||||
dat+= "<HR><B><font color ='red'>WARNING: Biological entity detected inside the Unit's storage. Please remove.</B></font><BR>"
|
||||
dat+= "<A href='?src=[UID()];eject_guy=1'>Eject extra load</A>"
|
||||
dat+= text("<HR>Unit is: [] - <A href='?src=[UID()];toggle_open=1'>[] Unit</A> ",(state_open ? "Open" : "Closed"),(state_open ? "Close" : "Open"))
|
||||
if(state_open)
|
||||
dat+="<HR>"
|
||||
else
|
||||
dat+= text(" - <A href='?src=[UID()];toggle_lock=1'>*[] Unit*</A><HR>",(locked ? "Unlock" : "Lock") )
|
||||
dat+= text("Unit status: []",(locked? "<font color ='red'><B>**LOCKED**</B></font><BR>" : "<font color ='green'><B>**UNLOCKED**</B></font><BR>") )
|
||||
dat+= "<A href='?src=[UID()];cook=1'>Start Disinfection cycle</A><BR>"
|
||||
dat += "<BR><BR><A href='?src=[user.UID()];mach_close=suit_storage_unit'>Close control panel</A>"
|
||||
else //Ohhhh shit it's dirty or broken! Let's inform the guy.
|
||||
dat+= "<HEAD><TITLE>Suit storage unit</TITLE></HEAD>"
|
||||
dat+= "<font color='maroon'><B>Unit chamber is too contaminated to continue usage. Please call for a qualified individual to perform maintenance.</font></B><BR><BR>"
|
||||
dat+= "<HR><A href='?src=[user.UID()];mach_close=suit_storage_unit'>Close control panel</A>"
|
||||
|
||||
|
||||
var/datum/browser/popup = new(user, "suit_storage_unit", name, 400, 500)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "suit_storage_unit")
|
||||
return
|
||||
|
||||
/obj/machinery/suit_storage_unit/proc/check_allowed(user)
|
||||
if(!(allowed(user) || !secure))
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/suit_storage_unit/Topic(href, href_list)
|
||||
/obj/machinery/suit_storage_unit/attack_hand(mob/user)
|
||||
if(..() || (stat & NOPOWER))
|
||||
return
|
||||
if(shocked && shock(user, 100))
|
||||
return
|
||||
if(panel_open) //The maintenance panel is open. Time for some shady stuff
|
||||
wires.Interact(user)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/suit_storage_unit/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)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "SuitStorage", name, 402, 268, master_ui, state)
|
||||
ui.set_autoupdate(FALSE)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/suit_storage_unit/ui_data(mob/user)
|
||||
var/list/data = list(
|
||||
"locked" = locked,
|
||||
"open" = state_open,
|
||||
"broken" = broken,
|
||||
"helmet" = helmet ? helmet.name : null,
|
||||
"suit" = suit ? suit.name : null,
|
||||
"magboots" = boots ? boots.name : null,
|
||||
"mask" = mask ? mask.name : null,
|
||||
"storage" = storage ? storage.name : null,
|
||||
"uv" = uv
|
||||
)
|
||||
return data
|
||||
|
||||
/obj/machinery/suit_storage_unit/ui_act(action, list/params)
|
||||
if(..())
|
||||
return 1
|
||||
return
|
||||
add_fingerprint(usr)
|
||||
if(shocked && !(stat & NOPOWER))
|
||||
if(shock(usr, 100))
|
||||
return
|
||||
if((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
|
||||
usr.set_machine(src)
|
||||
if(href_list["toggleUV"])
|
||||
toggleUV()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["togglesafeties"])
|
||||
togglesafeties()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["dispense_helmet"])
|
||||
dispense_helmet()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["dispense_suit"])
|
||||
dispense_suit()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["dispense_mask"])
|
||||
dispense_mask()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["dispense_magboots"])
|
||||
dispense_magboots()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["dispense_storage"])
|
||||
dispense_storage()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["toggle_open"])
|
||||
if(!check_allowed(usr))
|
||||
return
|
||||
toggle_open(usr)
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["toggle_lock"])
|
||||
if(!check_allowed(usr))
|
||||
return
|
||||
toggle_lock(usr)
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["cook"])
|
||||
cook()
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
if(href_list["eject_guy"])
|
||||
eject_occupant(usr)
|
||||
updateUsrDialog()
|
||||
update_icon()
|
||||
add_fingerprint(usr)
|
||||
return
|
||||
return FALSE
|
||||
|
||||
. = TRUE
|
||||
switch(action)
|
||||
if("dispense_helmet")
|
||||
dispense_helmet()
|
||||
if("dispense_suit")
|
||||
dispense_suit()
|
||||
if("dispense_mask")
|
||||
dispense_mask()
|
||||
if("dispense_boots")
|
||||
dispense_boots()
|
||||
if("dispense_storage")
|
||||
dispense_storage()
|
||||
if("toggle_open")
|
||||
if(!check_allowed(usr))
|
||||
return FALSE
|
||||
toggle_open(usr)
|
||||
if("toggle_lock")
|
||||
if(!check_allowed(usr))
|
||||
return FALSE
|
||||
toggle_lock(usr)
|
||||
if("cook")
|
||||
cook()
|
||||
if("eject_occupant")
|
||||
eject_occupant(usr)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/suit_storage_unit/proc/toggleUV()
|
||||
if(!panel_open)
|
||||
@@ -692,7 +640,7 @@
|
||||
mask.forceMove(loc)
|
||||
mask = null
|
||||
|
||||
/obj/machinery/suit_storage_unit/proc/dispense_magboots()
|
||||
/obj/machinery/suit_storage_unit/proc/dispense_boots()
|
||||
if(!boots)
|
||||
return
|
||||
else
|
||||
@@ -754,7 +702,7 @@
|
||||
return
|
||||
eject_occupant(usr)
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
SStgui.update_uis(src)
|
||||
update_icon()
|
||||
return
|
||||
|
||||
@@ -785,7 +733,7 @@
|
||||
update_icon()
|
||||
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
SStgui.update_uis(src)
|
||||
return
|
||||
else
|
||||
occupant = null
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
import { Fragment } from 'inferno';
|
||||
import { useBackend } from '../backend';
|
||||
import { Box, Button, Dimmer, Divider, Flex, Icon, LabeledList, Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const SuitStorage = (props, context) => {
|
||||
const { data } = useBackend(context);
|
||||
const { uv } = data;
|
||||
return (
|
||||
<Window resizable>
|
||||
<Window.Content display="flex" className="Layout__content--flexColumn">
|
||||
{!!uv && (
|
||||
<Dimmer
|
||||
backgroundColor="black"
|
||||
opacity={0.85}>
|
||||
<Flex>
|
||||
<Flex.Item
|
||||
bold
|
||||
textAlign="center"
|
||||
mb={2}>
|
||||
<Icon
|
||||
name="spinner"
|
||||
spin={1}
|
||||
size={4}
|
||||
mb={4}
|
||||
/><br />
|
||||
Disinfection of contents in progress...
|
||||
</Flex.Item>
|
||||
</Flex>
|
||||
</Dimmer>
|
||||
)}
|
||||
<StoredItems />
|
||||
<Disinfect />
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
|
||||
const StoredItems = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
helmet,
|
||||
suit,
|
||||
magboots,
|
||||
mask,
|
||||
storage,
|
||||
open,
|
||||
locked,
|
||||
} = data;
|
||||
return (
|
||||
<Section
|
||||
title="Stored Items"
|
||||
flexGrow="1"
|
||||
buttons={
|
||||
<Fragment>
|
||||
<Button
|
||||
content={locked ? "Unlock" : "Lock"}
|
||||
icon={locked ? "unlock" : "lock"}
|
||||
disabled={open}
|
||||
onClick={() => act('toggle_lock')}
|
||||
/>
|
||||
<Button
|
||||
content={open ? "Close unit" : "Open unit"}
|
||||
icon={open ? "times-circle" : "expand"}
|
||||
color={open ? "red" : "green"}
|
||||
onClick={() => act('toggle_open')}
|
||||
/>
|
||||
</Fragment>
|
||||
}>
|
||||
{(open && !locked) ? (
|
||||
<LabeledList>
|
||||
<ItemRow object={helmet} label="Helmet" missingText="helmet" eject="dispense_helmet" />
|
||||
<ItemRow object={suit} label="Suit" missingText="suit" eject="dispense_suit" />
|
||||
<ItemRow object={magboots} label="Boots" missingText="boots" eject="dispense_boots" />
|
||||
<ItemRow object={mask} label="Breathmask" missingText="mask" eject="dispense_mask" />
|
||||
<ItemRow object={storage} label="Storage" missingText="storage item" eject="dispense_storage" />
|
||||
</LabeledList>
|
||||
) : (
|
||||
<Flex height="100%">
|
||||
<Flex.Item
|
||||
bold
|
||||
grow="1"
|
||||
textAlign="center"
|
||||
align="center"
|
||||
color="label">
|
||||
<Icon
|
||||
name={locked ? "lock" : "exclamation-circle"}
|
||||
size="5"
|
||||
mb={3}
|
||||
/><br />
|
||||
{locked ? "The unit is locked." : "The unit is closed."}
|
||||
</Flex.Item>
|
||||
</Flex>
|
||||
)}
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
|
||||
const ItemRow = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
object,
|
||||
label,
|
||||
missingText,
|
||||
eject,
|
||||
} = props;
|
||||
return (
|
||||
<LabeledList.Item label={label}>
|
||||
<Box my={0.5}>
|
||||
{object ? (
|
||||
<Button
|
||||
my={-1}
|
||||
icon="eject"
|
||||
content={object}
|
||||
onClick={() => act(eject)}
|
||||
/>
|
||||
) : (
|
||||
<Box color="silver" bold>
|
||||
No {missingText} found.
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
</LabeledList.Item>
|
||||
);
|
||||
};
|
||||
|
||||
const Disinfect = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
return (
|
||||
<Section>
|
||||
<Button
|
||||
fluid
|
||||
icon="cog"
|
||||
textAlign="center"
|
||||
content="Start Disinfection Cycle"
|
||||
onClick={() => act('cook')}
|
||||
/>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user