From f085a0361353091874d99bc5f7c647678e568d8a Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:16:32 -0400 Subject: [PATCH 1/8] fixes round processing logic --- .../shiptoship/ship/ship_mission_control.dm | 36 +++++++++++-------- code/modules/shiptoship/sts_master.dm | 5 ++- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/code/modules/shiptoship/ship/ship_mission_control.dm b/code/modules/shiptoship/ship/ship_mission_control.dm index ad9d461ab9..99ef80c1aa 100644 --- a/code/modules/shiptoship/ship/ship_mission_control.dm +++ b/code/modules/shiptoship/ship/ship_mission_control.dm @@ -202,20 +202,28 @@ 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) + linked_command_chair.open_command_window("round_history") + local_round_log = null + local_round_log = list() + local_round_log_moves = null + 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) diff --git a/code/modules/shiptoship/sts_master.dm b/code/modules/shiptoship/sts_master.dm index 545f82d651..db6297691f 100644 --- a/code/modules/shiptoship/sts_master.dm +++ b/code/modules/shiptoship/sts_master.dm @@ -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. From 4ad1a06ecef4814b5eaf442e3bc889270016a815 Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:42:24 -0400 Subject: [PATCH 2/8] improves ping history and currently ping display outputs --- .../shiptoship/ship/ship_command_chair.dm | 19 +++++++++++++++---- .../shiptoship/ship/ship_mission_control.dm | 13 +++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) 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 99ef80c1aa..33ae37b3bb 100644 --- a/code/modules/shiptoship/ship/ship_mission_control.dm +++ b/code/modules/shiptoship/ship/ship_mission_control.dm @@ -29,6 +29,7 @@ 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/comms_messages = list() light_system = HYBRID_LIGHT light_color = "#660166" @@ -209,7 +210,11 @@ 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 = null + current_pings = list() local_round_log = null local_round_log = list() local_round_log_moves = null @@ -228,13 +233,13 @@ /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(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(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) From a61cd4864e583a4922f6bdf8bd613e84da070491 Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:54:01 -0400 Subject: [PATCH 3/8] Underlines sector and coordinate values in displays, fixes display issues --- .../admin/mission_control/mission_control.dm | 26 +++++++------- .../shiptoship/ship/ship_mission_control.dm | 36 +++++++++---------- code/modules/shiptoship/sts_master.dm | 26 +++++++------- 3 files changed, 43 insertions(+), 45 deletions(-) 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/shiptoship/ship/ship_mission_control.dm b/code/modules/shiptoship/ship/ship_mission_control.dm index 33ae37b3bb..8ad605da91 100644 --- a/code/modules/shiptoship/ship/ship_mission_control.dm +++ b/code/modules/shiptoship/ship/ship_mission_control.dm @@ -306,8 +306,8 @@ 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 @@ -356,20 +356,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") @@ -385,24 +385,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/sts_master.dm b/code/modules/shiptoship/sts_master.dm index db6297691f..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() From 8ba5fdb52614c286c87bd873f0dab92953e615e9 Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Wed, 28 Aug 2024 06:28:07 -0400 Subject: [PATCH 4/8] terminal fixes and updates --- code/modules/terminal/briefing/briefing.dm | 2 +- code/modules/terminal/ship/signals.dm | 2 +- code/modules/terminal/terminal.dm | 172 +++++++++++++++++---- 3 files changed, 144 insertions(+), 32 deletions(-) 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/signals.dm b/code/modules/terminal/ship/signals.dm index c36234b27b..1d5c9afc35 100644 --- a/code/modules/terminal/ship/signals.dm +++ b/code/modules/terminal/ship/signals.dm @@ -207,7 +207,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/terminal.dm b/code/modules/terminal/terminal.dm index 8d51a341ef..a4e4b60f9a 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,42 @@