diff --git a/code/modules/admin/mission_control/mission_control.dm b/code/modules/admin/mission_control/mission_control.dm index fd02b1baa4..876a547828 100644 --- a/code/modules/admin/mission_control/mission_control.dm +++ b/code/modules/admin/mission_control/mission_control.dm @@ -47,6 +47,12 @@ .text{ padding: 5px; } + .coord { + color: #eb8de0; + } + .sector { + color: #9be7e8; + } @@ -242,24 +248,16 @@ for(var/obj/structure/shiptoship_master/sts_master_to_link in world) sts_master = sts_master_to_link break - var/new_map = tgui_alert(usr, "Do yo wish to destroy everything on the old map?", "REPLACE?", list("Yes","No"), timeout = 0) - if(new_map == null) new_map = "No" - switch(tgui_input_list(usr, "Select Template:","TEMPLATE select",list("Blank","Deploy the Amelia", "Deploy the Marie","Tester Targets","Escapees","Pursuers"),timeout = 0)) + switch(tgui_input_list(usr, "Select Template:","TEMPLATE select",list("Clear Board","Tester Set","Escapees","Pursuers"),timeout = 0)) if(null) return - if("Blank") + if("Clear Board") sts_master.clear_map() - if("Deploy the Amelia") - if(new_map == "Yes") sts_master.clear_map() + if("Tester Set") sts_master.add_entity(entity_type = 0, x = 3, y = 2, name = "UAS Amelia", type = "OV-PST Rapid Pursuit Interceptor", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 5, ship_shield = 2, ship_speed = 5, salvos = 2) - return - if("Deploy the Marie") - if(new_map == "Yes") sts_master.clear_map() - sts_master.add_entity(entity_type = 0, x = 4, y = 73, name = "UAS Amelia", type = "OV-PST Rapid Pursuit Interceptor", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 5, ship_shield = 2, ship_speed = 5, salvos = 2) - return - if("Tester Targets") - sts_master.add_entity(entity_type = 0, x = 7, y = 5, name = "Weapons Test Drone Alpha", type = "OV-PST Prototype Testing Drone", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 1, ship_shield = 0, ship_speed = 2, salvos = 0) - sts_master.add_entity(entity_type = 0, x = 2, y = 72, name = "Weapons Test Drone Beta", type = "OV-PST Prototype Testing Drone", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 1, ship_shield = 0, ship_speed = 2, salvos = 0) + sts_master.add_entity(entity_type = 0, x = 11, y = 5, name = "UAS Marie", type = "OV-PST Rapid Pursuit Interceptor", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 5, ship_shield = 2, ship_speed = 5, salvos = 2) + sts_master.add_entity(entity_type = 0, x = 21, y = 21, name = "Weapons Test Drone Alpha", type = "OV-PST Prototype Testing Drone", vector_x = 2, vector_y = 2, ship_status = "Operational", ship_faction = "UACM", ship_damage = 1, ship_shield = 0, ship_speed = 2, salvos = 0) + sts_master.add_entity(entity_type = 0, x = 91, y = 90, name = "Weapons Test Drone Beta", type = "OV-PST Prototype Testing Drone", vector_x = -2, vector_y = -2, ship_status = "Operational", ship_faction = "UACM", ship_damage = 1, ship_shield = 0, ship_speed = 2, salvos = 0) if("Escapees") sts_master.add_entity(entity_type = 0, x = 52, y = 98, name = "TPS Workers Glory", type = "Chelyabinsk Class Heavy Transport", vector_x = 0, vector_y = -3, ship_status = "Operational", ship_faction = "UPP", ship_damage = 10, ship_shield = 0, ship_speed = 3, salvos = 0) if("Pursuers") diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm index 827f9427c8..24cdb91c7b 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -107,7 +107,8 @@ var/style = tgui_input_list(src, "Who do you want to play this to?", "Select Listeners", list("Globally", "Xenos", "Marines", "Ghosts", "All In View Range", "Single Mob")) var/sound_type = tgui_input_list(src, "What kind of sound is this?", "Select Sound Type", sound_type_list) sound_type = sound_type_list[sound_type] - var/display_title = tgui_input_list(src, "Display Title?", "Title Display", list("Yes", "No")) + var/display_title + display_title = tgui_input_list(src, "Display Title?", "Title Display", list("Yes", "No")) switch(style) if("Globally") @@ -178,6 +179,7 @@ music_extra_data["title"] = tgui_input_text(usr, "Enter song Title. Leave blank for unknown.", "Title input", timeout = 0) music_extra_data["artist"] = tgui_input_text(usr, "Enter song Artist. Leave blank for unknown.", "Artist input", timeout = 0) music_extra_data["album"] = tgui_input_text(usr, "Enter song Album. Leave blank for unknown.","Album input", timeout = 0) + var/display_blurb_indicator = tgui_alert(usr, "Show title blurb?", "Blurb", list("No","Yes"), timeout = 0) if(music_extra_data["title"] == null) music_extra_data["title"] = web_sound_url if(music_extra_data["artist"] == null) music_extra_data["artist"] = "Unknown Artist" if(music_extra_data["album"] == null) music_extra_data["album"] = "Unknown Album" @@ -186,7 +188,7 @@ for(var/mob/mob as anything in targets) var/client/client = mob?.client if((client?.prefs?.toggles_sound & SOUND_MIDI) && (client?.prefs?.toggles_sound & SOUND_ADMIN_ATMOSPHERIC)) - if(tgui_alert(usr, "Show title blurb?", "Blurb", list("No","Yes"), timeout = 0) == "Yes") show_blurb_song(title = music_extra_data["title"], additional = "[music_extra_data["artist"]] - [music_extra_data["album"]]") + if(display_blurb_indicator == "Yes") show_blurb_song(title = music_extra_data["title"], additional = "[music_extra_data["artist"]] - [music_extra_data["album"]]") client?.tgui_panel?.play_music(web_sound_url, music_extra_data) else client?.tgui_panel?.stop_music() diff --git a/code/modules/shiptoship/ship/probe_control.dm b/code/modules/shiptoship/ship/probe_control.dm index a2a3712996..b9ec8da255 100644 --- a/code/modules/shiptoship/ship/probe_control.dm +++ b/code/modules/shiptoship/ship/probe_control.dm @@ -1,6 +1,6 @@ /obj/item/ship_probe - name = "EYE-7 probe" - desc = "A see-through tube containing electronic systems tied to an antenna that seems to gently glow." + name = "EYE-7 cartrige" + desc = "A see-through tube containing three bundles of slightly glowing electronics wrapped around small antennas." desc_lore = "EYE-7 probes are designed to interface with the OV-PST's unique battlefield overview system and provide a direct, grid-based feed of an area of operations to all ships linked to the PST's so called Mission Control system. The probes effectively provide a focusing point for the stations' unique artificial intelligence that allows it to feed precise, position-based information which gives unprecedented battlefield orientation capabilities compared to currently used technology." icon = 'icons/sectorpatrol/ship/probe.dmi' icon_state = "probe" @@ -23,7 +23,7 @@ /obj/structure/ship_elements/probe_launcher/proc/LaunchContent() emoteas("Launches its contets with a loud swoosh!") playsound(src, 'sound/effects/bamf.ogg', 25) - probe_loaded = 0 + probe_loaded -= 1 /obj/structure/ship_elements/probe_launcher/attackby(obj/item/W, mob/user) if(repair_shutdown == 1) @@ -33,14 +33,14 @@ to_chat(usr, SPAN_WARNING("You have no idea how to use these two together.")) return if(istype(W, /obj/item/ship_probe)) - if(probe_loaded == 1) - to_chat(usr, SPAN_WARNING("A probe is already loaded.")) + if(probe_loaded > 1) + to_chat(usr, SPAN_WARNING("A cartrige is still loaded in the device.")) return if(probe_loaded == 0) usr.visible_message(SPAN_INFO("[usr] starts to reload the probe launcher."), SPAN_INFO("You start to reload the probe launcher"), SPAN_WARNING("You hear loud, mechanic clicking!")) if(do_after(usr, 20, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) - usr.visible_message(SPAN_INFO("[usr] reloads the probe launcher."), SPAN_INFO("The probe slides into the tube and an audible click is heard."), SPAN_WARNING("The clicking stops after a beep.")) - probe_loaded = 1 + usr.visible_message(SPAN_INFO("[usr] reloads the probe launcher."), SPAN_INFO("The cartridge slides into the tube and an audible click is heard."), SPAN_WARNING("The clicking stops after a beep.")) + probe_loaded = 3 qdel(W) return return diff --git a/code/modules/shiptoship/ship/ship_command_chair.dm b/code/modules/shiptoship/ship/ship_command_chair.dm index b3591ea965..be6bbb81a6 100644 --- a/code/modules/shiptoship/ship/ship_command_chair.dm +++ b/code/modules/shiptoship/ship/ship_command_chair.dm @@ -96,6 +96,12 @@ .text{ padding: 5px; } + .coord { + color: #eb8de0; + } + .sector { + color: #9be7e8; + } "} @@ -121,17 +127,22 @@ var/round_history if(linked_master_console.local_round_log_full.len == 0) round_history = "No Sonar history in buffer." if(linked_master_console.local_round_log_full.len != 0) round_history = jointext(linked_master_console.local_round_log_full, "

") + var/displayed_ping_history + if(linked_master_console.ping_history.len == 0) displayed_ping_history = "No Ping history in buffer." + if(linked_master_console.ping_history.len != 0) displayed_ping_history = jointext(linked_master_console.ping_history, "

") window_size="700x500" - dat +={"

Sonar Activity History Buffer:

+ dat +={"

Sonar Activity History:

[round_history]

+

Probe Ping History:

+

[displayed_ping_history]

"} if("pings_and_tracking") window_size="500x500" var/activity_summary var/list/pings_and_tracking = list() pings_and_tracking.Add("PINGS") - if(linked_master_console.ping_history.len == 0) pings_and_tracking.Add("No ping history.") - if(linked_master_console.ping_history.len != 0) pings_and_tracking.Add(jointext(linked_master_console.ping_history, "

")) + if(linked_master_console.current_pings.len == 0) pings_and_tracking.Add("No ping history.") + if(linked_master_console.current_pings.len != 0) pings_and_tracking.Add(jointext(linked_master_console.current_pings, "

")) pings_and_tracking.Add("TRACKING") pings_and_tracking.Add(jointext(linked_master_console.GetTrackingList(), "

")) var/pings_and_tracking_output = jointext(pings_and_tracking, "

") @@ -277,7 +288,7 @@ . = ..() if(usr == buckled_mob) to_chat(usr, SPAN_INFO("Use the console with HELP or DISARM intent to open the sonar activity screen.")) - to_chat(usr, SPAN_INFO("Use the console with GRAB or HARM intent to open the sonar activity history buffer screen.")) + to_chat(usr, SPAN_INFO("Use the console with GRAB or HARM intent to open the sonar and ping history buffer screen.")) /obj/structure/ship_elements/command_monitor/front name = "front command monitor" diff --git a/code/modules/shiptoship/ship/ship_mission_control.dm b/code/modules/shiptoship/ship/ship_mission_control.dm index ad9d461ab9..dd0b9a9f7f 100644 --- a/code/modules/shiptoship/ship/ship_mission_control.dm +++ b/code/modules/shiptoship/ship/ship_mission_control.dm @@ -29,6 +29,8 @@ var/list/local_round_log_moves = list() var/list/local_round_log_full = list() var/list/ping_history = list() + var/list/current_pings = list() + var/list/ping_ids = list() var/list/comms_messages = list() light_system = HYBRID_LIGHT light_color = "#660166" @@ -202,37 +204,49 @@ current_tracker_pos += 1 -/obj/structure/shiptoship_master/ship_missioncontrol/NextTurn() - local_round_log_full.Add("


TURN [GLOB.combat_round]
") - local_round_log_full.Add(local_round_log) - linked_command_chair.open_command_window("round_history") - local_round_log = null - local_round_log = list() - SyncPosToMap() - TrackerUpdate() - if(sector_map[sector_map_data["x"]][sector_map_data["y"]]["ship"]["shield"] < 2) sector_map[sector_map_data["x"]][sector_map_data["y"]]["ship"]["shield"] += 1 - INVOKE_ASYNC(linked_signals_console,TYPE_PROC_REF(/obj/structure/terminal/signals_console/, SetUsageData),0) - INVOKE_ASYNC(linked_weapons_console,TYPE_PROC_REF(/obj/structure/terminal/weapons_console/, SetUsageData),0) - INVOKE_ASYNC(linked_control_pad,TYPE_PROC_REF(/obj/structure/ship_elements/control_pad/, SetUsageData),0) - INVOKE_ASYNC(linked_damage_console,TYPE_PROC_REF(/obj/structure/terminal/damage_console/, SetUsageData),0,null) - return 1 +/obj/structure/shiptoship_master/ship_missioncontrol/NextTurn(status = null) + switch(status) + if(null) + return + if(0) + local_round_log_full.Add("
TURN [GLOB.combat_round]
") + local_round_log_full.Add(local_round_log) + ping_history.Add("
TURN [GLOB.combat_round]
") + ping_history.Add(current_pings) + linked_command_chair.open_command_window("round_history") + current_pings = list() + ping_ids = list() + local_round_log = list() + local_round_log_moves = list() + return 1 + if(1) + SyncPosToMap() + TrackerUpdate() + if(sector_map[sector_map_data["x"]][sector_map_data["y"]]["ship"]["shield"] < 2) sector_map[sector_map_data["x"]][sector_map_data["y"]]["ship"]["shield"] += 1 + INVOKE_ASYNC(linked_signals_console,TYPE_PROC_REF(/obj/structure/terminal/signals_console/, SetUsageData),0) + INVOKE_ASYNC(linked_weapons_console,TYPE_PROC_REF(/obj/structure/terminal/weapons_console/, SetUsageData),0) + INVOKE_ASYNC(linked_control_pad,TYPE_PROC_REF(/obj/structure/ship_elements/control_pad/, SetUsageData),0) + INVOKE_ASYNC(linked_damage_console,TYPE_PROC_REF(/obj/structure/terminal/damage_console/, SetUsageData),0,null) + return 1 /obj/structure/shiptoship_master/ship_missioncontrol/proc/PingLog(entity_type = 0, pos_x = 0, pos_y = 0, name = "none", type = "none", target_x = 0, target_y = 0, speed = 0, hp = 0, faction = "none") switch(entity_type) if(1) - ping_history.Add("[GLOB.combat_round]|([pos_x],[pos_y]) | Ship [name] - [type] | IFF: [faction]
Vector:([target_x],[target_y]) Max: [speed] | Integrity: [hp])") + current_pings.Add({"([pos_x],[pos_y]) | Ship [name] - [type] | IFF: [faction]
Vector:([target_x],[target_y]) Max: [speed] | Integrity: [hp])"}) + if(ping_ids.Find(sector_map[pos_x][pos_y]["ship"]["id_tag"]) == 0) ping_ids.Add(sector_map[pos_x][pos_y]["ship"]["id_tag"]) if(2) - ping_history.Add("[GLOB.combat_round]|([pos_x],[pos_y]) | Pojectile [name] | Warhead: [type]
Payload: [hp] | Target:([target_x],[target_y]) | Velocity: [speed]") + current_pings.Add({"([pos_x],[pos_y]) | Pojectile [name] | Warhead: [type]
Payload: [hp] | Target:([target_x],[target_y]) | Velocity: [speed]"}) + if(ping_ids.Find(sector_map[pos_x][pos_y]["missile"]["id_tag"]) == 0) ping_ids.Add(sector_map[pos_x][pos_y]["missile"]["id_tag"]) if(3) - ping_history.Add("[GLOB.combat_round]|([pos_x],[pos_y]) | Unknown Ship: Bearing: [type] | Velocity: [speed]") + current_pings.Add({"([pos_x],[pos_y])| Unknown Ship: Bearing: [type] | Velocity: [speed]"}) if(4) - ping_history.Add("[GLOB.combat_round]|([pos_x],[pos_y]) | Unknown Projectile Bearing: [type] | Velocity: [speed]") + current_pings.Add({"([pos_x],[pos_y]) | Unknown Projectile Bearing: [type] | Velocity: [speed]"}) linked_command_chair.open_command_window("pings_and_tracking") -/obj/structure/shiptoship_master/ship_missioncontrol/proc/ScannerPing(incoming_console as obj, probe_target_x = 0, probe_target_y = 0, range = 0) +/obj/structure/shiptoship_master/ship_missioncontrol/proc/ScannerPing(incoming_console as obj, probe_target_x = 0, probe_target_y = 0) var/obj/structure/terminal/signals_console/target_console = incoming_console - var/x_to_target_scan = target_console.linked_master_console.sector_map_data["x"] + probe_target_x - var/y_to_target_scan = target_console.linked_master_console.sector_map_data["y"] + probe_target_y + var/x_to_target_scan = probe_target_x + var/y_to_target_scan = probe_target_y if(x_to_target_scan < 1 || x_to_target_scan > GLOB.sector_map_x) target_console.terminal_display_line("Error: X coordinate outside of Twilight Boudary. Probe lost.") target_console.usage_data["ping_uses_current"] += 1 @@ -242,12 +256,6 @@ target_console.usage_data["ping_uses_current"] += 1 return 1 target_console.terminal_display_line("Connection to probe established. Reading data...", TERMINAL_LOOKUP_SLEEP) - var/scan_boundary_x_min = BoundaryAdjust(x_to_target_scan - range, type = 1) - var/scan_boundary_y_min = BoundaryAdjust(y_to_target_scan - range, type = 1) - var/scan_boundary_x_max = BoundaryAdjust(x_to_target_scan + range, type = 2) - var/scan_boundary_y_max = BoundaryAdjust(y_to_target_scan + range, type = 3) - var/current_scan_pos_x = scan_boundary_x_min - var/current_scan_pos_y = scan_boundary_y_min if(sector_map[x_to_target_scan][y_to_target_scan]["ship"]["id_tag"] != "none") target_console.terminal_display_line("Probe reports presence of a ship in its sector. Querrying Pythia.", TERMINAL_LOOKUP_SLEEP) target_console.terminal_display_line("Pythia reports entity as \"[sector_map[x_to_target_scan][y_to_target_scan]["ship"]["name"]]\"") @@ -256,45 +264,52 @@ target_console.terminal_display_line("Hull Integrity Readout: [sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["HP"] - (sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["hull"] + sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["weapons"] + sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["systems"] + sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["engines"])], Shield: [sector_map[x_to_target_scan][y_to_target_scan]["ship"]["shield"]]") PingLog(entity_type = 1, pos_x = x_to_target_scan, pos_y = y_to_target_scan ,name = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["name"], type = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["type"], target_x = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["vector"]["x"], target_y = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["vector"]["y"], speed = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["vector"]["speed"], hp = (sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["HP"] - (sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["hull"] + sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["weapons"] + sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["systems"] + sector_map[x_to_target_scan][y_to_target_scan]["ship"]["damage"]["engines"])), faction = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["faction"]) if(sector_map[x_to_target_scan][y_to_target_scan]["ship"]["status"] == "player") target_console.terminal_display_line("Upsilon-Pythia Node detected. This is an OV-PST Test Crew vessel.") + if(sector_map[x_to_target_scan][y_to_target_scan]["ship"]["id_tag"] == "none") + target_console.terminal_display_line("No ship entities found at coordinates.", TERMINAL_LOOKUP_SLEEP) if(sector_map[x_to_target_scan][y_to_target_scan]["missile"]["id_tag"] != "none") target_console.terminal_display_line("Projectile leapfrog trace detected in probe sector. Querrying Pythia.", TERMINAL_LOOKUP_SLEEP) target_console.terminal_display_line("Projectile ID: \"[sector_map[x_to_target_scan][y_to_target_scan]["missile"]["type"]]\" relative velocity:[sector_map[x_to_target_scan][y_to_target_scan]["missile"]["speed"]].") target_console.terminal_display_line("Warhead type: [sector_map[x_to_target_scan][y_to_target_scan]["missile"]["warhead"]["type"]], Payload: [sector_map[x_to_target_scan][y_to_target_scan]["missile"]["warhead"]["payload"]].") target_console.terminal_display_line("Based on readout, the projectiles target is: ([sector_map[x_to_target_scan][y_to_target_scan]["missile"]["target"]["x"]],[sector_map[x_to_target_scan][y_to_target_scan]["missile"]["target"]["y"]]])") PingLog(entity_type = 2, pos_x = x_to_target_scan, pos_y = y_to_target_scan, name = sector_map[x_to_target_scan][y_to_target_scan]["missile"]["type"], type = sector_map[x_to_target_scan][y_to_target_scan]["missile"]["warhead"]["type"], hp = sector_map[x_to_target_scan][y_to_target_scan]["missile"]["warhead"]["payload"], target_x = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["vector"]["x"], target_y = sector_map[x_to_target_scan][y_to_target_scan]["ship"]["vector"]["y"], speed = sector_map[x_to_target_scan][y_to_target_scan]["missile"]["speed"]) - if(sector_map[x_to_target_scan][y_to_target_scan]["missile"]["target"]["tag"] != "none") target_console.terminal_display_line("missile is homing onto a specific target and may change its vector.") + target_console.terminal_display_line("Missile is homing onto a specific target and may change its vector.") + if(sector_map[x_to_target_scan][y_to_target_scan]["missile"]["target"]["tag"] == "none") + target_console.terminal_display_line("No missile entities found at coordinates.", TERMINAL_LOOKUP_SLEEP) + return 1 + +/obj/structure/shiptoship_master/ship_missioncontrol/proc/SweeperPing(incoming_console as obj, probe_target_x = 0, probe_target_y = 0) + var/obj/structure/terminal/signals_console/target_console = incoming_console + var/scan_boundary_x_min = (probe_target_x * 10) - 9 + var/scan_boundary_y_min = (probe_target_y * 10) - 9 + var/scan_boundary_x_max = probe_target_x * 10 + var/scan_boundary_y_max = probe_target_y * 10 + var/current_scan_pos_x = scan_boundary_x_min + var/current_scan_pos_y = scan_boundary_y_min while(current_scan_pos_y <= scan_boundary_y_max) while(current_scan_pos_x <= scan_boundary_x_max) - if((current_scan_pos_x == x_to_target_scan) && (current_scan_pos_y == y_to_target_scan)) - current_scan_pos_x += 1 - continue - if((abs(x_to_target_scan - current_scan_pos_x) + abs(y_to_target_scan - current_scan_pos_y)) <= range) - - var/saved_len = target_console.terminal_buffer.len - if(sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["id_tag"] != "none") - target_console.terminal_display_line("Coordinate: ([current_scan_pos_x]),([current_scan_pos_y]) - CONTACT", 10) - target_console.terminal_display_line("Sound consistant with ship engine movement.",2) - target_console.terminal_display_line("Bearing: [ReturnBearing(sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"], sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"])], Velocity: [sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"] + sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"]]",10) - PingLog(entity_type = 3, pos_x = current_scan_pos_x, pos_y = current_scan_pos_y, type = ReturnBearing(sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"], sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"]), speed = sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"] + sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"]) - if(sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["id_tag"] != "none") - if(saved_len == target_console.terminal_buffer.len) target_console.terminal_display_line("Coordinate: ([current_scan_pos_x]),([current_scan_pos_y]) - CONTACT",10) - target_console.terminal_display_line("Contact. Projectile leapfrog trace detected.",2) - target_console.terminal_display_line("Bearing: [ReturnBearing((sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["x"] - current_scan_pos_x), (sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["y"] - current_scan_pos_y))], Velocity: [sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["speed"]]", 10) - PingLog(entity_type = 4, pos_x = current_scan_pos_x, pos_y = current_scan_pos_y, type = ReturnBearing((sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["x"] - current_scan_pos_x), (sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["y"] - current_scan_pos_y)), speed = sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["speed"]) - if(saved_len == target_console.terminal_buffer.len) target_console.terminal_display_line("Coordinate: ([current_scan_pos_x]),([current_scan_pos_y]): No contacts.",2) + var/saved_len = target_console.terminal_buffer.len + if(sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["id_tag"] != "none") + target_console.terminal_display_line("Coordinate: ([current_scan_pos_x]),([current_scan_pos_y]) - CONTACT", 10) + target_console.terminal_display_line("Sound consistant with ship engine movement.",2) + target_console.terminal_display_line("Bearing: [ReturnBearing(sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"], sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"])], Velocity: [sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"] + sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"]]",10) + PingLog(entity_type = 3, pos_x = current_scan_pos_x, pos_y = current_scan_pos_y, type = ReturnBearing(sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"], sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"]), speed = sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["x"] + sector_map[current_scan_pos_x][current_scan_pos_y]["ship"]["vector"]["y"]) + if(sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["id_tag"] != "none") + if(saved_len == target_console.terminal_buffer.len) target_console.terminal_display_line("Coordinate: ([current_scan_pos_x]),([current_scan_pos_y]) - CONTACT",10) + target_console.terminal_display_line("Contact. Projectile leapfrog trace detected.",2) + target_console.terminal_display_line("Bearing: [ReturnBearing((sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["x"] - current_scan_pos_x), (sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["y"] - current_scan_pos_y))], Velocity: [sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["speed"]]", 10) + PingLog(entity_type = 4, pos_x = current_scan_pos_x, pos_y = current_scan_pos_y, type = ReturnBearing((sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["x"] - current_scan_pos_x), (sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["target"]["y"] - current_scan_pos_y)), speed = sector_map[current_scan_pos_x][current_scan_pos_y]["missile"]["speed"]) current_scan_pos_x += 1 current_scan_pos_x = scan_boundary_x_min current_scan_pos_y += 1 target_console.usage_data["ping_uses_current"] += 1 - return 1 /obj/structure/shiptoship_master/ship_missioncontrol/proc/SectorConversion(x = 0, y = 0) // Converts coords to map sector. If coordinates do not line up, even sectors should get the extra row. var/x_to_sectorconvert = x var/y_to_sectorconvert = y if(x_to_sectorconvert < 1 || x_to_sectorconvert > GLOB.sector_map_x || y_to_sectorconvert < 1 || y_to_sectorconvert > GLOB.sector_map_y) return "out_of_bounds" - var/sector_to_return_x = floor(x_to_sectorconvert / (floor(GLOB.sector_map_x / GLOB.sector_map_sector_size))) - var/sector_to_return_y = floor(y_to_sectorconvert / (floor(GLOB.sector_map_y / GLOB.sector_map_sector_size))) + var/sector_to_return_x = ceil(x_to_sectorconvert / (ceil(GLOB.sector_map_x / GLOB.sector_map_sector_size))) + var/sector_to_return_y = ceil(y_to_sectorconvert / (ceil(GLOB.sector_map_y / GLOB.sector_map_sector_size))) var/value_to_return = "[sector_to_return_x]-[sector_to_return_y]" return value_to_return @@ -343,20 +358,20 @@ var/shiplog_coordinate_y = shiplog_dest_y switch(event_to_add_ship) if("collision_move") - local_round_log.Add("Ship engine pattern changes suggest a near-collision in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") + local_round_log.Add({"Ship engine pattern changes suggest a near-collision in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) if("collision_boundary") - local_round_log.Add("Emergency maneuvers and rapid engine deceleration detected on Twilight Boundary of Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)].") + local_round_log.Add({"Emergency maneuvers and rapid engine deceleration detected on Twilight Boundary of Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]."}) if("regular_move") - local_round_log.Add("Engine noise related to ship movement detected in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)].") - if(local_round_log_moves.Find("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") == 0) local_round_log_moves.Add("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") + local_round_log.Add({"Engine noise related to ship movement detected in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]."}) + if(local_round_log_moves.Find({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) == 0) local_round_log_moves.Add({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) if("missile_collision") - local_round_log.Add("Detonation detected after mulitple Projectile movement traces in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") + local_round_log.Add({"Detonation detected after mulitple Projectile movement traces in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) if("missile_move","warhead_miss","warhead_homing") - local_round_log.Add("Projectile leapfrog trace in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)].") - if(local_round_log_moves.Find("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") == 0) local_round_log_moves.Add("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") + local_round_log.Add({"Projectile leapfrog trace in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]."}) + if(local_round_log_moves.Find({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) == 0) local_round_log_moves.Add({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) if("warhead_hit", "explosive_splash") - local_round_log.Add("Warhead explosion detected in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") - if(local_round_log_moves.Find("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") == 0) local_round_log_moves.Add("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") + local_round_log.Add({"Warhead explosion detected in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) + if(local_round_log_moves.Find({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) == 0) local_round_log_moves.Add({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) if("hit_shield") local_round_log.Add("Deflector shield impact detected.") if("shield_break") @@ -372,24 +387,24 @@ if("destroy_hull") local_round_log.Add("Cascading hull breach detected. Partial ship fragmentation and high casualty event expected.") if("nuclear_hit") - local_round_log.Add("WARNING: Nuclear detonation detected in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!") - if(local_round_log_moves.Find("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") == 0) local_round_log_moves.Add("[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") + local_round_log.Add({"WARNING: Nuclear detonation detected in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!"}) + if(local_round_log_moves.Find({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) == 0) local_round_log_moves.Add({"[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) if("mip_deploy") - local_round_log.Add("MIP Warhead reports deploying its payload in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!") + local_round_log.Add({"MIP Warhead reports deploying its payload in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!"}) if("mip_payload_fail") - local_round_log.Add("MIP Warhead reports failure to deploy its payload due to misconfiguration in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]") + local_round_log.Add({"MIP Warhead reports failure to deploy its payload due to misconfiguration in Sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]"}) if("mip_warhead_hit") local_round_log.Add("A MIP projectile impact detected.") if("npc_sonar_hit") - local_round_log.Add("A conventional sonar pulse is targetting this vessel. Origin sector: [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!") + local_round_log.Add({"A conventional sonar pulse is targetting this vessel. Origin sector: [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!"}) if("npc_sonar_miss") local_round_log.Add("Conventional sonar activity detected in system.") if("missile_launch") - local_round_log.Add("Missile launch detected in sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!") + local_round_log.Add({"Missile launch detected in sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!"}) if("missile_own_launch") local_round_log.Add("Missile launched from own vessel.") if("secondary_fire") - local_round_log.Add("Secondary fire detected in sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!") + local_round_log.Add({"Secondary fire detected in sector [SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]!"}) if("secondary_own_fire") local_round_log.Add("Secondary fire from own vessel.") if("secondary_hit") diff --git a/code/modules/shiptoship/ship/ship_weapons_stores.dm b/code/modules/shiptoship/ship/ship_weapons_stores.dm new file mode 100644 index 0000000000..8c16fc12fd --- /dev/null +++ b/code/modules/shiptoship/ship/ship_weapons_stores.dm @@ -0,0 +1,91 @@ +/obj/structure/ship_elements/weapon_store + name = "Primary weapon storage" + desc = "A sealed, heavy looking metal hatch." + desc_lore = "Munitions, explosives, sensitive replacement and other valuable or potentially hazardous but not biohazardous substances are typically stored in secured cargo bays like this one. This model utilizes a set of shelves, robot arms and conveyor belts to move the cargo from within the ship hull and onto the platform, which then lifts the cargo up." + icon = 'icons/sectorpatrol/ship/cargo_bay.dmi' + icon_state = "cargo_bay_closed" + var/current_items = 40 + var/items_max = 40 + var/stored_ammo_path + var/stored_ammo_type + var/repair_shutdown = 0 + var/ship_name + var/bay_number = 1 + +/obj/structure/ship_elements/weapon_store/proc/AnimateUse(state = null) + var/state_to_animate = state + if(state_to_animate == null) + switch(icon_state) + if("cargo_bay_open") + state_to_animate = "close" + if("cargo_bay_closed") + state_to_animate = "open" + switch(state_to_animate) + if("open") + icon_state = "cargo_bay_opening" + update_icon() + sleep(40) + icon_state = "cargo_bay_open" + update_icon() + if("close") + icon_state = "cargo_bay_closing" + update_icon() + sleep(12) + icon_state = "cargo_bay_closed" + update_icon() + +/obj/structure/ship_elements/weapon_store/proc/DispenseObject(object_to_dispense as obj) + if(object_to_dispense == null) return + AnimateUse(state = "open") + new object_to_dispense(get_turf(src)) + sleep(50) + AnimateUse(state = "close") + return 1 + +/obj/structure/ship_elements/weapon_store/proc/RecieveObject(object_to_recieve as obj) + if(object_to_recieve == null) return + var/obj/recieved_object = object_to_recieve + overlays += image(recieved_object.icon,src,recieved_object.icon_state, recieved_object.layer) + qdel(recieved_object) + AnimateUse(state = "open") + sleep(20) + overlays.Cut() + AnimateUse(state = "close") + return 1 + +/obj/structure/ship_elements/weapon_store/attackby(obj/item/W, mob/user) + if(repair_shutdown == 1) + to_chat(usr, SPAN_WARNING("An emergency shutdown is in effect and this bay is inoperable.")) + return + if(istype(W, /obj/item/powerloader_clamp)) + var/obj/item/powerloader_clamp/PC = W + if(!PC.linked_powerloader) + qdel(PC) + return + if(PC.loaded) + if(!istype(PC.loaded, /obj/structure/ship_elements/missile_ammo)) + to_chat(user, SPAN_WARNING("There is no way you can put \the [PC.loaded] into \the [src]!")) + return + else + if(current_items >= items_max) + to_chat(usr, SPAN_WARNING("This storage bay is full!")) + return + var/obj/structure/ship_elements/missile_ammo/ammo_to_take = PC.loaded + if(ammo_to_take.missile_type == stored_ammo_type || ammo_to_take.warhead_type == stored_ammo_type) + to_chat(usr, SPAN_INFO("A platform extends from the bay and you deposit the [PC.loaded] there.")) + RecieveObject(PC.loaded) + current_items += 1 + else + to_chat(usr, SPAN_WARNING("This bay does not accept that kind of ammo!")) + else + if(current_items == 0) + to_chat(usr, SPAN_WARNING("This bay is empty.")) + return + if(!do_after(user, 20, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_GENERIC)) + return + to_chat(usr, SPAN_INFO("You stop the walker on a pressure plate in front of the dispenser.")) + DispenseObject(stored_ammo_path) + current_items -= 1 + else + to_chat(usr, SPAN_WARNING("The pressure plates in the bays respond only to the weight of crewed walkers.")) + return diff --git a/code/modules/shiptoship/sts_master.dm b/code/modules/shiptoship/sts_master.dm index 545f82d651..0b3882a053 100644 --- a/code/modules/shiptoship/sts_master.dm +++ b/code/modules/shiptoship/sts_master.dm @@ -304,19 +304,19 @@ round_history_current.Add("The [log_source_to_add] barely avoided a collision with the [log_target_to_add]!") return if("collision_move") - round_history_current.Add("The [log_source_to_add] reroutes towards coordinates ([x_to_move],[y_to_move]) during emergency maeouvers, losing some of its momentum.") + round_history_current.Add({"The [log_source_to_add] reroutes towards coordinates ([x_to_move],[y_to_move]) during emergency maeouvers, losing some of its momentum."}) return if("collision_boundary") round_history_current.Add("The [log_source_to_add] engages its emergency breaking thrusters as it reaches the Twilight Boundary and risks being consumed by the void. It's now in a dead stop!") return if("regular_move") - round_history_current.Add("The [log_source_to_add] arrives at its destination at coordinates ([x_to_move],[y_to_move]).") + round_history_current.Add({"The [log_source_to_add] arrives at its destination at coordinates ([x_to_move],[y_to_move])."}) return if("missile_collision") round_history_current.Add("Projectiles [log_source_to_add] and [log_target_to_add] detonate each other as they leapfrog out of Hyperspace in close proximity.") return if("missile_move") - round_history_current.Add("Projectile [log_source_to_add] leapfrogs to coordinates ([x_to_move],[y_to_move]).") + round_history_current.Add({"Projectile [log_source_to_add] leapfrogs to coordinates ([x_to_move],[y_to_move])."}) return if("missile_near_target") round_history_current.Add("The projectile will reach its target next round!") @@ -367,22 +367,22 @@ round_history_current.Add("Projectile [log_source_to_add] is anihilated in an explosion!") return if("explosive_splash") - round_history_current.Add("Projectile [log_source_to_add] explodes at coordinates ([x_to_move],[y_to_move])!") + round_history_current.Add({"Projectile [log_source_to_add] explodes at coordinates ([x_to_move],[y_to_move])!"}) return if("warhead_miss") - round_history_current.Add("Projectile [log_source_to_add] fails to hit anything at coordinates ([x_to_move],[y_to_move]) and flies off into the void.") + round_history_current.Add({"Projectile [log_source_to_add] fails to hit anything at coordinates ([x_to_move],[y_to_move]) and flies off into the void."}) return if("nuclear_hit") - round_history_current.Add("Projectile [log_source_to_add] reaches its target at coordinates ([x_to_move],[y_to_move]). The [log_target_to_add] and its crew perishes in a nuclear blast!") + round_history_current.Add({"Projectile [log_source_to_add] reaches its target at coordinates ([x_to_move],[y_to_move]). The [log_target_to_add] and its crew perishes in a nuclear blast!"}) return if("mip_deploy") - round_history_current.Add("MIP Warhead [log_source_to_add] deploys at coordinates ([x_to_move],[y_to_move])") + round_history_current.Add({"MIP Warhead [log_source_to_add] deploys at coordinates ([x_to_move],[y_to_move])"}) return if("mip_payload_fail") - round_history_current.Add("MIP Warhead [log_source_to_add] fails to deply at coordiates ([x_to_move],[y_to_move]) due to a low payload.") + round_history_current.Add({"MIP Warhead [log_source_to_add] fails to deply at coordiates ([x_to_move],[y_to_move]) due to a low payload."}) return if("mip_warhead_hit") - round_history_current.Add("A MIP projectile hits [log_source_to_add] with a paylad of [x_to_move]!") + round_history_current.Add({"A MIP projectile hits [log_source_to_add] with a paylad of [x_to_move]!"}) return if("ship_move") round_history_current.Add("SHIP MOVEMENT:
") @@ -391,7 +391,7 @@ round_history_current.Add("PROJECTILE MOVEMENT AND DETONATION:
") return if("comms_ping") - round_history_current.Add("Comms ping sent from [log_source_to_add] to coordinates ([x_to_move],[y_to_move]): [log_target_to_add]") + round_history_current.Add({"Comms ping sent from [log_source_to_add] to coordinates ([x_to_move],[y_to_move]): [log_target_to_add]"}) if(sector_map[x_to_move][y_to_move]["ship"]["id_tag"] != "none") var/comms_recepient = "[sector_map[x_to_move][y_to_move]["ship"]["id_tag"]]-[sector_map[x_to_move][y_to_move]["ship"]["id_tag"]]" round_history_current.Add("The message was recieved by [comms_recepient]") @@ -405,13 +405,13 @@ round_history_current.Add("Conventional sonar pulse launched from [log_source_to_add] to [log_target_to_add] with the result [x_to_move].") return if("missile_launch") - round_history_current.Add("Missile launched by [log_source_to_add] at coordinates ([x_to_move],[y_to_move])") + round_history_current.Add({"Missile launched by [log_source_to_add] at coordinates ([x_to_move],[y_to_move])"}) return if("secondary_fire") - round_history_current.Add("The [log_source_to_add] fires its Secondary cannon at coordinates ([x_to_move],[y_to_move])") + round_history_current.Add({"The [log_source_to_add] fires its Secondary cannon at coordinates ([x_to_move],[y_to_move])"}) return if("passes_turn") - round_history_current.Add("The [log_source_to_add] at coordinates ([x_to_move],[y_to_move]) passes the rest of its combat turn and does not fire the rest of its salvoes.") + round_history_current.Add({"The [log_source_to_add] at coordinates ([x_to_move],[y_to_move]) passes the rest of its combat turn and does not fire the rest of its salvoes."}) return /obj/structure/shiptoship_master/proc/SaveLog() @@ -889,8 +889,7 @@ /obj/structure/shiptoship_master/proc/NextTurn() for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_mc_pre in world) if(ship_mc_pre.sector_map_data["initialized"] == 1) - ship_mc_pre.local_round_log_moves = null - ship_mc_pre.local_round_log_moves = list() + ship_mc_pre.NextTurn(0) var/len_to_test ProcessMovement(type = "ship") while(len_to_test != round_history_current.len) @@ -913,7 +912,7 @@ rem_entity(type = "special") for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_mc in world) if(ship_mc.sector_map_data["initialized"] == 1) - ship_mc.NextTurn() + ship_mc.NextTurn(1) /obj/structure/shiptoship_master/proc/scan_entites(category = 0, output_format = 0) // category = 0 for ships, 1 for missiles, 2 for specials. format = 0 text for screen display/ref lists. 1 creates buttons with references. diff --git a/code/modules/terminal/briefing/briefing.dm b/code/modules/terminal/briefing/briefing.dm index 4f3d7446bc..e2c028635d 100644 --- a/code/modules/terminal/briefing/briefing.dm +++ b/code/modules/terminal/briefing/briefing.dm @@ -14,7 +14,7 @@ header_name = "RDML. Thomas Boulette" var/op_info = "PST INTERCEPTOR PROTOTYPING" -/obj/structure/terminal/Initialize(mapload, ...) +/obj/structure/terminal/briefing/Initialize(mapload, ...) . = ..() icon_state = "off" update_icon() diff --git a/code/modules/terminal/ship/cargo.dm b/code/modules/terminal/ship/cargo.dm index 95a6abf34f..484c6b6372 100644 --- a/code/modules/terminal/ship/cargo.dm +++ b/code/modules/terminal/ship/cargo.dm @@ -11,8 +11,12 @@ var/ship_name var/repair_shutdown = 0 var/obj/structure/shiptoship_master/ship_missioncontrol/linked_master_console - var/list/linked_cargo_bays = list("primary_munitions" = /obj/structure/ship_elements/cargo_bay/primary_munitions, - "secondary_munitions" = /obj/structure/ship_elements/cargo_bay/secondary_munitions, + var/list/linked_weapons_bays = list("LD Homing" = /obj/structure/ship_elements/weapon_store, + "Direct" = /obj/structure/ship_elements/weapon_store, + "Accelerating Torpedo" = /obj/structure/ship_elements/weapon_store, + "Homing" = /obj/structure/ship_elements/weapon_store, + "Explosive" = /obj/structure/ship_elements/weapon_store, + "MIP" = /obj/structure/ship_elements/weapon_store, ) /obj/structure/terminal/cargo_console/proc/LinkToShipMaster(master_console as obj) @@ -21,18 +25,28 @@ var/list/area_contents = list() for(var/area/areas_to_scan in GLOB.sts_ship_areas) area_contents.Add(areas_to_scan.GetAllContents()) - for(var/obj/structure/ship_elements/cargo_bay/primary_bay_to_link in area_contents) - if(linked_master_console.sector_map_data["name"] == primary_bay_to_link.ship_name) - if(primary_bay_to_link.bay_id == "primary_munitions") - linked_cargo_bays["primary_munitions"] = primary_bay_to_link - to_chat(world, SPAN_INFO("Primary Munitions bay for [linked_master_console.sector_map_data["name"]] initiated.")) - break - for(var/obj/structure/ship_elements/cargo_bay/secondary_bay_to_link in area_contents) - if(linked_master_console.sector_map_data["name"] == secondary_bay_to_link.ship_name) - if(secondary_bay_to_link.bay_id == "secondary_munitions") - linked_cargo_bays["secondary_munitions"] = secondary_bay_to_link - to_chat(world, SPAN_INFO("Secondary Munitions bay for [linked_master_console.sector_map_data["name"]] initiated.")) - break + var/weapons_bay_counter = 0 + for(var/obj/structure/ship_elements/weapon_store/weapons_bay_to_link in area_contents) + if(weapons_bay_to_link.ship_name == ship_name) + if(weapons_bay_to_link.stored_ammo_type == "LD Homing") + linked_weapons_bays["LD Homing"] = weapons_bay_to_link + weapons_bay_counter += 1 + if(weapons_bay_to_link.stored_ammo_type == "Direct") + linked_weapons_bays["Direct"] = weapons_bay_to_link + weapons_bay_counter += 1 + if(weapons_bay_to_link.stored_ammo_type == "Accelerating Torpedo") + linked_weapons_bays["Accelerating Torpedo"] = weapons_bay_to_link + weapons_bay_counter += 1 + if(weapons_bay_to_link.stored_ammo_type == "Homing") + linked_weapons_bays["Homing"] = weapons_bay_to_link + weapons_bay_counter += 1 + if(weapons_bay_to_link.stored_ammo_type == "Explosive") + linked_weapons_bays["Explosive"] = weapons_bay_to_link + weapons_bay_counter += 1 + if(weapons_bay_to_link.stored_ammo_type == "MIP") + linked_weapons_bays["MIP"] = weapons_bay_to_link + weapons_bay_counter += 1 + to_chat(world, SPAN_INFO("[ship_name] weapons stores initalized. Stores found: [weapons_bay_counter]")) terminal_id = "[linked_master_console.sector_map_data["name"]][initial(terminal_id)]" item_serial = "[uppertext(linked_master_console.sector_map_data["name"])][initial(item_serial)]" header_name = "[linked_master_console.sector_map_data["name"]] CARGO CONTROL" @@ -46,159 +60,52 @@ if(1) repair_shutdown = 1 world << browse(null, "window=[terminal_id]") - var/obj/structure/ship_elements/cargo_bay/bay_to_shutdown = linked_cargo_bays["primary_munitions"] + var/obj/structure/ship_elements/weapon_store/bay_to_shutdown = linked_weapons_bays["LD Homing"] bay_to_shutdown.repair_shutdown = 1 - bay_to_shutdown = linked_cargo_bays["secondary_munitions"] + bay_to_shutdown = linked_weapons_bays["Direct"] + bay_to_shutdown.repair_shutdown = 1 + bay_to_shutdown = linked_weapons_bays["Accelerating Torpedo"] + bay_to_shutdown.repair_shutdown = 1 + bay_to_shutdown = linked_weapons_bays["Homing"] + bay_to_shutdown.repair_shutdown = 1 + bay_to_shutdown = linked_weapons_bays["Explosive"] + bay_to_shutdown.repair_shutdown = 1 + bay_to_shutdown = linked_weapons_bays["MIP"] bay_to_shutdown.repair_shutdown = 1 talkas("Warning. Critical damage recieved. Engaging emergency Hyperspace leapfrog.") return if(0) repair_shutdown = 0 talkas("Critical damage resolved. Lifting lockout.") - var/obj/structure/ship_elements/cargo_bay/bay_to_shutdown = linked_cargo_bays["primary_munitions"] + var/obj/structure/ship_elements/weapon_store/bay_to_shutdown = linked_weapons_bays["LD Homing"] + bay_to_shutdown.repair_shutdown = 0 + bay_to_shutdown = linked_weapons_bays["Direct"] + bay_to_shutdown.repair_shutdown = 0 + bay_to_shutdown = linked_weapons_bays["Accelerating Torpedo"] bay_to_shutdown.repair_shutdown = 0 - bay_to_shutdown = linked_cargo_bays["secondary_munitions"] + bay_to_shutdown = linked_weapons_bays["Homing"] + bay_to_shutdown.repair_shutdown = 0 + bay_to_shutdown = linked_weapons_bays["Explosive"] + bay_to_shutdown.repair_shutdown = 0 + bay_to_shutdown = linked_weapons_bays["MIP"] bay_to_shutdown.repair_shutdown = 0 return -/obj/structure/terminal/cargo_console/proc/terminal_advanced_parse(type = null, string = null) - if(type == null || string == null) return - switch(type) - if("RETR") - var/obj/structure/ship_elements/cargo_bay/bay_to_dispense = linked_cargo_bays["primary_munitions"] - switch(string) - if("M_H20") - if(bay_to_dispense.cargo_data["missile_pst_homing"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["missile_pst_homing"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/structure/ship_elements/missile_ammo/missile_homing) - terminal_display_line("[bay_to_dispense.cargo_data["missile_pst_homing"]] left in store.") - else - terminal_display_line("Error: Stock empty. Resupply recommended.") - if("M_D40") - if(bay_to_dispense.cargo_data["missile_pst_dumbfire"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["missile_pst_dumbfire"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/structure/ship_elements/missile_ammo/missile_dumbfire) - terminal_display_line("[bay_to_dispense.cargo_data["missile_pst_dumbfire"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - if("M_T05") - if(bay_to_dispense.cargo_data["missile_pst_torpedo"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["missile_pst_torpedo"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/structure/ship_elements/missile_ammo/missile_torpedo) - terminal_display_line("[bay_to_dispense.cargo_data["missile_pst_torpedo"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - if("W_D03") - if(bay_to_dispense.cargo_data["warhead_direct"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["warhead_direct"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/structure/ship_elements/missile_ammo/warhead_direct) - terminal_display_line("[bay_to_dispense.cargo_data["warhead_direct"]] left in store.") - else - terminal_display_line("Error: Stock empty. Resupply recommended.") - if("W_E02") - if(bay_to_dispense.cargo_data["missile_pst_homing"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["missile_pst_homing"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/structure/ship_elements/missile_ammo/missile_homing) - terminal_display_line("[bay_to_dispense.cargo_data["missile_pst_homing"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - if("W_M03") - if(bay_to_dispense.cargo_data["warhead_mip"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["warhead_mip"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/structure/ship_elements/missile_ammo/warhead_mip) - terminal_display_line("[bay_to_dispense.cargo_data["warhead_mip"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - bay_to_dispense = linked_cargo_bays["secondary_munitions"] - switch(string) - if("S-D02") - if(bay_to_dispense.cargo_data["secondary_direct"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["secondary_direct"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/item/ship_elements/secondary_ammo/direct) - terminal_display_line("[bay_to_dispense.cargo_data["secondary_direct"]] left in store.") - else - terminal_display_line("Error: Stock empty. Resupply recommended.") - if("S-E03") - if(bay_to_dispense.cargo_data["secondary_flak"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["secondary_flak"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/item/ship_elements/secondary_ammo/flak) - terminal_display_line("[bay_to_dispense.cargo_data["secondary_flak"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - if("S-B05") - if(bay_to_dispense.cargo_data["secondary_broadside"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["secondary_broadside"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/item/ship_elements/secondary_ammo/broadside) - terminal_display_line("[bay_to_dispense.cargo_data["secondary_broadside"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - if("X-P01") - if(bay_to_dispense.cargo_data["probe"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["probe"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/item/ship_probe) - terminal_display_line("[bay_to_dispense.cargo_data["probe"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - if("X-T01") - if(bay_to_dispense.cargo_data["tracker"] > 0) - to_chat(usr,SPAN_ADMIN("Dispensing.")) - bay_to_dispense.cargo_data["tracker"] -= 1 - INVOKE_ASYNC(bay_to_dispense,TYPE_PROC_REF(/obj/structure/ship_elements/cargo_bay, DispenseObject), /obj/item/ship_tracker) - terminal_display_line("[bay_to_dispense.cargo_data["tracker"]] left in store.") - else - terminal_display_line("Error: Stock empty.") - - - -/obj/structure/terminal/cargo_console/terminal_parse(str) - var/string_to_parse = uppertext(str) - if(!string_to_parse) return "error - null string parsed" - var/starting_buffer_length = terminal_buffer.len - switch(string_to_parse) - if("HELP") - terminal_display_line("Available Commands:") - terminal_display_line("CARGO - takes inventory of cargo bays. This display is also visible after login.") - terminal_display_line("RETR - Retrieve Cargo. Use format: TAG_ID , as seen in the CARGO readout.") - terminal_display_line("The cargo bay will automatically detect and pick up deposited munitions.") - terminal_display_line("No further information available.") - if("CARGO") - terminal_display_line("Current stocks:") - terminal_display_line("BAY 1 - primary ship ammo:") - terminal_display_line("MISSILES | TAG: M") - var/obj/structure/ship_elements/cargo_bay/bay_to_scan = linked_cargo_bays["primary_munitions"] - terminal_display_line("Hunter | ID: H20 | [bay_to_scan.cargo_data["missile_pst_homing"]] in storage.") - terminal_display_line("Panther | ID: D40 | [bay_to_scan.cargo_data["missile_pst_dumbfire"]] in storage.") - terminal_display_line("Inferno | ID: T05 | [bay_to_scan.cargo_data["missile_pst_torpedo"]] in storage.") - terminal_display_line("WARHEADS | TAG: W") - terminal_display_line("Standard | ID: D03 | [bay_to_scan.cargo_data["warhead_direct"]] in storage.") - terminal_display_line("Explosive | ID: E02 | [bay_to_scan.cargo_data["warhead_explosive"]] in storage.") - terminal_display_line("MIP | ID: M03 | [bay_to_scan.cargo_data["warhead_mip"]] in storage.") - terminal_display_line("BAY 2 - secondary ship ammo:") - bay_to_scan = linked_cargo_bays["secondary_munitions"] - terminal_display_line("TYPE S | TAG: S") - terminal_display_line("Direct | ID: D02 | [bay_to_scan.cargo_data["secondary_direct"]] in storage.") - terminal_display_line("Flak | ID: E03 | [bay_to_scan.cargo_data["secondary_flak"]] in storage.") - terminal_display_line("Broadside | ID: B05 | [bay_to_scan.cargo_data["secondary_broadside"]] in storage.") - terminal_display_line("SPECIAL | TAG: X") - terminal_display_line("EYE-7 probe | ID: P01 | [bay_to_scan.cargo_data["probe"]]") - terminal_display_line("PHA-1 tracker | ID: T01 | [bay_to_scan.cargo_data["tracker"]]") - if(starting_buffer_length == terminal_buffer.len) - var/tracked_position = 1 - while(tracked_position <= length(string_to_parse)) - var/type_to_parse = copytext(string_to_parse, 1, tracked_position + 1) - var/argument_to_parse = trimtext(copytext(string_to_parse, tracked_position + 1)) - terminal_advanced_parse(type = type_to_parse, string = argument_to_parse) - tracked_position += 1 - if(starting_buffer_length == terminal_buffer.len) terminal_display_line("Error: Unknown command. Please use HELP for a list of available commands.") - terminal_input() - return "Parsing Loop End" +/obj/structure/terminal/cargo_console/attackby(obj/item/W, mob/user) + terminal_display_line("Welcome, [user]!", cache = 1) + terminal_display_line("PRIMARY DELIVERY METHODS", cache = 1) + var/obj/structure/ship_elements/weapon_store/cb = linked_weapons_bays["LD Homing"] + terminal_display_line("LD-HOMING - [cb.current_items] - BAY [linked_weapons_bays[cb.bay_number]]", cache = 1) + cb = linked_weapons_bays["Direct"] + terminal_display_line("DIRECT - [cb.current_items] - BAY [linked_weapons_bays[cb.bay_number]]", cache = 1) + cb = linked_weapons_bays["Accelerating Torpedo"] + terminal_display_line("ACCELERATING TORPEDO - [cb.current_items] - BAY [linked_weapons_bays[cb.bay_number]]", cache = 1) + terminal_display_line("PRIMARY WARHEADS", cache = 1) + cb = linked_weapons_bays["Homing"] + terminal_display_line("HOMING - [cb.current_items] - BAY [linked_weapons_bays[cb.bay_number]]", cache = 1) + cb = linked_weapons_bays["Explosive"] + terminal_display_line("EXPLOSIVE - [cb.current_items] - BAY [linked_weapons_bays[cb.bay_number]]", cache = 1) + cb = linked_weapons_bays["MIP"] + terminal_display_line("MIP - [cb.current_items] - BAY [linked_weapons_bays[cb.bay_number]]", cache = 1) + terminal_display_line("This terminal accepts no inputs! Have a nice day!") + return diff --git a/code/modules/terminal/ship/signals.dm b/code/modules/terminal/ship/signals.dm index c36234b27b..cab259c7a1 100644 --- a/code/modules/terminal/ship/signals.dm +++ b/code/modules/terminal/ship/signals.dm @@ -89,8 +89,13 @@ switch(string) if("PING") terminal_display_line("PING") - terminal_display_line("Usage: PING , - Launches an EYE-7 pinging probe with the set vector.") - terminal_display_line("EYE-7 Probes immediately provide a scan with exact coordinates of all entities within a 3x3 area of their target. Probes need to be reloaded in the LEFT Gunnery Room.") + terminal_display_line("Usage: PING , - Launches an EYE-7 pinging probe with the set vector.") + terminal_display_line("Available Types:") + terminal_display_line("Sweeper, type \"S\" - requires SECTOR numbers.") + terminal_display_line("Scans a sector, returns coordinates of all entites in-sector.") + terminal_display_line("Direct, type \"D\" - requires ABSOLUTE COORDINATES.") + terminal_display_line("Returns detailed infromation about entites in selected coordinates.") + terminal_display_line("Additonally, tags ships for LD-Tracker missile systems for remainder of operating period.") if("TRACK") terminal_display_line("TRACK") terminal_display_line("Usage: TRACK B OR TRACK , - Handles the crafts LD tracking algorythms.") @@ -104,27 +109,49 @@ terminal_display_line("Error: HELP: [string] command not found. Use HELP with no arguments for a list of commands.") if("PING") if(usage_data["ping_uses_current"] < usage_data["ping_uses"]) - var/commapos = findtext(string, ",") - if(commapos == 0) - terminal_display_line("Error: Missing comma separator.") - else - commapos += 1 - var/x_to_scan = text2num(copytext(string, 1, commapos)) - var/y_to_scan = text2num(copytext(string, commapos)) - if(x_to_scan == null || y_to_scan == null) - if(x_to_scan == null) terminal_display_line("Error: Invalid x vector.") - if(y_to_scan == null) terminal_display_line("Error: Invalid y vector.") + var/scan_type = copytext(string, 1, 3) + if(scan_type == "S " || scan_type == "D ") + trim(scan_type) + string = trim(copytext(string, 1, 2)) + var/commapos = findtext(string, ",") + if(commapos == 0) + terminal_display_line("Error: Missing comma separator.") else - if(!linked_probe_launcher) - terminal_display_line("Critical Error: Launcher tube not found.") - else - if(linked_probe_launcher.probe_loaded == 0) - terminal_display_line("Error: Probe not loaded.") - if(linked_probe_launcher.probe_loaded == 1) - INVOKE_ASYNC(linked_probe_launcher, TYPE_PROC_REF(/obj/structure/ship_elements/probe_launcher/, LaunchContent)) - linked_master_console.ScannerPing(src, probe_target_x = x_to_scan, probe_target_y = y_to_scan, range = probe_range) + commapos += 1 + var/x_to_scan = text2num(copytext(string, 1, commapos)) + var/y_to_scan = text2num(copytext(string, commapos)) + if(scan_type == "D") + if(x_to_scan == null || y_to_scan == null) + if(x_to_scan == null) terminal_display_line("Error: Invalid x coordinate.") + if(y_to_scan == null) terminal_display_line("Error: Invalid y coordinate.") + else + if(!linked_probe_launcher) + terminal_display_line("Critical Error: Launcher tube not found.") + else + if(linked_probe_launcher.probe_loaded == 0) + terminal_display_line("Error: Out of probes in cartrige. Reload needed.") + if(linked_probe_launcher.probe_loaded > 1) + INVOKE_ASYNC(linked_probe_launcher, TYPE_PROC_REF(/obj/structure/ship_elements/probe_launcher/, LaunchContent)) + linked_master_console.ScannerPing(src, probe_target_x = x_to_scan, probe_target_y = y_to_scan) + if(scan_type == "S") + if(x_to_scan == null || y_to_scan == null) + if(x_to_scan == null) terminal_display_line("Error: Invalid sector x value.") + if(y_to_scan == null) terminal_display_line("Error: Invalid sector y value.") + if(x_to_scan < 0 || x_to_scan > GLOB.sector_map_x / 10 || y_to_scan < 0 || y_to_scan > GLOB.sector_map_y / 10) + if(x_to_scan < 0 || x_to_scan > GLOB.sector_map_x / 10) terminal_display_line("Error: Invalid sector x value.") + if(y_to_scan < 0 || y_to_scan > GLOB.sector_map_y / 10) terminal_display_line("Error: Invalid sector y value.") + else + if(!linked_probe_launcher) + terminal_display_line("Critical Error: Launcher tube not found.") + else + if(linked_probe_launcher.probe_loaded == 0) + terminal_display_line("Error: Out of probes in cartrige. Reload needed.") + if(linked_probe_launcher.probe_loaded > 1) + INVOKE_ASYNC(linked_probe_launcher, TYPE_PROC_REF(/obj/structure/ship_elements/probe_launcher/, LaunchContent)) + linked_master_console.SweeperPing(src, probe_target_x = x_to_scan, probe_target_y = y_to_scan) + if(usage_data["ping_uses_current"] >= usage_data["ping_uses"]) - terminal_display_line("Error: Out of scanner pings in this interval.") + terminal_display_line("Error: Out of scanner pings in this operating period.") if("TRACK") if(copytext(string, 1, 2) == "R") var/tracker_id_to_remove = text2num(copytext(trimtext(string),2,0)) @@ -207,7 +234,7 @@ terminal_input() return "Parsing Loop End" -/obj/structure/terminal/signals_console/attack_hand(mob/user) +/obj/structure/terminal/signals_console/new_user() if(repair_shutdown == 0) terminal_display_line("Welcome, [usr.name].") terminal_display() diff --git a/code/modules/terminal/ship/weapons.dm b/code/modules/terminal/ship/weapons.dm index 6ca1b47757..eef04f18d0 100644 --- a/code/modules/terminal/ship/weapons.dm +++ b/code/modules/terminal/ship/weapons.dm @@ -98,61 +98,76 @@ terminal_display_line("Payload: [linked_primary_cannon.loaded_projectile["payload"]]") if(linked_master_console.sector_map[linked_master_console.sector_map_data["x"]][linked_master_console.sector_map_data["y"]]["missile"]["id_tag"] == "none") if(linked_primary_cannon.loaded_projectile["missile"] == "LD Homing") - terminal_display_line("LD Targeting system inputs ready.") - var/fire_own_x = tgui_input_number(usr, "Enter OWN X Coordinate", "CURRENT X", max_value = GLOB.sector_map_x * 10, min_value = 1, timeout = 0) - var/fire_own_y = tgui_input_number(usr, "Enter OWN Y Coordinate", "CURRENT Y", max_value = GLOB.sector_map_y * 10, min_value = 1, timeout = 0) - if(fire_own_x == null) fire_own_x = 1 - if(fire_own_y == null) fire_own_y = 1 - terminal_display_line("Starting Coordinates: ([fire_own_x],[fire_own_y])") - var/fire_target_x = tgui_input_number(usr, "Enter TARGET X Coordinate", "TARGET X", max_value = GLOB.sector_map_x * 10, min_value = 1, timeout = 0) - var/fire_target_y = tgui_input_number(usr, "Enter TARGET Y Coordinate", "TARGET Y", max_value = GLOB.sector_map_y * 10, min_value = 1, timeout = 0) - if(fire_target_x == null) fire_target_x = 1 - if(fire_target_y == null) fire_target_y = 1 - terminal_display_line("Target Coordinates: ([fire_target_x],[fire_target_y])") - var/fire_target_vector_x = tgui_input_number(usr, "Enter TARGET X Vector", "TARGET VECTOR X", timeout = 0) - var/fire_target_vector_y = tgui_input_number(usr, "Enter TARGET Y Vector", "TARGET VECTOR Y", timeout = 0) - if(fire_target_vector_x == null) fire_target_vector_x = 0 - if(fire_target_vector_y == null) fire_target_vector_y = 0 - terminal_display_line("Target Vector: ([fire_target_vector_x],[fire_target_vector_y])") - terminal_display_line("Calculating firing sollution.", TERMINAL_LOOKUP_SLEEP) - terminal_display_line("READY TO FIRE.") - if(tgui_alert(usr, "READY TO FIRE", "FIRE", list("FIRE","Cancel"), timeout = 0) == "FIRE") - if(linked_master_console.sector_map[fire_target_x][fire_target_y]["ship"]["vector"]["x"] == fire_target_vector_x && linked_master_console.sector_map[fire_target_x][fire_target_y]["ship"]["vector"]["y"] == fire_target_vector_y && fire_own_x == linked_master_console.sector_map_data["x"] && fire_own_y == linked_master_console.sector_map_data["y"]) - linked_master_console.add_entity(entity_type = 1, x = linked_master_console.sector_map_data["x"], y = linked_master_console.sector_map_data["y"], name = linked_primary_cannon.loaded_projectile["name"] ,type = linked_primary_cannon.loaded_projectile["missile"], vector_x = fire_target_x, vector_y = fire_target_y, warhead_type = linked_primary_cannon.loaded_projectile["warhead"], warhead_payload = linked_primary_cannon.loaded_projectile["payload"], target_tag = linked_master_console.sector_map[fire_target_x][fire_target_y]["ship"]["id_tag"], missile_speed = linked_primary_cannon.loaded_projectile["speed"]) + terminal_display_line("LD Targeting system input ready.") + terminal_display_line("Scanning Scanner Buffer for targets...",TERMINAL_LOOKUP_SLEEP) + if(linked_master_console.ping_ids.len == 0) + terminal_display_line("Error: No valid entity IDs in buffer.") + else + terminal_display_line("Entites in Ping buffer [linked_master_console.ping_ids.len]") + terminal_display_line("Enter valid IDs, rellayed by Ship Commnader.") + var/entered_ship_id = tgui_input_text(usr, "Enter entity ID from the commander's console.", "ENTITY ID ENTRY", timeout = 0) + if(linked_master_console.ping_ids.Find(entered_ship_id) == 0) + terminal_display_line("Error: ID [entered_ship_id] not found.") else - linked_master_console.add_entity(entity_type = 1, x = linked_master_console.sector_map_data["x"], y = linked_master_console.sector_map_data["y"], name = linked_primary_cannon.loaded_projectile["name"] ,type = linked_primary_cannon.loaded_projectile["missile"], vector_x = fire_target_x, vector_y = fire_target_y, warhead_type = linked_primary_cannon.loaded_projectile["warhead"], warhead_payload = linked_primary_cannon.loaded_projectile["payload"], target_tag = "none", missile_speed = linked_primary_cannon.loaded_projectile["speed"]) - INVOKE_ASYNC(linked_primary_cannon, TYPE_PROC_REF(/obj/structure/ship_elements/primary_cannon, FireCannon)) - terminal_display_line("MISSILE AWAY.") - usage_data["salvos_left"] -= 1 - usage_data["primary_fired"] = 1 - UpdateMapData() - terminal_parse("STATUS", no_input = 1) - linked_master_console.log_round_history(event = "missile_launch", log_source = linked_master_console.sector_map_data["name"], log_dest_x = linked_master_console.sector_map_data["x"], log_dest_y = linked_master_console.sector_map_data["y"]) - for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log in world) - if(ship_sts_to_log.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) - ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_own_launch") - if(ship_sts_to_log.sector_map_data["name"] != linked_master_console.sector_map_data["name"]) - ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_launch") + terminal_display_line("READY TO FIRE.") + if(tgui_alert(usr, "READY TO FIRE", "FIRE", list("FIRE","Cancel"), timeout = 0) == "FIRE") + var/fire_target_x + var/fire_target_y + var/fire_scan_x = 1 + var/fire_scan_y = 1 + while(fire_scan_x <= GLOB.sector_map_x && !fire_target_x) + while(fire_scan_y <= GLOB.sector_map_y && !fire_target_x) + if(linked_master_console.sector_map[fire_scan_x][fire_scan_y]["ship"]["id_tag"] == entered_ship_id) + fire_target_x = fire_scan_x + fire_target_y = fire_scan_y + break + if (linked_master_console.sector_map[fire_scan_x][fire_scan_y]["missile"]["id_tag"] == entered_ship_id) + fire_target_x = fire_scan_x + fire_target_y = fire_scan_y + break + fire_scan_y += 1 + fire_scan_y = 1 + fire_scan_x += 1 + if(!fire_target_x) + terminal_display_line("Targeting error. Aborting.") + to_chat(usr, SPAN_WARNING("Exception: Entity from scan list does not match anything on sector map. This is a bug as this should NOT be on the ping list. Yell at silencer please.")) + else + linked_master_console.add_entity(entity_type = 1, x = linked_master_console.sector_map_data["x"], y = linked_master_console.sector_map_data["y"], name = linked_primary_cannon.loaded_projectile["name"] ,type = linked_primary_cannon.loaded_projectile["missile"], vector_x = fire_target_x, vector_y = fire_target_y, warhead_type = linked_primary_cannon.loaded_projectile["warhead"], warhead_payload = linked_primary_cannon.loaded_projectile["payload"], target_tag = entered_ship_id, missile_speed = linked_primary_cannon.loaded_projectile["speed"]) + INVOKE_ASYNC(linked_primary_cannon, TYPE_PROC_REF(/obj/structure/ship_elements/primary_cannon, FireCannon)) + terminal_display_line("MISSILE AWAY.") + usage_data["salvos_left"] -= 1 + usage_data["primary_fired"] = 1 + UpdateMapData() + terminal_parse("STATUS", no_input = 1) + linked_master_console.log_round_history(event = "missile_launch", log_source = linked_master_console.sector_map_data["name"], log_dest_x = linked_master_console.sector_map_data["x"], log_dest_y = linked_master_console.sector_map_data["y"]) + for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log in world) + if(ship_sts_to_log.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) + ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_own_launch") + if(ship_sts_to_log.sector_map_data["name"] != linked_master_console.sector_map_data["name"]) + ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_launch") else terminal_display_line("Coordinate Targeting mode.") - var/fire_target_x = tgui_input_number(usr, "Enter TARGET X Coordinate", "TARGET X", max_value = GLOB.sector_map_x * 10, min_value = 1, timeout = 0) - var/fire_target_y = tgui_input_number(usr, "Enter TARGET Y Coordinate", "TARGET Y", max_value = GLOB.sector_map_y * 10, min_value = 1, timeout = 0) - terminal_display_line("Entering coordinates...", TERMINAL_LOOKUP_SLEEP) - terminal_display_line("READY TO FIRE.") - if(tgui_alert(usr, "READY TO FIRE", "FIRE", list("FIRE","Cancel"), timeout = 0) == "FIRE") - linked_master_console.add_entity(entity_type = 1, x = linked_master_console.sector_map_data["x"], y = linked_master_console.sector_map_data["y"], name = linked_primary_cannon.loaded_projectile["name"] ,type = linked_primary_cannon.loaded_projectile["missile"], vector_x = fire_target_x, vector_y = fire_target_y, warhead_type = linked_primary_cannon.loaded_projectile["warhead"], warhead_payload = linked_primary_cannon.loaded_projectile["payload"], target_tag = "none", missile_speed = linked_primary_cannon.loaded_projectile["speed"]) - INVOKE_ASYNC(linked_primary_cannon, TYPE_PROC_REF(/obj/structure/ship_elements/primary_cannon, FireCannon)) - terminal_display_line("MISSILE AWAY.") - usage_data["salvos_left"] -= 1 - usage_data["primary_fired"] = 1 - UpdateMapData() - terminal_parse("STATUS", no_input = 1) - linked_master_console.log_round_history(event = "missile_launch", log_source = linked_master_console.sector_map_data["name"], log_dest_x = linked_master_console.sector_map_data["x"], log_dest_y = linked_master_console.sector_map_data["y"]) - for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log in world) - if(ship_sts_to_log.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) - ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_own_launch") - else - ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_launch") + var/fire_target_x = tgui_input_number(usr, "Enter ABSOLUTE X Coordinate of target", "TARGET X", max_value = GLOB.sector_map_x, min_value = 1, timeout = 0) + var/fire_target_y = tgui_input_number(usr, "Enter ABSOLUTE Y Coordinate of target", "TARGET Y", max_value = GLOB.sector_map_y, min_value = 1, timeout = 0) + if(fire_target_x || fire_target_y) + terminal_display_line("Entering coordinates...", TERMINAL_LOOKUP_SLEEP) + terminal_display_line("READY TO FIRE.") + if(tgui_alert(usr, "READY TO FIRE", "FIRE", list("FIRE","Cancel"), timeout = 0) == "FIRE") + linked_master_console.add_entity(entity_type = 1, x = linked_master_console.sector_map_data["x"], y = linked_master_console.sector_map_data["y"], name = linked_primary_cannon.loaded_projectile["name"] ,type = linked_primary_cannon.loaded_projectile["missile"], vector_x = fire_target_x, vector_y = fire_target_y, warhead_type = linked_primary_cannon.loaded_projectile["warhead"], warhead_payload = linked_primary_cannon.loaded_projectile["payload"], target_tag = "none", missile_speed = linked_primary_cannon.loaded_projectile["speed"]) + INVOKE_ASYNC(linked_primary_cannon, TYPE_PROC_REF(/obj/structure/ship_elements/primary_cannon, FireCannon)) + terminal_display_line("MISSILE AWAY.") + usage_data["salvos_left"] -= 1 + usage_data["primary_fired"] = 1 + UpdateMapData() + terminal_parse("STATUS", no_input = 1) + linked_master_console.log_round_history(event = "missile_launch", log_source = linked_master_console.sector_map_data["name"], log_dest_x = linked_master_console.sector_map_data["x"], log_dest_y = linked_master_console.sector_map_data["y"]) + for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log in world) + if(ship_sts_to_log.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) + ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_own_launch") + else + ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_launch") + else + terminal_display_line("Coordinate entry aborted.") else terminal_display_line("Error: Projectile type entity already located in current position. Cannot fire primary cannon due to LD resonance.") else @@ -165,28 +180,22 @@ terminal_display_line("Secondary Cannon Projectile Information:") terminal_display_line("Ammo type: [linked_secondary_cannon.loaded_projectile["type"]]") terminal_display_line("LD Targeting system inputs ready.") - var/secondary_fire_target_x = tgui_input_number(usr, "Enter X Displacement", "TARGET X", max_value = 5, min_value = -5, timeout = 0) - var/secondary_fire_target_y = tgui_input_number(usr, "Enter Y Displacement", "TARGET Y", max_value = 5, min_value = -5, timeout = 0) - if(secondary_fire_target_x == null) secondary_fire_target_x = 0 - if(secondary_fire_target_y == null) secondary_fire_target_y = 0 - if(secondary_fire_target_x == 0 && secondary_fire_target_y == 0) - terminal_display_line("Error: Targeting own position is not advisable. Aborting.") - else - if (abs(secondary_fire_target_x) + abs(secondary_fire_target_y) < 3) terminal_display_line("Warning: Expected hit is danger close.") - var/x_to_secondary_fire = linked_master_console.sector_map_data["x"] + secondary_fire_target_x - var/y_to_secondary_fire = linked_master_console.sector_map_data["y"] + secondary_fire_target_y - terminal_display_line("Vector: ([secondary_fire_target_x],[secondary_fire_target_y])") - terminal_display_line("READY TO FIRE.") - if(tgui_alert(usr, "READY TO FIRE", "FIRE", list("FIRE","Cancel"), timeout = 0) == "FIRE") - if(x_to_secondary_fire <= 0 || x_to_secondary_fire > GLOB.sector_map_x || y_to_secondary_fire <= 0 || y_to_secondary_fire > GLOB.sector_map_y) - terminal_display_line("Error: Coordinates out of bounds. Review current position and target vector") - else + var/secondary_fire_target_x = tgui_input_number(usr, "Enter ABSOLUTE X Coordinate. Mind maximum ranges of secondary weapons.", "TARGET X", max_value = GLOB.sector_map_x, min_value = 1, timeout = 0) + var/secondary_fire_target_y = tgui_input_number(usr, "Enter ABSOLUTE Y Coordinate. Mind maximum ranges of secondary weapons.", "TARGET Y", max_value = GLOB.sector_map_y, min_value = 1, timeout = 0) + if(secondary_fire_target_x || secondary_fire_target_y) + var/target_distance = (abs(secondary_fire_target_x - linked_master_console.sector_map_data["x"]) + abs(secondary_fire_target_y - linked_master_console.sector_map_data["y"])) + terminal_display_line("Target: ([secondary_fire_target_x],[secondary_fire_target_y])") + terminal_display_line("Distance to target: [target_distance]") + if(target_distance <= 5) + if(target_distance < 3) terminal_display_line("Warning: Danger Close") + terminal_display_line("READY TO FIRE.") + if(tgui_alert(usr, "READY TO FIRE", "FIRE", list("FIRE","Cancel"), timeout = 0) == "FIRE") var/fired_secondary_ammo = linked_secondary_cannon.loaded_projectile["type"] linked_secondary_cannon.FireCannon() usage_data["salvos_left"] -= 1 UpdateMapData() terminal_display_line("FIRING.", TERMINAL_STANDARD_SLEEP) - linked_master_console.log_round_history(event = "secondary_fire", log_source = linked_master_console.sector_map_data["name"], log_dest_x = x_to_secondary_fire, log_dest_y = y_to_secondary_fire) + linked_master_console.log_round_history(event = "secondary_fire", log_source = linked_master_console.sector_map_data["name"], log_dest_x = secondary_fire_target_x, log_dest_y = secondary_fire_target_y) for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log in world) if(ship_sts_to_log.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) ship_sts_to_log.WriteToShipLog(shiplog_event = "secondary_own_fire") @@ -194,14 +203,14 @@ ship_sts_to_log.WriteToShipLog(shiplog_event = "secondary_fire") switch(fired_secondary_ammo) if("Direct") - if(linked_master_console.sector_map[x_to_secondary_fire][y_to_secondary_fire]["ship"]["id_tag"] != "none") - linked_master_console.ProcessDamage(ammount = 2, x = x_to_secondary_fire, y = y_to_secondary_fire) + if(linked_master_console.sector_map[secondary_fire_target_x][secondary_fire_target_y]["ship"]["id_tag"] != "none") + linked_master_console.ProcessDamage(ammount = 2, x = secondary_fire_target_x, y = secondary_fire_target_y) terminal_display_line("Direct impact on ship detected.") for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log_effect in world) if(ship_sts_to_log_effect.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) ship_sts_to_log_effect.WriteToShipLog(shiplog_event = "secondary_hit") - else if (linked_master_console.sector_map[x_to_secondary_fire][y_to_secondary_fire]["missile"]["id_tag"] != "none") - linked_master_console.rem_entity(type = "coord", id = "missile", coord_x = x_to_secondary_fire, coord_y = y_to_secondary_fire) + else if (linked_master_console.sector_map[secondary_fire_target_x][secondary_fire_target_y]["missile"]["id_tag"] != "none") + linked_master_console.rem_entity(type = "coord", id = "missile", coord_x = secondary_fire_target_x, coord_y = secondary_fire_target_y) terminal_display_line("Direct impact on projectile detected. Projectile destroyed.") for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log_effect in world) if(ship_sts_to_log_effect.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) @@ -213,7 +222,7 @@ ship_sts_to_log_effect.WriteToShipLog(shiplog_event = "secondary_miss") if("Flak") terminal_display_line("Explosion detected. Analyzing...") - var/hit_targets = linked_master_console.ProcessSplashDamage(ammount = 3, x = x_to_secondary_fire, y = y_to_secondary_fire, counter = 1) + var/hit_targets = linked_master_console.ProcessSplashDamage(ammount = 3, x = secondary_fire_target_x, y = secondary_fire_target_y, counter = 1) if(hit_targets != 0) terminal_display_line("Targets hit: [hit_targets]") for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log_effect in world) @@ -225,18 +234,20 @@ if(ship_sts_to_log_effect.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) ship_sts_to_log_effect.WriteToShipLog(shiplog_event = "secondary_miss") if("Broadside") - if(abs(secondary_fire_target_x) + abs(secondary_fire_target_y) > 1 || linked_master_console.sector_map[x_to_secondary_fire][y_to_secondary_fire]["ship"]["it_tag"] == "none") + if(abs(secondary_fire_target_x) + abs(secondary_fire_target_y) > 1 || linked_master_console.sector_map[secondary_fire_target_x][secondary_fire_target_y]["ship"]["it_tag"] == "none") terminal_display_line("No impact detected.") for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log_effect in world) if(ship_sts_to_log_effect.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) ship_sts_to_log_effect.WriteToShipLog(shiplog_event = "secondary_miss") else - linked_master_console.ProcessDamage(ammount = 5, x = x_to_secondary_fire, y = y_to_secondary_fire) + linked_master_console.ProcessDamage(ammount = 5, x = secondary_fire_target_x, y = secondary_fire_target_y) terminal_display_line("Direct hit detected.") for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log_effect in world) if(ship_sts_to_log_effect.sector_map_data["name"] == linked_master_console.sector_map_data["name"]) ship_sts_to_log_effect.WriteToShipLog(shiplog_event = "secondary_hit") terminal_parse("STATUS", no_input = 1) + else + terminal_display_line("Error: Targeted coordinates out of range.") else terminal_display_line("Error:Secondary Cannon not primed.") else diff --git a/code/modules/terminal/terminal.dm b/code/modules/terminal/terminal.dm index 8d51a341ef..fc4c01e01c 100644 --- a/code/modules/terminal/terminal.dm +++ b/code/modules/terminal/terminal.dm @@ -9,11 +9,14 @@ var/terminal_id = "default" var/list/terminal_buffer = list() var/list/terminal_trimmed_buffer = list() - var/terminal_busy = 0 + var/terminal_user + var/list/terminal_observers = list() + var/turf/terminal_user_turf + var/terminal_input var/terminal_line_length = 70 var/terminal_line_height = 19 var/terminal_reserved_lines = 0 - var/terminal_window_size = "800x800" + var/terminal_window_size = "900x900" var/header_name = "NAME GOES HERE" var/terminal_header light_range = 3 @@ -21,6 +24,28 @@ light_color = "#67ac67" light_system = HYBRID_LIGHT +/obj/structure/terminal/proc/new_user() + if(!(terminal_id in usr.saw_narrations)) + terminal_display_line("New user detected. Welcome, [usr.name].") + usr.saw_narrations.Add(terminal_id) + else + terminal_display_line("Welcome back, [usr].") + terminal_input() + return "end of input loop" + +/obj/structure/terminal/proc/del_user() + if(terminal_user != null) + terminal_user << browse(null, "window=[terminal_id]") + terminal_user = null + terminal_user_turf = null + kill_window() + +/obj/structure/terminal/proc/check_user() + if(terminal_user == usr && terminal_user_turf == get_turf(usr)) + return 1 + else + return 0 + /obj/structure/terminal/proc/WriteHeader() terminal_header = {"
[header_name]
UACM 2ND LOGISTICS
"} @@ -48,9 +73,24 @@ /obj/structure/terminal/proc/kill_window() usr << browse(null, "window=[terminal_id]") - reset_buffer() + if(terminal_observers.Find(usr) != 0) terminal_observers.Remove(usr) + if(usr.sp_uis.Find(terminal_id) != 0) usr.sp_uis.Remove(terminal_id) + +/obj/structure/terminal/proc/reset_terminal() + if(check_user() == 1) + reset_buffer() + for(var/mob/mobs_to_reset_terminal in terminal_observers) + mobs_to_reset_terminal << browse(null, "window=[terminal_id]") + terminal_observers = null + terminal_observers = list() + del_user() + return + else + to_chat(usr, SPAN_WARNING("Error: You are not the user of the terminal.")) + return /obj/structure/terminal/proc/terminal_display() // Display loop. HTML encodes (which incidentally should also prevent a lot of HTML shenanigans since it escapes characters) and displays current buffer. Please don't laugh at my placeholder HTML -_- , in normal circumstances should not need edits unless you want to change the style for an individual terminal. + if(terminal_observers.Find(usr) == 0) terminal_observers.Add(usr) trim_buffer() var/terminal_output = jointext(terminal_trimmed_buffer, "

") var/terminal_html ={" @@ -59,21 +99,45 @@