Files
Bubberstation/code/game/machinery/computer/pod.dm
SkyratBot 36cf718cc7 [MIRROR] Adds a stack_trace for emissives with invalid icon_states, fixes all that appeared roundstart [MDB IGNORE] (#19678)
* Adds a stack_trace for emissives with invalid icon_states, fixes all that appeared roundstart (#73678)

## About The Pull Request
So, this spiraled from one missing icon being fixed to an entire check
for said icons.
Several icon files no longer use error icons because its assumed that
the checks will handle any missing ones, but the checks don't apply to
emissives nor overlays at all. This led to the radsuit having an
emissive but no icon_state for it - a relic of the old radsuit. This was
only noticed because of a downstream with an error icon appearing for
it...

I was curious how many were actually having the same issue, so I made a
small little stack_trace in the mutable_appearance proc.
There were like, 2k. Lots of them were icons named, like, "transparent"
or "blank" too...
I moved that check to the emissives proc because I semi-understand that
system so could actually fix it, and it moved to around fourty
roundstart. Much more achievable.

(The error usually has more info if you click on it, including the item
that caused it. I dunno how to add that to the check itself because of
where it's located, though.)

![F99cOII1XJ](https://user-images.githubusercontent.com/76465278/221503786-63dc6980-a48b-4290-b891-23c0499500ff.png)

This fixes all the ones I could find, including...
Nonexistant icons that shouldn't be adding emissives on:
- Empty Barsign
- Radsuit
- Mass Driver Controllers
- Telescreens
- Aux Base Consoles
- PanDEMIC
- Kobayashi computer (holodeck)
- Abductor camera console
- Syndie drop pod
- BSA controller
Entirely missing icons on:
- Pwr Game Vendor (this was just misnamed)
- Generic Soda Vendor
- Engivend
- Security Laptop (proud of this one.,.,)
![dreamseeker_36PwO4HSLO](https://user-images.githubusercontent.com/76465278/221544806-3c5ae33a-1360-49e0-ba80-afea6c0a9339.gif)

There are no doubt more of them hidden about, but I don't really know
what I'm doing... If there's a check that'd be better than this, please
review telling me what to change <3
## Why It's Good For The Game
Fixes missing icons, fixes attempts to add icons where we don't need
them, and adds a check to help fix more of the two issues as they occur.
## Changelog
🆑
fix: fixed missing emissives on the Engivend, Pwr-Game Soda, and generic
Soda vendors. Also fixed the seclaptop having no valid screen icon!
fix: fixed a few items trying to apply emissives when they shouldn't.
code: added a stack_trace for emissives with missing icon states.
/🆑

* Adds a stack_trace for emissives with invalid icon_states, fixes all that appeared roundstart

* Update cryopod.dm

---------

Co-authored-by: OrionTheFox <76465278+OrionTheFox@users.noreply.github.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
2023-03-10 06:11:13 +00:00

171 lines
4.9 KiB
Plaintext

/obj/machinery/computer/pod
name = "mass driver launch control"
desc = "A combined blastdoor and mass driver control unit."
processing_flags = START_PROCESSING_MANUALLY
/// Connected mass driver
var/obj/machinery/mass_driver/connected = null
/// ID of the launch control
var/id = 1
/// If the launch timer counts down
var/timing = FALSE
/// Time before auto launch
var/time = 30
/// Range in which we search for a mass drivers and poddoors nearby
var/range = 4
/// Countdown timer for the mass driver's delayed launch functionality.
COOLDOWN_DECLARE(massdriver_countdown)
/obj/machinery/computer/pod/Initialize(mapload)
. = ..()
for(var/obj/machinery/mass_driver/M in range(range, src))
if(M.id == id)
connected = M
break
/obj/machinery/computer/pod/process(delta_time)
if(COOLDOWN_FINISHED(src, massdriver_countdown))
timing = FALSE
// alarm() sleeps, so we want to end processing first and can't rely on return PROCESS_KILL
end_processing()
alarm()
/**
* Initiates launching sequence by checking if all components are functional, opening poddoors, firing mass drivers and then closing poddoors
*/
/obj/machinery/computer/pod/proc/alarm()
if(machine_stat & (NOPOWER|BROKEN))
return
if(!connected)
say("Cannot locate mass driver connector. Cancelling firing sequence!")
return
for(var/obj/machinery/door/poddoor/M in range(range, src))
if(M.id == id)
M.open()
sleep(2 SECONDS)
for(var/obj/machinery/mass_driver/M in range(range, src))
if(M.id == id)
M.power = connected.power
M.drive()
sleep(5 SECONDS)
for(var/obj/machinery/door/poddoor/M in range(range, src))
if(M.id == id)
M.close()
/obj/machinery/computer/pod/ui_interact(mob/user, datum/tgui/ui)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "MassDriverControl", name)
ui.open()
/obj/machinery/computer/pod/ui_data(mob/user)
var/list/data = list()
// If the cooldown has finished, just display the time. If the cooldown hasn't finished, display the cooldown.
var/display_time = COOLDOWN_FINISHED(src, massdriver_countdown) ? time : COOLDOWN_TIMELEFT(src, massdriver_countdown) * 0.1
data["connected"] = connected ? TRUE : FALSE
data["seconds"] = round(display_time % 60)
data["minutes"] = round((display_time - data["seconds"]) / 60)
data["timing"] = timing
data["power"] = connected ? connected.power : 0.25
data["poddoor"] = FALSE
for(var/obj/machinery/door/poddoor/door in range(range, src))
if(door.id == id)
data["poddoor"] = TRUE
break
return data
/obj/machinery/computer/pod/ui_act(action, list/params)
. = ..()
if(.)
return
if(!allowed(usr))
to_chat(usr, span_warning("Access denied."))
return
switch(action)
if("set_power")
if(!connected)
return
var/value = text2num(params["power"])
if(!value)
return
value = clamp(value, 0.25, 16)
connected.power = value
return TRUE
if("launch")
alarm()
return TRUE
if("time")
timing = !timing
if(timing)
COOLDOWN_START(src, massdriver_countdown, time SECONDS)
begin_processing()
else
time = COOLDOWN_TIMELEFT(src, massdriver_countdown) * 0.1
COOLDOWN_RESET(src, massdriver_countdown)
end_processing()
return TRUE
if("input")
var/value = text2num(params["adjust"])
if(!value)
return
value = round(time + value)
time = clamp(value, 0, 120)
return TRUE
if("door")
for(var/obj/machinery/door/poddoor/M in range(range, src))
if(M.id == id)
if(M.density)
M.open()
else
M.close()
return TRUE
if("driver_test")
for(var/obj/machinery/mass_driver/M in range(range, src))
if(M.id == id)
M.power = connected?.power
M.drive()
return TRUE
/obj/machinery/computer/pod/old
name = "\improper DoorMex control console"
icon_state = "oldcomp"
icon_screen = "library"
icon_keyboard = null
/obj/machinery/computer/pod/old/mass_driver_controller
name = "\improper Mass Driver Controller"
icon = 'icons/obj/airlock_machines.dmi'
icon_state = "airlock_control_standby"
icon_screen = null
density = FALSE
/obj/machinery/computer/pod/old/mass_driver_controller/ordnancedriver
id = MASSDRIVER_ORDNANCE
//for maps where pod doors are outside of the standard 4 tile controller detection range (ie Pubbystation)
/obj/machinery/computer/pod/old/mass_driver_controller/ordnancedriver/longrange
range = 6
/obj/machinery/computer/pod/old/mass_driver_controller/chapelgun
id = MASSDRIVER_CHAPEL
/obj/machinery/computer/pod/old/mass_driver_controller/trash
id = MASSDRIVER_DISPOSALS
/obj/machinery/computer/pod/old/mass_driver_controller/shack
id = MASSDRIVER_SHACK
/obj/machinery/computer/pod/old/syndicate
name = "\improper ProComp Executive IIc"
desc = "The Syndicate operate on a tight budget. Operates external airlocks."
req_access = list(ACCESS_SYNDICATE)
/obj/machinery/computer/pod/old/swf
name = "\improper Magix System IV"
desc = "An arcane artifact that holds much magic. Running E-Knock 2.2: Sorcerer's Edition."