Merge branch 'master' into corporate-comms

This commit is contained in:
warior4356
2020-10-04 02:18:56 -07:00
8 changed files with 153 additions and 104 deletions
+54 -45
View File
@@ -15,7 +15,6 @@
var/decalinpool = list() // List containing all of the cleanable decals in pool
var/linked_area = null
var/temperature = NORMAL //The temperature of the pool, starts off on normal, which has no effects.
var/temperaturecolor = "" //used for nanoUI fancyness
var/srange = 5 //The range of the search for pool turfs, change this for bigger or smaller pools.
var/list/linkedmist = list() //Used to keep track of created mist
var/deep_water = FALSE //set to 1 to drown even standing people
@@ -67,8 +66,8 @@
else
to_chat(user, "<span class='warning'>Nothing happens.</span>")//If not emagged, don't do anything, and don't tell the user that it can be emagged.
/obj/machinery/poolcontroller/attack_hand(mob/user as mob)
ui_interact(user)
/obj/machinery/poolcontroller/attack_hand(mob/user)
tgui_interact(user)
/obj/machinery/poolcontroller/process()
processMob() //Call the mob affecting proc
@@ -151,64 +150,74 @@
linkedmist.Cut()
/obj/machinery/poolcontroller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open)
/obj/machinery/poolcontroller/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "poolcontroller.tmpl", "Pool Controller Interface", 520, 410)
ui = new(user, src, ui_key, "PoolController", "Pool Controller Interface", 520, 410)
ui.open()
/obj/machinery/poolcontroller/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
var/data[0]
var/currenttemp
switch(temperature) //So we can output nice things like "Cool" to nanoUI
/obj/machinery/poolcontroller/proc/temp_to_str(temp)
switch(temp) //So we can output nice things like "Cool" to tgUI
if(FRIGID)
currenttemp = "frigid"
return "frigid"
if(COOL)
currenttemp = "cool"
return "cool"
if(NORMAL)
currenttemp = "normal"
return "normal"
if(WARM)
currenttemp = "warm"
return "warm"
if(SCALDING)
currenttemp = "scalding"
data["currentTemp"] = currenttemp
return "scalding"
/obj/machinery/poolcontroller/proc/set_temp(val)
if (val != WARM && val != NORMAL && val != COOL && !(emagged && (val == SCALDING || val == FRIGID)))
return
if(val == SCALDING)
miston()
else
mistoff()
temperature = val
/obj/machinery/poolcontroller/proc/str_to_temp(str)
switch(str)
if("frigid")
return FRIGID
if("cool")
return COOL
if("normal")
return NORMAL
if("warm")
return WARM
if("scalding")
return SCALDING
/obj/machinery/poolcontroller/proc/set_temp_str(target)
var/temp = str_to_temp(target)
if(temp)
set_temp(temp)
/obj/machinery/poolcontroller/tgui_data(mob/user)
var/list/data = list()
data["currentTemp"] = temp_to_str(temperature)
data["emagged"] = emagged
data["TempColor"] = temperaturecolor
return data
/obj/machinery/poolcontroller/Topic(href, href_list)
/obj/machinery/poolcontroller/tgui_act(action, list/params)
if(..())
return 1
return
switch(href_list["temp"])
if("Scalding")
if(!emagged)
return 0
temperature = SCALDING
temperaturecolor = "#FF0000"
miston()
if("Frigid")
if(!emagged)
return 0
temperature = FRIGID
temperaturecolor = "#00CCCC"
mistoff()
if("Warm")
temperature = WARM
temperaturecolor = "#990000"
mistoff()
if("Cool")
temperature = COOL
temperaturecolor = "#009999"
mistoff()
if("Normal")
temperature = NORMAL
temperaturecolor = ""
mistoff()
switch(action)
if("setTemp")
set_temp_str(params["temp"])
return TRUE
return 1
return FALSE
#undef FRIGID
#undef COOL
@@ -120,13 +120,18 @@
return
var/mob/living/carbon/human/H = user
var/random = rand(1,2)
var/random = rand(1,3)
switch(random)
if(1)
to_chat(user, "<span class='danger'>Your flesh begins to melt! Miraculously, you seem fine otherwise.</span>")
H.set_species(/datum/species/skeleton)
if(2)
to_chat(user, "<span class='danger'>Power courses through you! You can now shift your form at will.")
if(user.mind)
var/obj/effect/proc_holder/spell/targeted/shapeshift/dragon/D = new
user.mind.AddSpell(D)
if(3)
to_chat(user, "<span class='danger'>You feel like you could walk straight through lava now.</span>")
H.weather_immunities |= "lava"
-55
View File
@@ -1,55 +0,0 @@
<!--
Title: Pool Controller UI.
Used In File(s): \code\game\machinery\poolcontroller.dm
-->
<div class="item">
<div class="itemLabel">
<b>Current Temperature</b>:
</div>
<div class="itemContent">
<font color={{:data.TempColor}}>{{:helper.capitalizeFirstLetter(data.currentTemp)}}</font>
</div>
</div>
<div class="item">
<div class="itemLabel">
Safety Status:
</div>
<div class="itemContent">
{{if data.emagged}}
<b><font color='red'>WARNING: OVERRIDDEN</font></b>
{{else}}
<b><font color='green'>Nominal</font></b>
{{/if}}
</div>
</div>
<div class="item">
<div class="itemContent">
<b>Temperature Selection:</b>
</div>
{{if data.emagged}}
<div class="itemContentWide" style="width: 100%;">
{{:helper.link('Scalding', 'arrow-circle-up', { 'temp' : 'Scalding' }, data.currentTemp == "scalding" ? 'selected' : null)}}
</div>
{{/if}}
<div class="itemContentWide" style="width: 100%;">
{{:helper.link('Warm', 'arrow-circle-up', { 'temp' : 'Warm' }, data.currentTemp == "warm" ? 'selected' : null)}}
</div>
<div class="itemContentWide" style="width: 100%;">
{{:helper.link('Normal', 'arrow-circle-right', { 'temp' : 'Normal' }, data.currentTemp == "normal" ? 'selected' : null)}}
</div>
<div class="itemContentWide" style="width: 100%;">
{{:helper.link('Cool', 'arrow-circle-down', { 'temp' : 'Cool' }, data.currentTemp == "cool" ? 'selected' : null)}}
</div>
{{if data.emagged}}
<div class="itemContentWide" style="width: 100%;">
{{:helper.link('Frigid', 'arrow-circle-down', { 'temp' : 'Frigid' }, data.currentTemp == "frigid" ? 'selected' : null)}}
</div>
{{/if}}
</div>
@@ -0,0 +1,82 @@
import { useBackend } from "../backend";
import { Button, Flex, LabeledList, Section, Box, Icon } from '../components';
import { Window } from "../layouts";
const TEMPS = {
scalding: { label: 'Scalding', color: '#FF0000', icon: 'fa fa-arrow-circle-up', requireEmag: true },
warm: { label: 'Warm', color: '#990000', icon: 'fa fa-arrow-circle-up' },
normal: { label: 'Normal', color: null, icon: 'fa fa-arrow-circle-right' },
cool: { label: 'Cool', color: '#009999', icon: 'fa fa-arrow-circle-down' },
frigid: { label: 'Frigid', color: '#00CCCC', icon: 'fa fa-arrow-circle-down', requireEmag: true },
};
const TempButton = (properties, context) => {
const { tempKey, ...buttonProps } = properties;
const temp = TEMPS[tempKey];
if (!temp) {
return null;
}
const { data, act } = useBackend(context);
const { currentTemp } = data;
const { label, icon } = temp;
const selected = tempKey === currentTemp;
const setTemp = () => {
act('setTemp', { temp: tempKey });
};
return (
<Button selected={selected} onClick={setTemp} {...buttonProps}>
<Icon name={icon} />
{label}
</Button>
);
};
export const PoolController = (properties, context) => {
const { data } = useBackend(context);
const { emagged, currentTemp } = data;
const { label: currentLabel, color: currentColor } = TEMPS[currentTemp] || TEMPS.normal;
const visibleTempKeys = [];
for (const [tempKey, { requireEmag }] of Object.entries(TEMPS)) {
if (!requireEmag || requireEmag && emagged) {
visibleTempKeys.push(tempKey);
}
}
return (
<Window>
<Window.Content>
<Section title="Status">
<LabeledList>
<LabeledList.Item label="Current Temperature">
<Box color={currentColor}>
{currentLabel}
</Box>
</LabeledList.Item>
<LabeledList.Item label="Safety Status">
{emagged ? (
<Box color="red">
WARNING: OVERRIDDEN
</Box>
) : (
<Box color="good">
Nominal
</Box>
)}
</LabeledList.Item>
</LabeledList>
</Section>
<Section title="Temperature Selection">
<Flex className="PoolController__Buttons" direction="column" align="flex-start">
{visibleTempKeys.map(tempKey => (
<TempButton key={tempKey} tempKey={tempKey} />
))}
</Flex>
</Section>
</Window.Content>
</Window>
);
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
.PoolController__Buttons {
.Button:not(:last-child) {
margin-bottom: 8px;
}
}
+1
View File
@@ -43,6 +43,7 @@
@include meta.load-css('./interfaces/CameraConsole.scss');
@include meta.load-css('./interfaces/NuclearBomb.scss');
@include meta.load-css('./interfaces/PDA.scss');
@include meta.load-css('./interfaces/PoolController.scss');
@include meta.load-css('./interfaces/Roulette.scss');
@include meta.load-css('./interfaces/SecurityRecords.scss');