Skip to content

Commit

Permalink
debugging, round 3
Browse files Browse the repository at this point in the history
secondary canon firing and splash damage handling :F
  • Loading branch information
silencer-pl committed Aug 17, 2024
1 parent 73f74ef commit 99e4ffc
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 31 deletions.
19 changes: 17 additions & 2 deletions code/modules/admin/mission_control/mission_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,30 @@
for(var/obj/structure/shiptoship_master/sts_master_to_link in world)
sts_master = sts_master_to_link
break
switch(tgui_input_list(usr, "Select Template, this will REPLACE the current map:","TEMPLATE select",list("Blank","Function Test"),timeout = 0))
switch(tgui_input_list(usr, "Select Template, this will REPLACE the current map:","TEMPLATE select",list("Blank","Firing Test","Damage Test","Critical Damage Test","Tracker Test"),timeout = 0))
if(null)
return
if("Blank")
sts_master.clear_map()
if("Function Test")
if("Firing Test")
sts_master.clear_map()
sts_master.add_entity(entity_type = 0, x = 20, y = 50, name = "UAS Tester", type = "Testing Vessel", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 10, ship_shield = 10, ship_speed = 5, salvos = 2)
sts_master.add_entity(entity_type = 0, x = 50, y = 50, name = "Testing Target", type = "Testing Vessel", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 10, ship_shield = 0, ship_speed = 5, salvos = 5)
sts_master.add_entity(entity_type = 0, x = 23, y = 50, name = "Close Range Testing Target", type = "Testing Vessel", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 10, ship_shield = 0, ship_speed = 5, salvos = 5)
if("Damage Test")
sts_master.clear_map()
sts_master.add_entity(entity_type = 0, x = 20, y = 50, name = "UAS Tester", type = "Testing Vessel", 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 = 1, x = 55, y = 50, name = "Tester Missile", type = "Direct-Direct", missile_speed = 20, vector_x = 50, vector_y = 50, warhead_type = "Direct", warhead_payload = 3)
sts_master.add_entity(entity_type = 1, x = 45, y = 50, name = "Tester Missile", type = "Direct-Direct", missile_speed = 20, vector_x = 50, vector_y = 50, warhead_type = "Direct", warhead_payload = 3)
if("Critical Damage Test")
sts_master.clear_map()
sts_master.add_entity(entity_type = 0, x = 20, y = 50, name = "UAS Tester", type = "Testing Vessel", 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 = 1, x = 55, y = 50, name = "Tester Missile", type = "Direct-Direct", missile_speed = 20, vector_x = 50, vector_y = 50, warhead_type = "Direct", warhead_payload = 6)
sts_master.add_entity(entity_type = 1, x = 45, y = 50, name = "Tester Missile", type = "Direct-Direct", missile_speed = 20, vector_x = 50, vector_y = 50, warhead_type = "Direct", warhead_payload = 6)
if("Tracker Test")
sts_master.clear_map()
sts_master.add_entity(entity_type = 0, x = 20, y = 50, name = "UAS Tester", type = "Testing Vessel", vector_x = 0, vector_y = 0, ship_status = "Operational", ship_faction = "UACM", ship_damage = 10, ship_shield = 10, ship_speed = 5, salvos = 2)
sts_master.add_entity(entity_type = 0, x = 50, y = 50, name = "Testing Target", type = "Testing Vessel", vector_x = 3, vector_y = 2, ship_status = "Operational", ship_faction = "UACM", ship_damage = 10, ship_shield = 0, ship_speed = 5, salvos = 5)
sts_entity_panel()
return

Expand Down
12 changes: 6 additions & 6 deletions code/modules/shiptoship/ship/ammo_types/ship_ammunition.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,25 @@
element_value = 3

/obj/item/ship_elements/secondary_ammo/direct
name = "prepackaged box of Type-S \"Direct\" ammunition"
name = "prepackaged box of Type-S Direct ammunition"
desc = "A large box with multiple rows of high caliber ammunition with green colored tips."
desc_lore = "The design idea behind this type of ammo follows a classic idea - a sharpened mixture of metals that aims to penetrate anything it hits. This method of combat was unfeasible in the distances typical spaceship combat takes place in and only with the PST's Mission Control system, specifically its hyper accuracy, guaranteeing a virtually 100 percent hit rate, can it potentially make a comeback."
icon = 'icons/sectorpatrol/ship/weapon_ammo.dmi'
icon_state = "secondary_direct"
ammo_type = "direct"
ammo_type = "Direct"

