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
|
// Use to show shuttle ETA/ETD times
|
||||||
// Alert status
|
// Alert status
|
||||||
// And arbitrary messages set by comms computer
|
// And arbitrary messages set by comms computer
|
||||||
|
|
||||||
/obj/machinery/status_display
|
/obj/machinery/status_display
|
||||||
icon = 'icons/obj/status_display.dmi'
|
icon = 'icons/obj/status_display.dmi'
|
||||||
icon_state = "frame"
|
icon_state = "frame"
|
||||||
@@ -39,190 +38,184 @@
|
|||||||
maptext_height = 26
|
maptext_height = 26
|
||||||
maptext_width = 32
|
maptext_width = 32
|
||||||
|
|
||||||
// new display
|
// new display
|
||||||
// register for radio system
|
// register for radio system
|
||||||
New()
|
/obj/machinery/status_display/New()
|
||||||
..()
|
..()
|
||||||
spawn(5) // must wait for map loading to finish
|
spawn(5) // must wait for map loading to finish
|
||||||
if(radio_controller)
|
if(radio_controller)
|
||||||
radio_controller.add_object(src, frequency)
|
radio_controller.add_object(src, frequency)
|
||||||
|
|
||||||
|
|
||||||
// timed process
|
// timed process
|
||||||
|
/obj/machinery/status_display/process()
|
||||||
|
if(stat & NOPOWER)
|
||||||
|
remove_display()
|
||||||
|
return
|
||||||
|
update()
|
||||||
|
|
||||||
process()
|
/obj/machinery/status_display/emp_act(severity)
|
||||||
if(stat & NOPOWER)
|
if(stat & (BROKEN|NOPOWER))
|
||||||
remove_display()
|
|
||||||
return
|
|
||||||
update()
|
|
||||||
|
|
||||||
emp_act(severity)
|
|
||||||
if(stat & (BROKEN|NOPOWER))
|
|
||||||
..(severity)
|
|
||||||
return
|
|
||||||
set_picture("ai_bsod")
|
|
||||||
..(severity)
|
..(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()
|
switch(mode)
|
||||||
if(friendc && mode!=4) //Makes all status displays except supply shuttle timer display the eye -- Urist
|
if(0) //blank
|
||||||
set_picture("ai_friend")
|
remove_display()
|
||||||
return
|
if(1) //emergency shuttle timer
|
||||||
|
if(emergency_shuttle.waiting_to_leave())
|
||||||
switch(mode)
|
var/line1 = "-ETD-"
|
||||||
if(0) //blank
|
var/line2
|
||||||
remove_display()
|
if (emergency_shuttle.shuttle.is_launching())
|
||||||
if(1) //emergency shuttle timer
|
line2 = "Launch"
|
||||||
if(emergency_shuttle.waiting_to_leave())
|
else
|
||||||
var/line1 = "-ETD-"
|
line2 = get_shuttle_timer_departure()
|
||||||
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()
|
|
||||||
if(length(line2) > CHARS_PER_LINE)
|
if(length(line2) > CHARS_PER_LINE)
|
||||||
line2 = "Error!"
|
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)
|
update_display(line1, line2)
|
||||||
if(4) // supply shuttle timer
|
else if(emergency_shuttle.has_eta())
|
||||||
var/line1 = "SUPPLY"
|
var/line1 = "-ETA-"
|
||||||
var/line2 = ""
|
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(!index1)
|
||||||
if (!shuttle)
|
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"
|
line2 = "Error"
|
||||||
else if(shuttle.has_arrive_time())
|
else if (shuttle.is_launching())
|
||||||
line2 = get_supply_shuttle_timer()
|
if (shuttle.at_station())
|
||||||
if(lentext(line2) > CHARS_PER_LINE)
|
line2 = "Launch"
|
||||||
line2 = "Error"
|
|
||||||
else if (shuttle.is_launching())
|
|
||||||
if (shuttle.at_station())
|
|
||||||
line2 = "Launch"
|
|
||||||
else
|
|
||||||
line2 = "ETA"
|
|
||||||
else
|
else
|
||||||
if(shuttle.at_station())
|
line2 = "ETA"
|
||||||
line2 = "Docked"
|
else
|
||||||
else
|
if(shuttle.at_station())
|
||||||
line1 = ""
|
line2 = "Docked"
|
||||||
update_display(line1, line2)
|
else
|
||||||
|
line1 = ""
|
||||||
|
update_display(line1, line2)
|
||||||
|
|
||||||
examine()
|
/obj/machinery/status_display/examine()
|
||||||
set src in view()
|
set src in view()
|
||||||
. = ..()
|
. = ..()
|
||||||
switch(mode)
|
switch(mode)
|
||||||
if(1,2,4)
|
if(1,2,4)
|
||||||
usr << "The display says:<br>\t<xmp>[message1]</xmp><br>\t<xmp>[message2]</xmp>"
|
usr << "The display says:<br>\t<xmp>[message1]</xmp><br>\t<xmp>[message2]</xmp>"
|
||||||
|
|
||||||
|
|
||||||
proc/set_message(m1, m2)
|
/obj/machinery/status_display/proc/set_message(m1, m2)
|
||||||
if(m1)
|
if(m1)
|
||||||
index1 = (length(m1) > CHARS_PER_LINE)
|
index1 = (length(m1) > CHARS_PER_LINE)
|
||||||
message1 = m1
|
message1 = m1
|
||||||
else
|
else
|
||||||
message1 = ""
|
message1 = ""
|
||||||
index1 = 0
|
index1 = 0
|
||||||
|
|
||||||
if(m2)
|
if(m2)
|
||||||
index2 = (length(m2) > CHARS_PER_LINE)
|
index2 = (length(m2) > CHARS_PER_LINE)
|
||||||
message2 = m2
|
message2 = m2
|
||||||
else
|
else
|
||||||
message2 = ""
|
message2 = ""
|
||||||
index2 = 0
|
index2 = 0
|
||||||
|
|
||||||
proc/set_picture(state)
|
/obj/machinery/status_display/proc/set_picture(state)
|
||||||
picture_state = state
|
picture_state = state
|
||||||
remove_display()
|
remove_display()
|
||||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||||
|
|
||||||
proc/update_display(line1, line2)
|
/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>"}
|
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)
|
if(maptext != new_text)
|
||||||
maptext = new_text
|
maptext = new_text
|
||||||
|
|
||||||
proc/get_shuttle_timer_arrival()
|
/obj/machinery/status_display/proc/get_shuttle_timer_arrival()
|
||||||
var/timeleft = emergency_shuttle.estimate_arrival_time()
|
var/timeleft = emergency_shuttle.estimate_arrival_time()
|
||||||
if(timeleft < 0)
|
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)]"
|
|
||||||
return ""
|
return ""
|
||||||
|
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
|
||||||
|
|
||||||
proc/remove_display()
|
/obj/machinery/status_display/proc/get_shuttle_timer_departure()
|
||||||
if(overlays.len)
|
var/timeleft = emergency_shuttle.estimate_launch_time()
|
||||||
overlays.Cut()
|
if(timeleft < 0)
|
||||||
if(maptext)
|
return ""
|
||||||
maptext = ""
|
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"])
|
/obj/machinery/status_display/proc/remove_display()
|
||||||
if("blank")
|
if(overlays.len)
|
||||||
mode = 0
|
overlays.Cut()
|
||||||
|
if(maptext)
|
||||||
|
maptext = ""
|
||||||
|
|
||||||
if("shuttle")
|
/obj/machinery/status_display/receive_signal(datum/signal/signal)
|
||||||
mode = 1
|
switch(signal.data["command"])
|
||||||
|
if("blank")
|
||||||
|
mode = 0
|
||||||
|
|
||||||
if("message")
|
if("shuttle")
|
||||||
mode = 2
|
mode = 1
|
||||||
set_message(signal.data["msg1"], signal.data["msg2"])
|
|
||||||
|
|
||||||
if("alert")
|
if("message")
|
||||||
mode = 3
|
mode = 2
|
||||||
set_picture(signal.data["picture_state"])
|
set_message(signal.data["msg1"], signal.data["msg2"])
|
||||||
|
|
||||||
if("supply")
|
|
||||||
if(supply_display)
|
|
||||||
mode = 4
|
|
||||||
|
|
||||||
|
if("alert")
|
||||||
|
mode = 3
|
||||||
|
set_picture(signal.data["picture_state"])
|
||||||
|
|
||||||
|
if("supply")
|
||||||
|
if(supply_display)
|
||||||
|
mode = 4
|
||||||
|
|
||||||
/obj/machinery/ai_status_display
|
/obj/machinery/ai_status_display
|
||||||
icon = 'icons/obj/status_display.dmi'
|
icon = 'icons/obj/status_display.dmi'
|
||||||
@@ -239,74 +232,71 @@
|
|||||||
|
|
||||||
var/emotion = "Neutral"
|
var/emotion = "Neutral"
|
||||||
|
|
||||||
|
/obj/machinery/ai_status_display/process()
|
||||||
|
if(stat & NOPOWER)
|
||||||
|
overlays.Cut()
|
||||||
|
return
|
||||||
|
|
||||||
process()
|
update()
|
||||||
if(stat & NOPOWER)
|
|
||||||
overlays.Cut()
|
|
||||||
return
|
|
||||||
|
|
||||||
update()
|
/obj/machinery/ai_status_display/emp_act(severity)
|
||||||
|
if(stat & (BROKEN|NOPOWER))
|
||||||
emp_act(severity)
|
|
||||||
if(stat & (BROKEN|NOPOWER))
|
|
||||||
..(severity)
|
|
||||||
return
|
|
||||||
set_picture("ai_bsod")
|
|
||||||
..(severity)
|
..(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
|
if(mode==1) // AI emoticon
|
||||||
overlays.Cut()
|
switch(emotion)
|
||||||
return
|
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
|
if(mode==2) // BSOD
|
||||||
switch(emotion)
|
set_picture("ai_bsod")
|
||||||
if("Very Happy")
|
return
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
proc/set_picture(var/state)
|
/obj/machinery/ai_status_display/proc/set_picture(var/state)
|
||||||
picture_state = state
|
picture_state = state
|
||||||
if(overlays.len)
|
if(overlays.len)
|
||||||
overlays.Cut()
|
overlays.Cut()
|
||||||
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
overlays += image('icons/obj/status_display.dmi', icon_state=picture_state)
|
||||||
|
|
||||||
#undef CHARS_PER_LINE
|
#undef CHARS_PER_LINE
|
||||||
#undef FOND_SIZE
|
#undef FOND_SIZE
|
||||||
|
|||||||
Reference in New Issue
Block a user