From 9a2c292cf1ab2f709a4b9dd0ef251188c0ef8369 Mon Sep 17 00:00:00 2001 From: Geeves Date: Wed, 12 May 2021 21:41:01 +0200 Subject: [PATCH] Flight Helmets (#11834) --- aurorastation.dme | 1 + .../subsystems/processing/shuttle.dm | 2 + code/datums/outfits/ert/tcfl.dm | 2 +- code/modules/clothing/head/helmet.dm | 40 +------ code/modules/clothing/head/pilot_helmet.dm | 99 ++++++++++++++++++ code/modules/shuttles/shuttle.dm | 10 ++ code/modules/shuttles/shuttle_autodock.dm | 18 ++-- code/modules/shuttles/shuttle_console.dm | 78 ++++++++++---- html/changelogs/geeves-pilot_helmet.yml | 6 ++ icons/clothing/head/pilot_helmets.dmi | Bin 0 -> 1125 bytes 10 files changed, 188 insertions(+), 68 deletions(-) create mode 100644 code/modules/clothing/head/pilot_helmet.dm create mode 100644 html/changelogs/geeves-pilot_helmet.yml create mode 100644 icons/clothing/head/pilot_helmets.dmi diff --git a/aurorastation.dme b/aurorastation.dme index 74b7e35ec88..19ca61c954c 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -1485,6 +1485,7 @@ #include "code\modules\clothing\head\jobs.dm" #include "code\modules\clothing\head\misc.dm" #include "code\modules\clothing\head\misc_special.dm" +#include "code\modules\clothing\head\pilot_helmet.dm" #include "code\modules\clothing\head\soft_caps.dm" #include "code\modules\clothing\head\xenos\tajara.dm" #include "code\modules\clothing\head\xenos\unathi.dm" diff --git a/code/controllers/subsystems/processing/shuttle.dm b/code/controllers/subsystems/processing/shuttle.dm index f623e32d563..cebd6b04894 100644 --- a/code/controllers/subsystems/processing/shuttle.dm +++ b/code/controllers/subsystems/processing/shuttle.dm @@ -16,6 +16,8 @@ var/datum/controller/subsystem/processing/shuttle/SSshuttle var/list/docking_registry = list() //Docking controller tag -> docking controller program, mostly for init purposes. var/list/shuttle_areas = list() //All the areas of all shuttles. + var/list/lonely_shuttle_computers = list() //shuttle computers that haven't been attached to their shuttles yet + var/list/landmarks_awaiting_sector = list() //Stores automatic landmarks that are waiting for a sector to finish loading. var/list/landmarks_still_needed = list() //Stores landmark_tags that need to be assigned to the sector (landmark_tag = sector) when registered. var/list/shuttles_to_initialize = list() //A queue for shuttles to initialize at the appropriate time. diff --git a/code/datums/outfits/ert/tcfl.dm b/code/datums/outfits/ert/tcfl.dm index 2923a16a44f..35282a39627 100644 --- a/code/datums/outfits/ert/tcfl.dm +++ b/code/datums/outfits/ert/tcfl.dm @@ -39,7 +39,7 @@ /datum/outfit/admin/ert/legion/pilot name = "TCFL Dropship Pilot" uniform = /obj/item/clothing/under/legion/pilot - head = /obj/item/clothing/head/helmet/legion_pilot + head = /obj/item/clothing/head/helmet/pilot/legion suit = /obj/item/clothing/suit/storage/toggle/leather_jacket/flight/legion/alt gloves = null back = null diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index a84fb95de3d..272a9dbadef 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -422,42 +422,4 @@ brightness_on = 6 light_wedge = LIGHT_WIDE camera = /obj/machinery/camera/network/tcfl - on = 0 - -/obj/item/clothing/head/helmet/legion_pilot - name = "foreign legion flight helmet" - desc = "A helmet with an aged pilot visor mounted to it. The visor feeds its wearer in-flight information via a heads-up display." - icon_state = "legion_pilot_up" - body_parts_covered = null - flags_inv = BLOCKHEADHAIR - armor = list( - melee = ARMOR_MELEE_KNIVES, - bullet = ARMOR_BALLISTIC_SMALL, - laser = ARMOR_LASER_SMALL, - energy = ARMOR_ENERGY_MINOR, - bomb = ARMOR_BOMB_PADDED - ) - camera = /obj/machinery/camera/network/tcfl - siemens_coefficient = 0.35 - action_button_name = "Flip Pilot Visor" - -/obj/item/clothing/head/helmet/legion_pilot/attack_self() - flip_visor() - -/obj/item/clothing/head/helmet/legion_pilot/verb/flip_visor() - set category = "Object" - set name = "Flip pilot visor" - var/mob/living/carbon/human/user - if(istype(usr,/mob/living/carbon/human)) - user = usr - else - return - if(icon_state == initial(icon_state)) - icon_state = "legion_pilot" - to_chat(user, "You flip down the pilot visor.") - sound_to(user, 'sound/items/goggles_charge.ogg') - else - icon_state = initial(icon_state) - to_chat(user, "You flip up the pilot visor.") - update_clothing_icon() - user.update_action_buttons() + on = 0 \ No newline at end of file diff --git a/code/modules/clothing/head/pilot_helmet.dm b/code/modules/clothing/head/pilot_helmet.dm new file mode 100644 index 00000000000..0560f6025fd --- /dev/null +++ b/code/modules/clothing/head/pilot_helmet.dm @@ -0,0 +1,99 @@ +/obj/item/clothing/head/helmet/pilot + name = "flight helmet" + desc = "A helmet flip-down pilot visor mounted to it. The visor feeds its wearer in-flight information via a heads-up display." + icon = 'icons/clothing/head/pilot_helmets.dmi' + icon_state = "pilot_helmet" + item_state = "pilot_helmet" + contained_sprite = TRUE + flags_inv = BLOCKHEADHAIR + armor = list( + melee = ARMOR_MELEE_KNIVES, + bullet = ARMOR_BALLISTIC_SMALL, + laser = ARMOR_LASER_SMALL, + energy = ARMOR_ENERGY_MINOR, + bomb = ARMOR_BOMB_PADDED + ) + siemens_coefficient = 0.35 + action_button_name = "Flip Pilot Visor" + + var/flipped_up = FALSE + var/obj/machinery/computer/shuttle_control/linked_console + var/obj/pilot_overlay_holder/hud_overlay + +/obj/item/clothing/head/helmet/pilot/Initialize() + . = ..() + hud_overlay = new(src) + set_hud_maptext("Shuttle Status: No Shuttle Linked.") + +/obj/item/clothing/head/helmet/pilot/Destroy() + if(linked_console) + linked_console.linked_helmets -= src + linked_console = null + return ..() + +/obj/item/clothing/head/helmet/pilot/attack_self() + flip_visor() + +/obj/item/clothing/head/helmet/pilot/verb/flip_visor() + set name = "Flip Pilot Visor" + set category = "Object" + + var/mob/living/carbon/human/user = usr + if(!istype(user)) + return + + flipped_up = !flipped_up + if(flipped_up) + icon_state = "[initial(icon_state)]_up" + item_state = "[initial(item_state)]_up" + body_parts_covered = HEAD + to_chat(user, SPAN_NOTICE("You flip up the pilot visor.")) + check_hud_overlay(user) + else + icon_state = initial(icon_state) + item_state = initial(item_state) + body_parts_covered = HEAD|EYES + to_chat(user, SPAN_NOTICE("You flip down the pilot visor.")) + sound_to(user, 'sound/items/goggles_charge.ogg') + check_hud_overlay(user) + update_clothing_icon() + user.update_action_buttons() + +/obj/item/clothing/head/helmet/pilot/dropped(mob/user) + . = ..() + check_hud_overlay(user) + +/obj/item/clothing/head/helmet/pilot/equipped(mob/user, slot, assisted_equip) + . = ..() + check_hud_overlay(user, slot) + +/obj/item/clothing/head/helmet/pilot/proc/check_hud_overlay(var/mob/user, var/equip_slot) + if(!user.client) + return + if(!equip_slot) + equip_slot = get_equip_slot() + if(!flipped_up && (equip_slot == slot_head)) + user.client.screen |= hud_overlay + else + user.client.screen -= hud_overlay + +/obj/item/clothing/head/helmet/pilot/proc/set_hud_maptext(var/text) + if(length(text) > 26) + hud_overlay.screen_loc = "CENTER:-80,NORTH:-6" // text longer than 26 usually breaks into two lines, we need to shift the screen_loc else it looks weird + else + hud_overlay.screen_loc = initial(screen_loc) + hud_overlay.maptext = SMALL_FONTS(7, "
[text]
") + +/obj/item/clothing/head/helmet/pilot/legion + name = "foreign legion flight helmet" + desc = "A helmet clearly belonging to a TCFL pilot, it has aged pilot visor mounted to it. The visor feeds its wearer in-flight information via a heads-up display." + icon_state = "legion_pilot" + item_state = "legion_pilot" + camera = /obj/machinery/camera/network/tcfl + +/obj/pilot_overlay_holder + name = null + icon = null + icon_state = null + screen_loc = "CENTER:-80,NORTH" + maptext_width = 192 \ No newline at end of file diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index f8b4fb4d1a0..c2983407ae3 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -7,6 +7,7 @@ var/list/shuttle_area //can be both single area type or a list of areas var/obj/effect/shuttle_landmark/current_location //This variable is type-abused initially: specify the landmark_tag, not the actual landmark. + var/list/shuttle_computers = list() var/arrive_time = 0 //the time at which the shuttle arrives when long jumping var/flags = 0 @@ -56,6 +57,10 @@ if(src.name in SSshuttle.shuttles) CRASH("A shuttle with the name '[name]' is already defined.") SSshuttle.shuttles[src.name] = src + for(var/obj/machinery/computer/shuttle_control/SC as anything in SSshuttle.lonely_shuttle_computers) + if(SC.shuttle_tag == name) + SSshuttle.lonely_shuttle_computers -= SC + shuttle_computers += SC if(flags & SHUTTLE_FLAGS_PROCESS) SSshuttle.process_shuttles += src if(flags & SHUTTLE_FLAGS_SUPPLY) @@ -284,3 +289,8 @@ if(!next_location) return "None" return next_location.name + +/datum/shuttle/proc/set_process_state(var/new_state) + process_state = new_state + for(var/obj/machinery/computer/shuttle_control/SC as anything in shuttle_computers) + SC.update_helmets(src) \ No newline at end of file diff --git a/code/modules/shuttles/shuttle_autodock.dm b/code/modules/shuttles/shuttle_autodock.dm index bd106f092f9..f951bcce834 100644 --- a/code/modules/shuttles/shuttle_autodock.dm +++ b/code/modules/shuttles/shuttle_autodock.dm @@ -90,9 +90,9 @@ //*** ready to go if(next_location.is_valid(src)) process_launch() - process_state = WAIT_ARRIVE + set_process_state(WAIT_ARRIVE) else - process_state = IDLE_STATE + set_process_state(IDLE_STATE) in_use = null if (FORCE_LAUNCH) @@ -102,12 +102,12 @@ if (moving_status == SHUTTLE_IDLE) //*** we made it to the destination, update stuff process_arrived() - process_state = WAIT_FINISH + set_process_state(WAIT_FINISH) if (WAIT_FINISH) if (world.time > last_dock_attempt_time + DOCK_ATTEMPT_TIMEOUT || check_docked()) //*** all done here - process_state = IDLE_STATE + set_process_state(IDLE_STATE) arrived() //not to be confused with the arrived() proc @@ -128,14 +128,14 @@ /datum/shuttle/autodock/proc/process_launch() if(!next_location.is_valid(src) || current_location.cannot_depart(src)) - process_state = IDLE_STATE + set_process_state(IDLE_STATE) in_use = null return if (get_travel_time() && landmark_transition) . = long_jump(next_location, landmark_transition, get_travel_time()) else . = short_jump(next_location) - process_state = WAIT_ARRIVE + set_process_state(WAIT_ARRIVE) /* Guards @@ -158,7 +158,7 @@ in_use = user //obtain an exclusive lock on the shuttle - process_state = WAIT_LAUNCH + set_process_state(WAIT_LAUNCH) undock() /datum/shuttle/autodock/proc/force_launch(var/user) @@ -167,13 +167,13 @@ in_use = user //obtain an exclusive lock on the shuttle - process_state = FORCE_LAUNCH + set_process_state(FORCE_LAUNCH) /datum/shuttle/autodock/proc/cancel_launch(var/user) if (!can_cancel()) return moving_status = SHUTTLE_IDLE - process_state = WAIT_FINISH + set_process_state(WAIT_FINISH) in_use = null //whatever we were doing with docking: stop it, then redock diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index 64bd633657f..da50f50a85f 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -8,6 +8,41 @@ var/hacked = FALSE // Has been emagged, no access restrictions. var/ui_template = "shuttle_control_console.tmpl" + var/list/linked_helmets = list() + +/obj/machinery/computer/shuttle_control/Initialize() + . = ..() + if(SSshuttle.shuttles[shuttle_tag]) + var/datum/shuttle/shuttle = SSshuttle.shuttles[shuttle_tag] + shuttle.shuttle_computers += src + else + SSshuttle.lonely_shuttle_computers += src + +/obj/machinery/computer/shuttle_control/Destroy() + SSshuttle.lonely_shuttle_computers -= src + var/datum/shuttle/shuttle = SSshuttle.shuttles[shuttle_tag] + shuttle.shuttle_computers -= src + for(var/obj/item/clothing/head/helmet/pilot/PH as anything in linked_helmets) + PH.linked_console = null + return ..() + +/obj/machinery/computer/shuttle_control/attackby(obj/item/I, user) + if(istype(I, /obj/item/clothing/head/helmet/pilot)) + var/obj/item/clothing/head/helmet/pilot/PH = I + if(I in linked_helmets) + to_chat(user, SPAN_NOTICE("You unlink \the [I] from \the [src].")) + linked_helmets -= PH + PH.linked_console = null + PH.set_hud_maptext("Shuttle Status: No Shuttle Linked.") + else + to_chat(user, SPAN_NOTICE("You link \the [I] to \the [src].")) + if(PH.linked_console) + PH.linked_console.linked_helmets -= PH + linked_helmets += PH + PH.linked_console = src + PH.set_hud_maptext("Shuttle Status: [get_shuttle_status(SSshuttle.shuttles[shuttle_tag])]") + return + return ..() /obj/machinery/computer/shuttle_control/attack_hand(mob/user) ui_interact(user) @@ -28,26 +63,8 @@ if(SHUTTLE_WARMUP) shuttle_state = "warmup" if(SHUTTLE_INTRANSIT) shuttle_state = "in_transit" - var/shuttle_status - switch (shuttle.process_state) - if(IDLE_STATE) - var/cannot_depart = shuttle.current_location.cannot_depart(shuttle) - if (shuttle.in_use) - shuttle_status = "Busy." - else if(cannot_depart) - shuttle_status = cannot_depart - else - shuttle_status = "Standing-by at \the [shuttle.get_location_name()]." - - if(WAIT_LAUNCH, FORCE_LAUNCH) - shuttle_status = "Shuttle has recieved command and will depart shortly." - if(WAIT_ARRIVE) - shuttle_status = "Proceeding to \the [shuttle.get_destination_name()]." - if(WAIT_FINISH) - shuttle_status = "Arriving at destination now." - return list( - "shuttle_status" = shuttle_status, + "shuttle_status" = get_shuttle_status(shuttle), "shuttle_state" = shuttle_state, "has_docking" = shuttle.active_docking_controller? 1 : 0, "docking_status" = shuttle.active_docking_controller? shuttle.active_docking_controller.get_docking_status() : null, @@ -57,6 +74,24 @@ "can_force" = shuttle.can_force(), ) +/obj/machinery/computer/shuttle_control/proc/get_shuttle_status(var/datum/shuttle/autodock/shuttle) + switch(shuttle.process_state) + if(IDLE_STATE) + var/cannot_depart = shuttle.current_location.cannot_depart(shuttle) + if(shuttle.in_use) + . = "Busy." + else if(cannot_depart) + . = cannot_depart + else + . = "Standing-by at \the [shuttle.get_location_name()]." + + if(WAIT_LAUNCH, FORCE_LAUNCH) + . = "Shuttle has received a command and will depart shortly." + if(WAIT_ARRIVE) + . = "Proceeding to \the [shuttle.get_destination_name()]." + if(WAIT_FINISH) + . = "Arriving at destination now." + // This is a subset of the actual checks; contains those that give messages to the user. /obj/machinery/computer/shuttle_control/proc/can_move(var/datum/shuttle/autodock/shuttle, var/user) var/cannot_depart = shuttle.current_location.cannot_depart(shuttle) @@ -107,6 +142,11 @@ ..() handle_topic_href(SSshuttle.shuttles[shuttle_tag], href_list, usr) +/obj/machinery/computer/shuttle_control/proc/update_helmets(var/datum/shuttle/autodock/shuttle) + var/shuttle_status = get_shuttle_status(shuttle) + for(var/obj/item/clothing/head/helmet/pilot/PH as anything in linked_helmets) + PH.set_hud_maptext("Shuttle Status: [shuttle_status]") + /obj/machinery/computer/shuttle_control/emag_act(var/remaining_charges, var/mob/user) if(!hacked) req_access = list() diff --git a/html/changelogs/geeves-pilot_helmet.yml b/html/changelogs/geeves-pilot_helmet.yml new file mode 100644 index 00000000000..fc3e84fbf7c --- /dev/null +++ b/html/changelogs/geeves-pilot_helmet.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Flight helmets can now link to shuttle computers to give you a status readout on your main HUD, though the visor needs to be flipped down." \ No newline at end of file diff --git a/icons/clothing/head/pilot_helmets.dmi b/icons/clothing/head/pilot_helmets.dmi new file mode 100644 index 0000000000000000000000000000000000000000..5272261eab54161bf02e33d92cf65ee2c6778eb9 GIT binary patch literal 1125 zcmV-r1e*JaP)004jp0{{R3ySP)t-sz`(#O zD=RlQH!m+QK0ZDsCMFjb7at!VAt53E^>;`}NDvSZ8!bvCI$s_!Q7A!b7$`#z7%CJY zI29v1F8%*5OM3vYunQ6v7#A6i(jXWB0004WQchCV=-0C=2JR&a84_w-Y6@%7{?OD!tS%+FJ>RWQ*r;NmRLOex6#a*U0*I5Sc+(=$pS zoZ^zil2jm5sUR~aza%~*H77TXiBbp8ofGcqd*9&-*8Rta7pfmPCv0aV{WMhL*Wq;p^} zvtK%LW`nCpT18+A-4psxOeo22n zrIT1u6h%=KMfuC&a7mD>=YNIzTRaCJp?iD#g8a{e=;h*z^?8EEz&UQ|6*O=({{!)X zFV*L_UF%@LS4^*t<$oR<^kRMMeS1&npuz1{3Jn~}|8V}|y;%Rky?2gNI#6J{Go8%; zM5Owbr^X2#dSDwI=X(e9KhdC2e}xk|sMpW`_qVlXXt z64Dd5h)h6(X_`osI(Y7!NKfDU4p*?AKR>fj{lGa9ry%L4$+AD%W^4ej@_F3_a1m99 z&w(JF153D#w*YrRZNj5N`+s7Xw_O1A>LlvWl|IY7zm92_{bUl*tCJob`nCpT18+A- z4psxOeo22nzn;DoMNt$*QIvlW4wnSEdj40azr}MncZk#Yiu^C%_S9Q0*XId_0Oz=+ zSJ1%0{4dAd{D6Kg)aSR;m|(y+FC*RCh4kuJ{s;W64yF1r=RDpMI%sgal|loD@;{uv z