/obj/item/ship_elements/secondary_ammo/flak
name = "prepackaged box of Type-S \"Flak\" ammunition"
name = "prepackaged box of Type-S Flak ammunition"
desc = "A large box with multiple rows of high caliber ammunition with red colored tips."
desc_lore = "Flak ammunition utilizes a localized LD rift shaped and maintained by the PST's Mission Control system to supercharge and send the ammo through an unstable LD rift, much like the shrapnel of explosive missile warheads. This method of delivery is only possible due to the Mission Control system's unusual energy capabilities, but the result is a reliable, short range large area clearing tool. Care must be utilized while targeting this type of ammunition, as the LD rift charged ammo will strike its origin point as much as any other target in its area."
icon = 'icons/sectorpatrol/ship/weapon_ammo.dmi'
icon_state = "secondary_flak"
ammo_type = "flak"
ammo_type = "Flak"

/obj/item/ship_elements/secondary_ammo/broadside
name = "prepackaged box of Type-S \"Broadside\" ammunition"
name = "prepackaged box of Type-S Broadside ammunition"
desc = "A large box with multiple rows of high caliber ammunition with yellow colored tips."
desc_lore = "Broadside ammunition follows a design idea laid out by Mission Control and as such is one of the first devices in human hands which was designed for human use by a non-human. Broadside ammunition uses a targeted, short range Hyperspace field that is calibrated and targeted by the Mission Control system. Due to the systems unique compatibility with Hyperspace based computations, unique LD enhanced polymers used during production of the ammunition and the Type-S cannons natural accuracy, Broadside projectiles are delivered directly inside or on top of their targets, then detonate immediately causing massive internal damage."
icon = 'icons/sectorpatrol/ship/weapon_ammo.dmi'
icon_state = "secondary_broadside"
ammo_type = "broadside"
ammo_type = "Broadside"
7 changes: 5 additions & 2 deletions code/modules/shiptoship/ship/ship_command_chair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@
var/current_round
if(linked_master_console.local_round_log.len == 0) current_round = "No recent Sonar activity."
if(linked_master_console.local_round_log.len != 0) current_round = jointext(linked_master_console.local_round_log, "</p><p>")
window_size="700x400"
dat +={"<p><b>Sonar Activity:</b></p>
<p>[current_round]</p>
"}
if("round_history")
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, "</p><p>")
window_size="700x400"
dat +={"<p><b>Sonar Activity History Buffer:</b></p>
<p>[round_history]</p>
"}
Expand All @@ -120,7 +122,7 @@
if(linked_master_console.ping_history.len != 0) pings_and_tracking += jointext(linked_master_console.ping_history, "</p><p>")
pings_and_tracking += jointext(linked_master_console.GetTrackingList(), "</p><p>")
if(linked_master_console.local_round_log_moves.len == 0) activity_summary = "No recent activity."
if(linked_master_console.local_round_log_moves.len != 0) activity_summary = jointext(linked_master_console.local_round_log_moves, " | ")
if(linked_master_console.local_round_log_moves.len != 0) activity_summary = jointext(linked_master_console.local_round_log_moves, "</p><p>")
dat +={"<p><b>Pings and Tracking:</b></p>
<p>Activity update:</p>
<p><b>[activity_summary]</b></p>
Expand All @@ -131,6 +133,7 @@
var/ship_messages
if(linked_master_console.comms_messages.len == 0) ship_messages = "No messages to display."
if(linked_master_console.comms_messages.len != 0) ship_messages = jointext(linked_master_console.comms_messages, "</p><p>")
window_size="700x400"
dat +={"<p><b>Recieved Messages:</b></p>
<p>[ship_messages]</p>
"}
Expand Down Expand Up @@ -175,7 +178,7 @@
INVOKE_ASYNC(linked_top_screen,TYPE_PROC_REF(/obj/structure/ship_elements/command_monitor/, use_fx), "on")
INVOKE_ASYNC(linked_front_screen,TYPE_PROC_REF(/obj/structure/ship_elements/command_monitor/, use_fx), "on")
INVOKE_ASYNC(linked_bot_screen,TYPE_PROC_REF(/obj/structure/ship_elements/command_monitor/, use_fx), "on")
if(tgui_input_list(usr, "Do you want to open all interfaces?","OPEN ALL",list("Yes","No"), timeout = 0) == "Yes")
if(tgui_alert(usr, "Do you want to open all interfaces?","OPEN ALL",list("Yes","No"), timeout = 0) == "Yes")
open_command_window(type = "current_round")
open_command_window(type = "round_history")
open_command_window(type = "pings_and_tracking")
Expand Down
5 changes: 5 additions & 0 deletions code/modules/shiptoship/ship/ship_mission_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
local_round_log = null
local_round_log = list()
SyncPosToMap()
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_damage_console,TYPE_PROC_REF(/obj/structure/terminal/damage_console/, SetUsageData),0,null)
Expand Down Expand Up @@ -262,6 +263,10 @@
local_round_log.Add("<b>Secondary fire detected</b> in sector <b>[SectorConversion(shiplog_coordinate_x,shiplog_coordinate_y)]</b>!")
if("secondary_own_fire")
local_round_log.Add("Secondary fire from own vessel.")
if("secondary_hit")
local_round_log.Add("<b>Impact detected!</b>")
if("secondary_miss")
local_round_log.Add("<b>No Impact!</b>")
linked_command_chair.open_command_window("current_round")

/obj/structure/shiptoship_master/ship_missioncontrol/Initialize(mapload, ...)
Expand Down
14 changes: 7 additions & 7 deletions code/modules/shiptoship/ship/ship_weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
density = TRUE
anchored = TRUE
layer = LADDER_LAYER
bound_width = 96
bound_height = 96
bound_y = 32
bound_width = 128
bound_height = 64
bound_y = 64
unslashable = TRUE
unacidable = TRUE
var/repair_shutdown = 0
Expand Down Expand Up @@ -334,9 +334,9 @@
density = TRUE
anchored = TRUE
layer = LADDER_LAYER
bound_width = 96
bound_height = 96
bound_y = 32
bound_width = 128
bound_height = 64
bound_y = 64
unslashable = TRUE
unacidable = TRUE
var/repair_shutdown = 0
Expand Down Expand Up @@ -411,7 +411,7 @@
if(loaded_projectile["type"] == "none")
to_chat(usr, SPAN_INFO("The ammo box slides into place and is ready for priming!"))
var/obj/item/ship_elements/secondary_ammo/AmmoToInsert = W
loaded_projectile = AmmoToInsert.ammo_type
loaded_projectile["type"] = AmmoToInsert.ammo_type
qdel(AmmoToInsert)
return

Expand Down
1 change: 1 addition & 0 deletions code/modules/shiptoship/sts_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@
rem_entity(type = "coord", id = "missile", coord_x = current_x_splash, coord_y = current_y_splash)
if(counter == 1) output_counter += 1
current_y_splash += 1
current_y_splash = y_to_splash_damage_min
current_x_splash += 1
if (counter == 0) return 1
if (counter == 1) return output_counter
Expand Down
47 changes: 34 additions & 13 deletions code/modules/terminal/ship/weapons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
usage_data["salvos_left"] -= 1
usage_data["primary_fired"] = 1
UpdateMapData()
terminal_parse("STATUS")
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"])
Expand All @@ -146,12 +146,12 @@
usage_data["salvos_left"] -= 1
usage_data["primary_fired"] = 1
UpdateMapData()
terminal_parse("STATUS")
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"])
else
ship_sts_to_log.WriteToShipLog(shiplog_event = "missile_launch")
else
terminal_display_line("Error: Projectile type entity already located in current position. Cannot fire primary cannon due to LD resonance.")
Expand All @@ -171,9 +171,8 @@
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.")
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])")
Expand All @@ -182,6 +181,7 @@
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/fired_secondary_ammo = linked_secondary_cannon.loaded_projectile["type"]
linked_secondary_cannon.FireCannon()
usage_data["salvos_left"] -= 1
UpdateMapData()
Expand All @@ -190,38 +190,59 @@
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")
if(ship_sts_to_log.sector_map_data["name"] != linked_master_console.sector_map_data["name"])
else
ship_sts_to_log.WriteToShipLog(shiplog_event = "secondary_fire")
switch(linked_secondary_cannon.loaded_projectile["type"])
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)
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)
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"])
ship_sts_to_log_effect.WriteToShipLog(shiplog_event = "secondary_hit")
else
terminal_display_line("No impact detected.")
if("Splash")
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")
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)
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)
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
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")
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")
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)
terminal_display_line("Direct hit detected.")
terminal_parse("STATUS")
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:Secondary Cannon not primed.")
else
terminal_display_line("Error: Out of cannon salvos in this interval.")

