mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Absolut cleanup.
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
// Use to show shuttle ETA/ETD times
|
||||
// Alert status
|
||||
// And arbitrary messages set by comms computer
|
||||
|
||||
/obj/machinery/status_display
|
||||
icon = 'icons/obj/status_display.dmi'
|
||||
icon_state = "frame"
|
||||
@@ -39,190 +38,184 @@
|
||||
maptext_height = 26
|
||||
maptext_width = 32
|
||||
|
||||
// new display
|
||||
// register for radio system
|
||||
New()
|
||||
..()
|
||||
spawn(5) // must wait for map loading to finish
|
||||
if(radio_controller)
|
||||
radio_controller.add_object(src, frequency)
|
||||
// new display
|
||||
// register for radio system
|
||||
/obj/machinery/status_display/New()
|
||||
..()
|
||||
spawn(5) // must wait for map loading to finish
|
||||
if(radio_controller)
|
||||
radio_controller.add_object(src, frequency)
|
||||
|
||||
|
||||
// timed process
|
||||
// timed process
|
||||
/obj/machinery/status_display/process()
|
||||
if(stat & NOPOWER)
|
||||
remove_display()
|
||||
return
|
||||
update()
|
||||
|
||||
process()
|
||||
if(stat & NOPOWER)
|
||||
remove_display()
|
||||
return
|
||||
update()
|
||||
|
||||
emp_act(severity)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
..(severity)
|
||||
return
|
||||
set_picture("ai_bsod")
|
||||
/obj/machinery/status_display/emp_act(severity)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
..(severity)
|
||||
return
|
||||
set_picture("ai_bsod")
|
||||
..(severity)
|
||||
|
||||
// set what is displayed
|
||||
// set what is displayed
|
||||
/obj/machinery/status_display/proc/update()
|
||||
if(friendc && mode!=4) //Makes all status displays except supply shuttle timer display the eye -- Urist
|
||||
set_picture("ai_friend")
|
||||
return
|
||||
|
||||
proc/update()
|
||||
if(friendc && mode!=4) //Makes all status displays except supply shuttle timer display the eye -- Urist
|
||||
set_picture("ai_friend")
|
||||
return
|
||||
|
||||
switch(mode)
|
||||
if(0) //blank
|
||||
remove_display()
|
||||
if(1) //emergency shuttle timer
|
||||
if(emergency_shuttle.waiting_to_leave())
|
||||
var/line1 = "-ETD-"
|
||||
var/line2
|
||||
if (emergency_shuttle.shuttle.is_launching())
|
||||
line2 = "Launch"
|
||||
else
|
||||
line2 = get_shuttle_timer_departure()
|
||||
if(length(line2) > CHARS_PER_LINE)
|
||||
line2 = "Error!"
|
||||
update_display(line1, line2)
|
||||
else if(emergency_shuttle.has_eta())
|
||||
var/line1 = "-ETA-"
|
||||
var/line2 = get_shuttle_timer_arrival()
|
||||
switch(mode)
|
||||
if(0) //blank
|
||||
remove_display()
|
||||
if(1) //emergency shuttle timer
|
||||
if(emergency_shuttle.waiting_to_leave())
|
||||
var/line1 = "-ETD-"
|
||||
var/line2
|
||||
if (emergency_shuttle.shuttle.is_launching())
|
||||
line2 = "Launch"
|
||||
else
|
||||
line2 = get_shuttle_timer_departure()
|
||||
if(length(line2) > CHARS_PER_LINE)
|
||||
line2 = "Error!"
|
||||
update_display(line1, line2)
|
||||
else
|
||||
remove_display()
|
||||
if(2) //custom messages
|
||||
var/line1
|
||||
var/line2
|
||||
|
||||
if(!index1)
|
||||
line1 = message1
|
||||
else
|
||||
line1 = copytext(message1+"|"+message1, index1, index1+CHARS_PER_LINE)
|
||||
var/message1_len = length(message1)
|
||||
index1 += SCROLL_SPEED
|
||||
if(index1 > message1_len)
|
||||
index1 -= message1_len
|
||||
|
||||
if(!index2)
|
||||
line2 = message2
|
||||
else
|
||||
line2 = copytext(message2+"|"+message2, index2, index2+CHARS_PER_LINE)
|
||||
var/message2_len = length(message2)
|
||||
index2 += SCROLL_SPEED
|
||||
if(index2 > message2_len)
|
||||
index2 -= message2_len
|
||||
update_display(line1, line2)
|
||||
if(4) // supply shuttle timer
|
||||
var/line1 = "SUPPLY"
|
||||
var/line2 = ""
|
||||
else if(emergency_shuttle.has_eta())
|
||||
var/line1 = "-ETA-"
|
||||
var/line2 = get_shuttle_timer_arrival()
|
||||
if(length(line2) > CHARS_PER_LINE)
|
||||
line2 = "Error!"
|
||||
update_display(line1, line2)
|
||||
else
|
||||
remove_display()
|
||||
if(2) //custom messages
|
||||
var/line1
|
||||
var/line2
|
||||
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (!shuttle)
|
||||
if(!index1)
|
||||
line1 = message1
|
||||
else
|
||||
line1 = copytext(message1+"|"+message1, index1, index1+CHARS_PER_LINE)
|
||||
var/message1_len = length(message1)
|
||||
index1 += SCROLL_SPEED
|
||||
if(index1 > message1_len)
|
||||
index1 -= message1_len
|
||||
|
||||
if(!index2)
|
||||
line2 = message2
|
||||
else
|
||||
line2 = copytext(message2+"|"+message2, index2, index2+CHARS_PER_LINE)
|
||||
var/message2_len = length(message2)
|
||||
index2 += SCROLL_SPEED
|
||||
if(index2 > message2_len)
|
||||
index2 -= message2_len
|
||||
update_display(line1, line2)
|
||||
if(4) // supply shuttle timer
|
||||
var/line1 = "SUPPLY"
|
||||
var/line2 = ""
|
||||
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (!shuttle)
|
||||
line2 = "Error"
|
||||
else if(shuttle.has_arrive_time())
|
||||
line2 = get_supply_shuttle_timer()
|
||||
if(lentext(line2) > CHARS_PER_LINE)
|
||||
line2 = "Error"
|
||||
else if(shuttle.has_arrive_time())
|
||||
line2 = get_supply_shuttle_timer()
|
||||
if(lentext(line2) > CHARS_PER_LINE)
|
||||
line2 = "Error"
|
||||
else if (shuttle.is_launching())
|
||||
if (shuttle.at_station())
|
||||
line2 = "Launch"
|
||||
else
|
||||
line2 = "ETA"
|
||||
else if (shuttle.is_launching())
|
||||
if (shuttle.at_station())
|
||||
line2 = "Launch"
|
||||
else
|
||||
if(shuttle.at_station())
|
||||
line2 = "Docked"
|
||||
else
|
||||
line1 = ""
|
||||
update_display(line1, line2)
|
||||
line2 = "ETA"
|
||||
else
|
||||
if(shuttle.at_station())
|
||||
line2 = "Docked"
|
||||
else
|
||||
line1 = ""
|
||||
update_display(line1, line2)
|
||||
|
||||
examine()
|
||||
set src in view()
|
||||
. = ..()
|
||||
switch(mode)
|
||||
if(1,2,4)
|
||||
usr << "The display says:<br>\t<xmp>[message1]</xmp><br>\t<xmp>[message2]</xmp>"
|
||||
/obj/machinery/status_display/examine()
|
||||
set src in view()
|
||||
. = ..()
|
||||
switch(mode)
|
||||
if(1,2,4)
|
||||
usr << "The display says:<br>\t<xmp>[message1]</xmp><br>\t<xmp>[message2]</xmp>"
|
||||
|
||||
|
||||
proc/set_message(m1, m2)
|
||||
if(m1)
|
||||
index1 = (length(m1) > CHARS_PER_LINE)
|
||||
message1 = m1
|
||||
else
|
||||
message1 = ""
|
||||
index1 = 0
|
||||
/obj/machinery/status_display/proc/set_message(m1, m2)
|
||||
if(m1)
|
||||
index1 = (length(m1) > CHARS_PER_LINE)
|
||||
message1 = m1
|
||||
else
|
||||
message1 = ""
|
||||
index1 = 0
|
||||
|
||||
if(m2)
|
||||
index2 = (length(m2) > CHARS_PER_LINE)
|
||||
message2 = m2
|
||||
else
|
||||
message2 = ""
|
||||
index2 = 0
|
||||
if(m2)
|
||||
index2 = (length(m2) > CHARS_PER_LINE)
|
||||
message2 = m2
|
||||
else
|
||||
message2 = ""
|
||||
index2 = 0
|
||||
|
||||
proc/set_picture(state)
|
||||
picture_state = state
|
||||
remove_display()
|
||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||
/obj/machinery/status_display/proc/set_picture(state)
|
||||
picture_state = state
|
||||
remove_display()
|
||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||
|
||||
proc/update_display(line1, line2)
|
||||
var/new_text = {"<div style="font-size:[FONT_SIZE];color:[FONT_COLOR];font:'[FONT_STYLE]';text-align:center;" valign="top">[line1]<br>[line2]</div>"}
|
||||
if(maptext != new_text)
|
||||
maptext = new_text
|
||||
/obj/machinery/status_display/proc/update_display(line1, line2)
|
||||
var/new_text = {"<div style="font-size:[FONT_SIZE];color:[FONT_COLOR];font:'[FONT_STYLE]';text-align:center;" valign="top">[line1]<br>[line2]</div>"}
|
||||
if(maptext != new_text)
|
||||
maptext = new_text
|
||||
|
||||
proc/get_shuttle_timer_arrival()
|
||||
var/timeleft = emergency_shuttle.estimate_arrival_time()
|
||||
if(timeleft < 0)
|
||||
return ""
|
||||
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||
|
||||
proc/get_shuttle_timer_departure()
|
||||
var/timeleft = emergency_shuttle.estimate_launch_time()
|
||||
if(timeleft < 0)
|
||||
return ""
|
||||
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||
|
||||
proc/get_supply_shuttle_timer()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (!shuttle)
|
||||
return "Error"
|
||||
|
||||
if(shuttle.has_arrive_time())
|
||||
var/timeleft = round((shuttle.arrive_time - world.time) / 10,1)
|
||||
if(timeleft < 0)
|
||||
return "Late"
|
||||
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||
/obj/machinery/status_display/proc/get_shuttle_timer_arrival()
|
||||
var/timeleft = emergency_shuttle.estimate_arrival_time()
|
||||
if(timeleft < 0)
|
||||
return ""
|
||||
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||
|
||||
proc/remove_display()
|
||||
if(overlays.len)
|
||||
overlays.Cut()
|
||||
if(maptext)
|
||||
maptext = ""
|
||||
/obj/machinery/status_display/proc/get_shuttle_timer_departure()
|
||||
var/timeleft = emergency_shuttle.estimate_launch_time()
|
||||
if(timeleft < 0)
|
||||
return ""
|
||||
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||
|
||||
/obj/machinery/status_display/proc/get_supply_shuttle_timer()
|
||||
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
|
||||
if (!shuttle)
|
||||
return "Error"
|
||||
|
||||
receive_signal(datum/signal/signal)
|
||||
if(shuttle.has_arrive_time())
|
||||
var/timeleft = round((shuttle.arrive_time - world.time) / 10,1)
|
||||
if(timeleft < 0)
|
||||
return "Late"
|
||||
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||
return ""
|
||||
|
||||
switch(signal.data["command"])
|
||||
if("blank")
|
||||
mode = 0
|
||||
/obj/machinery/status_display/proc/remove_display()
|
||||
if(overlays.len)
|
||||
overlays.Cut()
|
||||
if(maptext)
|
||||
maptext = ""
|
||||
|
||||
if("shuttle")
|
||||
mode = 1
|
||||
/obj/machinery/status_display/receive_signal(datum/signal/signal)
|
||||
switch(signal.data["command"])
|
||||
if("blank")
|
||||
mode = 0
|
||||
|
||||
if("message")
|
||||
mode = 2
|
||||
set_message(signal.data["msg1"], signal.data["msg2"])
|
||||
if("shuttle")
|
||||
mode = 1
|
||||
|
||||
if("alert")
|
||||
mode = 3
|
||||
set_picture(signal.data["picture_state"])
|
||||
|
||||
if("supply")
|
||||
if(supply_display)
|
||||
mode = 4
|
||||
if("message")
|
||||
mode = 2
|
||||
set_message(signal.data["msg1"], signal.data["msg2"])
|
||||
|
||||
if("alert")
|
||||
mode = 3
|
||||
set_picture(signal.data["picture_state"])
|
||||
|
||||
if("supply")
|
||||
if(supply_display)
|
||||
mode = 4
|
||||
|
||||
/obj/machinery/ai_status_display
|
||||
icon = 'icons/obj/status_display.dmi'
|
||||
@@ -239,74 +232,71 @@
|
||||
|
||||
var/emotion = "Neutral"
|
||||
|
||||
/obj/machinery/ai_status_display/process()
|
||||
if(stat & NOPOWER)
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
process()
|
||||
if(stat & NOPOWER)
|
||||
overlays.Cut()
|
||||
return
|
||||
update()
|
||||
|
||||
update()
|
||||
|
||||
emp_act(severity)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
..(severity)
|
||||
return
|
||||
set_picture("ai_bsod")
|
||||
/obj/machinery/ai_status_display/emp_act(severity)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
..(severity)
|
||||
return
|
||||
set_picture("ai_bsod")
|
||||
..(severity)
|
||||
|
||||
proc/update()
|
||||
/obj/machinery/ai_status_display/proc/update()
|
||||
if(mode==0) //Blank
|
||||
overlays.Cut()
|
||||
return
|
||||
|
||||
if(mode==0) //Blank
|
||||
overlays.Cut()
|
||||
return
|
||||
if(mode==1) // AI emoticon
|
||||
switch(emotion)
|
||||
if("Very Happy")
|
||||
set_picture("ai_veryhappy")
|
||||
if("Happy")
|
||||
set_picture("ai_happy")
|
||||
if("Neutral")
|
||||
set_picture("ai_neutral")
|
||||
if("Unsure")
|
||||
set_picture("ai_unsure")
|
||||
if("Confused")
|
||||
set_picture("ai_confused")
|
||||
if("Sad")
|
||||
set_picture("ai_sad")
|
||||
if("Surprised")
|
||||
set_picture("ai_surprised")
|
||||
if("Upset")
|
||||
set_picture("ai_upset")
|
||||
if("Angry")
|
||||
set_picture("ai_angry")
|
||||
if("BSOD")
|
||||
set_picture("ai_bsod")
|
||||
if("Blank")
|
||||
set_picture("ai_off")
|
||||
if("Problems?")
|
||||
set_picture("ai_trollface")
|
||||
if("Awesome")
|
||||
set_picture("ai_awesome")
|
||||
if("Dorfy")
|
||||
set_picture("ai_urist")
|
||||
if("Facepalm")
|
||||
set_picture("ai_facepalm")
|
||||
if("Friend Computer")
|
||||
set_picture("ai_friend")
|
||||
return
|
||||
|
||||
if(mode==1) // AI emoticon
|
||||
switch(emotion)
|
||||
if("Very Happy")
|
||||
set_picture("ai_veryhappy")
|
||||
if("Happy")
|
||||
set_picture("ai_happy")
|
||||
if("Neutral")
|
||||
set_picture("ai_neutral")
|
||||
if("Unsure")
|
||||
set_picture("ai_unsure")
|
||||
if("Confused")
|
||||
set_picture("ai_confused")
|
||||
if("Sad")
|
||||
set_picture("ai_sad")
|
||||
if("Surprised")
|
||||
set_picture("ai_surprised")
|
||||
if("Upset")
|
||||
set_picture("ai_upset")
|
||||
if("Angry")
|
||||
set_picture("ai_angry")
|
||||
if("BSOD")
|
||||
set_picture("ai_bsod")
|
||||
if("Blank")
|
||||
set_picture("ai_off")
|
||||
if("Problems?")
|
||||
set_picture("ai_trollface")
|
||||
if("Awesome")
|
||||
set_picture("ai_awesome")
|
||||
if("Dorfy")
|
||||
set_picture("ai_urist")
|
||||
if("Facepalm")
|
||||
set_picture("ai_facepalm")
|
||||
if("Friend Computer")
|
||||
set_picture("ai_friend")
|
||||
|
||||
return
|
||||
|
||||
if(mode==2) // BSOD
|
||||
set_picture("ai_bsod")
|
||||
return
|
||||
if(mode==2) // BSOD
|
||||
set_picture("ai_bsod")
|
||||
return
|
||||
|
||||
|
||||
proc/set_picture(var/state)
|
||||
picture_state = state
|
||||
if(overlays.len)
|
||||
overlays.Cut()
|
||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||
/obj/machinery/ai_status_display/proc/set_picture(var/state)
|
||||
picture_state = state
|
||||
if(overlays.len)
|
||||
overlays.Cut()
|
||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||
|
||||
#undef CHARS_PER_LINE
|
||||
#undef FOND_SIZE
|
||||
|
||||
Reference in New Issue
Block a user