/obj/structure/terminal/weapons_console/terminal_parse(str)
/obj/structure/terminal/weapons_console/terminal_parse(str, no_input = 0)
var/string_to_parse = uppertext(str)
if(!string_to_parse) return "error - null string parsed"
var/starting_buffer_length = terminal_buffer.len
Expand Down Expand Up @@ -261,15 +282,15 @@
terminal_display_line("Establishing LD Protocol connection to Primary Cannon", TERMINAL_LOOKUP_SLEEP)
terminal_advanced_parse(type = "PRIMARY")
if("SECONDARY")
terminal_display_line("Establishing LD Protocol connection to Primary Cannon", TERMINAL_LOOKUP_SLEEP)
terminal_display_line("Establishing LD Protocol connection to Secondary Cannon", TERMINAL_LOOKUP_SLEEP)
terminal_advanced_parse(type = "SECONDARY")
if(starting_buffer_length == terminal_buffer.len) terminal_display_line("Error: Unknown command. Please use HELP for a list of available commands.")
terminal_input()
if(no_input == 0) terminal_input()
return "Parsing Loop End"

/obj/structure/terminal/weapons_console/attack_hand(mob/user)
if(repair_shutdown == 0)
terminal_parse("STATUS")
terminal_parse("STATUS", no_input = 1)
terminal_input()
return "Primary input loop end"
if(repair_shutdown == 1)
Expand Down
Loading

0 comments on commit 99e4ffc

Please sign in to comment.