Skip to content

Commit

Permalink
debugging, round 2
Browse files Browse the repository at this point in the history
cargo bays, primary weapons loading, modding, firing, command chair adjustments, message sending, listing issues, the goddamn kitchen sink too.
  • Loading branch information
silencer-pl committed Aug 16, 2024
1 parent cda7703 commit 73f74ef
Show file tree
Hide file tree
Showing 12 changed files with 281 additions and 175 deletions.
74 changes: 42 additions & 32 deletions code/modules/admin/mission_control/mission_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,14 @@
</div>
"}
if("Main")
dat += {"<div_class="box">
dat += {"<div class="box">
<div class="text">
<p><A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];open_mission_control=General'>Load/Save, Review and Set IC Infromation</a></p>
<p><A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];sts_control_panel=1'>Ship to Ship Control Panel</A></p>
<p>All panels and subpanels should also be reachable through the DM tab in the status window!</p>
</div>
</div>
"}
if("Comms")
if("ShipToShip")
if(!sts_master)
to_chat(usr, SPAN_WARNING("Error: No STS Master found in world. Most likely a mapping error."))
Expand All @@ -115,7 +114,9 @@
if(GLOB.sector_map_y == null) GLOB.sector_map_y = 100
sts_master.sector_map = new/list(GLOB.sector_map_x, GLOB.sector_map_y)
if(sts_master.populate_map() == 1) GLOB.sector_map_initialized = 1
dat += {"<div_class="box">
load_template()
link_player_ships()
dat += {"<div class="box">
<div class="text">
<p><b>SHIP TO SHIP PANEL</b></p>
<p><A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];toggle_sts=initialized'>INITIATED</A>: [GLOB.combat_initiated] | <A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];toggle_sts=turn'>ROUND</A>: <b>[GLOB.combat_round]</b></p>
Expand All @@ -126,7 +127,7 @@
"}
if("ShipToShip_Entities")
var/displayed_entities = (jointext((sts_master.scan_entites(category = 0, output_format = 0)), "</p><p>")+"</p><p>"+jointext((sts_master.scan_entites(category = 1, output_format = 0)), "</p><p>"))
dat += {"<div_class="box">
dat += {"<div class="box">
<div class="text">
<p><b>ENTITY_CONTROL</b></p>
<p>[displayed_entities]</p>
Expand All @@ -140,7 +141,7 @@
if("ShipToShip_RoundControl")
var/round_phase_text
var/round_next_text
dat += {"<div_class="box">
dat += {"<div class="box">
<div class="text">
<p><b>SHIP TO SHIP ROUND FLOW PANEL</b></p>
</div>
Expand All @@ -159,21 +160,21 @@
if(4)
round_phase_text = "Advancing Turn..."
if(GLOB.round_phase == 4)
dat+= {"<div_class="box">
dat+= {"<div class="box">
<div class="text">
<p>TURN ADVANCING...</p>
</div>
</div>
"}
else
dat += {"<div_class="box">
dat += {"<div class="box">
<div class="text">
<p>Round: <b><A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];toggle_sts=turn'>[GLOB.combat_round]</A></b></p>
<p>Phase: <b>[round_phase_text]</b></p>
<p><A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];next_phase=1'>[round_next_text]</A></p>
</div>
</div>
<div_class="box">
<div class="box">
<div class="text">
<p><A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];view_ship_log=round'>View Round Log</A></p>
<p><A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];view_ship_log=full'>View Full Log</A></p>
Expand All @@ -186,39 +187,39 @@
"}
if("ShipToShip_LastRoundLog")
var/log_to_display = jointext(sts_master.round_history_current, "</p><p>")
dat += {"<div_class="box">
dat += {"<div class="box">
<div class="text">
<p>Current Log Round</p>
<p>ROUND: [GLOB.combat_round]</p>
</div>
</div>
<div_class="box">
<div class="box">
<div class="text">
<p>[log_to_display]</p>
</div>
</div>
"}
if("ShipToShip_FullRoundLog")
var/log_to_display = jointext(sts_master.round_history, "</p><p>")
dat += {"<div_class="box">
dat += {"<div class="box">
<div class="text">
<p>Full StS Log</p>
</div>
</div>
<div_class="box">
<div class="box">
<div class="text">
<p>[log_to_display]</p>
</div>
</div>
"}
if("ShipToShip_PrevRoundLog")
var/log_to_display = jointext(sts_master.round_history_previous, "</p><p>")
dat += {"<div_class="box">
dat += {"<div class="box">
<div class="text">
<p>End of Round log for Round [GLOB.combat_round]</p>
</div>
</div>
<div_class="box">
<div class="box">
<div class="text">
<p>[log_to_display]</p>
</div>
Expand All @@ -232,7 +233,7 @@

usr << browse(dat,"window=mission_control_[usr]_[window];display=1;size=800x800;border=5px;can_close=1;can_resize=1;can_minimize=1;titlebar=1")
if(usr.sp_uis.Find("mission_control_[usr]_[window]") == 0)
usr.sp_uis += "mission_control_[usr]_[window]"
usr.sp_uis.Add("mission_control_[usr]_[window]")
onclose(usr, "mission_control_[usr]_[window]")

/datum/admins/proc/load_template()
Expand Down Expand Up @@ -433,7 +434,7 @@
for(var/obj/structure/shiptoship_master/sts_master_to_link in world)
sts_master = sts_master_to_link
break
if(tgui_input_list(usr, "Advance to next phase? (Current Phase: [GLOB.round_phase])", "PHASE confirmation", list("Yes","No"), timeout = 0) == "Yes")
if(tgui_alert(usr, "Advance to next phase? (Current Phase: [GLOB.round_phase])", "PHASE confirmation", list("Yes","No"), timeout = 0) == "Yes")
switch(GLOB.round_phase)
if(1)
to_chat(world, narrate_head("<b>Player Turn</b>"))
Expand Down Expand Up @@ -477,10 +478,10 @@
while(fire_scan_y <= GLOB.sector_map_y)
if(sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["id_tag"] != "none")
if(sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["status"] == "Player")
fire_targets += sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["name"]
fire_targets.Add(sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["name"])
if(sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["status"] != "Player")
if(sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["system"]["salvos_left"] > 0)
fire_sources += sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["name"]
fire_sources.Add(sts_master.sector_map[fire_scan_x][fire_scan_y]["ship"]["name"])
fire_scan_y += 1
fire_scan_y = 1
fire_scan_x += 1
Expand Down Expand Up @@ -515,9 +516,9 @@
while(secondary_scan_current_y <= secondary_scan_top_y)
if(abs(firing_ship_y - secondary_scan_current_y) + abs(firing_ship_x - secondary_scan_current_x) <= 5)
if(sts_master.sector_map[secondary_scan_current_x][secondary_scan_current_y]["ship"]["id_tag"] != "none")
secondary_targets += sts_master.sector_map[secondary_scan_current_x][secondary_scan_current_y]["ship"]["id_tag"]
secondary_targets.Add(sts_master.sector_map[secondary_scan_current_x][secondary_scan_current_y]["ship"]["id_tag"])
if(sts_master.sector_map[secondary_scan_current_x][secondary_scan_current_y]["missile"]["id_tag"] != "none")
secondary_targets += sts_master.sector_map[secondary_scan_current_x][secondary_scan_current_y]["missile"]["id_tag"]
secondary_targets.Add(sts_master.sector_map[secondary_scan_current_x][secondary_scan_current_y]["missile"]["id_tag"])
secondary_scan_current_y += 1
secondary_scan_current_y = secodnary_scan_bottom_y
secondary_scan_current_x += 1
Expand All @@ -531,7 +532,8 @@
if(sts_master.sector_map[firing_ship_x][firing_ship_y]["ship"]["missile"]["id_tag"] != "none")
to_chat(usr,SPAN_WARNING("Cannot fire Primary - Missle present at location."))
return
var/target_to_fire = tgui_input_list(usr, "Select Target", "TARGET choice", list(fire_targets,"Coordinates"), timeout = 0)
fire_targets.Add("Coordinates")
var/target_to_fire = tgui_input_list(usr, "Select Target", "TARGET choice", fire_targets, timeout = 0)
if(target_to_fire == null) return
var/fire_target_x
var/fire_target_y
Expand Down Expand Up @@ -572,7 +574,7 @@
if("Direct-Explosive")
sts_master.add_entity (entity_type = 1, x = firing_ship_x, y = firing_ship_y, name = firing_missile_name, type = "Standard Explosive", vector_x = fire_target_x, vector_y = fire_target_y, warhead_type = "Explosive", warhead_payload = firing_missile_payload, target_tag = "none", missile_speed = firing_missile_speed)
if("Direct-Nuclear")
if(tgui_input_list(usr, "Are you SURE you want to send a nuke at [target_to_fire]? Values will be overwritten with lowest, edit them directly.","NUKE Confirm", list("Yes","No"), timeout = 0) == "Yes")
if(tgui_alert(usr, "Are you SURE you want to send a nuke at [target_to_fire]? Values will be overwritten with lowest, edit them directly.","NUKE Confirm", list("Yes","No"), timeout = 0) == "Yes")
sts_master.add_entity (entity_type = 1, x = firing_ship_x, y = firing_ship_y, name = firing_missile_name, type = "Nuclear", vector_x = fire_target_x, vector_y = fire_target_y, warhead_type = "Nuclear", warhead_payload = 1, target_tag = "none", missile_speed = 1)
sts_master.log_round_history(event = "missile_launch", log_source = ship_to_fire, log_dest_x = firing_ship_x, log_dest_y = firing_ship_y)
for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_sts_to_log in world)
Expand All @@ -583,8 +585,9 @@
sts_master.sector_map[firing_ship_x][firing_ship_y]["ship"]["system"]["salvos_left"] -= 1
if("Secondary")
if(sts_master.sector_map[firing_ship_x][firing_ship_y]["ship"]["system"]["salvos_left"] == sts_master.sector_map[firing_ship_x][firing_ship_y]["ship"]["system"]["salvos_max"])
if(tgui_input_list(usr, "Confirm Secondary Fire without firing Primary?", "Secondary Fire CONFIRM", list("Yes","No"), timeout = 0) == "No") return
var/id_to_secondary_target = tgui_input_list(usr, "Select a target for Secondary fire", "Secondary TARGET", list(secondary_targets,"Vector"),timeout = 0)
if(tgui_alert(usr, "Confirm Secondary Fire without firing Primary?", "Secondary Fire CONFIRM", list("Yes","No"), timeout = 0) == "No") return
secondary_targets.Add("Vector")
var/id_to_secondary_target = tgui_input_list(usr, "Select a target for Secondary fire", "Secondary TARGET", secondary_targets,timeout = 0)
if(id_to_secondary_target == null) return
var/secondary_target_x
var/secondary_target_y
Expand Down Expand Up @@ -645,9 +648,9 @@
while(sonar_scan_y <= GLOB.sector_map_y)
if(sts_master.sector_map[sonar_scan_x][sonar_scan_y]["ship"]["id_tag"] != "none")
if(sts_master.sector_map[sonar_scan_x][sonar_scan_y]["ship"]["status"] == "Player")
sonar_player_ships += sts_master.sector_map[sonar_scan_x][sonar_scan_y]["ship"]["name"]
sonar_player_ships.Add(sts_master.sector_map[sonar_scan_x][sonar_scan_y]["ship"]["name"])
if(sts_master.sector_map[sonar_scan_x][sonar_scan_y]["ship"]["status"] != "Player")
sonar_npc_ships += sts_master.sector_map[sonar_scan_x][sonar_scan_y]["ship"]["name"]
sonar_npc_ships.Add(sts_master.sector_map[sonar_scan_x][sonar_scan_y]["ship"]["name"])
sonar_scan_y += 1
sonar_scan_y = 1
sonar_scan_x += 1
Expand Down Expand Up @@ -690,7 +693,7 @@
while(control_scan_y <= GLOB.sector_map_y)
if(sts_master.sector_map[control_scan_x][control_scan_y]["ship"]["id_tag"] != "none")
if(sts_master.sector_map[control_scan_x][control_scan_y]["ship"]["status"] != "Player")
control_npc_ships += sts_master.sector_map[control_scan_x][control_scan_y]["ship"]["name"]
control_npc_ships.Add(sts_master.sector_map[control_scan_x][control_scan_y]["ship"]["name"])
control_scan_y += 1
control_scan_y = 1
control_scan_x += 1
Expand Down Expand Up @@ -728,13 +731,16 @@
while(comms_scan_y <= GLOB.sector_map_y)
if(sts_master.sector_map[comms_scan_x][comms_scan_y]["ship"]["id_tag"] != "none")
if(sts_master.sector_map[comms_scan_x][comms_scan_y]["ship"]["status"] == "Player")
comms_player_ships += sts_master.sector_map[comms_scan_x][comms_scan_y]["ship"]["name"]
comms_player_ships.Add(sts_master.sector_map[comms_scan_x][comms_scan_y]["ship"]["name"])
if(sts_master.sector_map[comms_scan_x][comms_scan_y]["ship"]["status"] != "Player")
comms_npc_ships += sts_master.sector_map[comms_scan_x][comms_scan_y]["ship"]["name"]
comms_npc_ships.Add(sts_master.sector_map[comms_scan_x][comms_scan_y]["ship"]["name"])
comms_scan_y += 1
comms_scan_y = 1
comms_scan_x += 1
var/comms_source = tgui_input_list(usr, "Select Message Sender","Sender Select",list(comms_npc_ships,"Custom"),timeout = 0)
var/list/final_source_list = list()
final_source_list.Add(comms_npc_ships)
final_source_list.Add("Vector")
var/comms_source = tgui_input_list(usr, "Select Message Sender","Sender Select",final_source_list,timeout = 0)
var/comms_source_x
var/comms_source_y
var/comms_source_custom
Expand All @@ -744,7 +750,11 @@
if(comms_source == "Custom")
comms_source_custom = tgui_input_text(usr, "Enter Name of comms source, will be displayed on all player comms consoles", "Custom Comms Source", timeout = 0)
if(comms_source_custom == null) comms_source_custom = "Unknown"
var/comms_dest = tgui_input_list(usr, "Select Message Destination", "Destination Select", list(comms_player_ships,comms_npc_ships,"System-Wide"))
var/list/final_destination_list = list()
final_destination_list.Add(comms_player_ships)
final_destination_list.Add(comms_npc_ships)
final_destination_list.Add("System-Wide")
var/comms_dest = tgui_input_list(usr, "Select Message Destination", "Destination Select", final_destination_list, timeout = 0)
if(comms_dest == null) return
if(comms_source != "Custom")
comms_scan_x = 1
Expand Down Expand Up @@ -841,7 +851,7 @@
var/list/comms_destination = list("Everyone")
for(var/obj/structure/shiptoship_master/ship_missioncontrol/ship_mc_to_comm_list in world)
if(ship_mc_to_comm_list.sector_map_data["initialized"] == 1)
comms_destination += ship_mc_to_comm_list.sector_map_data["name"]
comms_destination.Add(ship_mc_to_comm_list.sector_map_data["name"])
var/comms_destination_choice
if(comms_destination.len <= 1)
comms_destination_choice = "Everyone"
Expand Down
8 changes: 4 additions & 4 deletions code/modules/shiptoship/ship/ship_cargo_bay.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
if(state_to_animate == null)
switch(icon_state)
if("cargo_bay_open")
state_to_animate = "open"
if("cargo_bay_closed")
state_to_animate = "close"
if("cargo_bay_closed")
state_to_animate = "open"
switch(state_to_animate)
if("open")
icon_state = "cargo_bay_opening"
Expand All @@ -42,8 +42,8 @@
if(object_to_dispense == null) return
AnimateUse(state = "open")
new object_to_dispense(get_turf(src))
sleep(100)
AnimateUse()
sleep(50)
AnimateUse(state = "close")
return 1

/obj/structure/ship_elements/cargo_bay/proc/RecieveObject(object_to_recieve as obj)
Expand Down
23 changes: 12 additions & 11 deletions code/modules/shiptoship/ship/ship_command_chair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var/obj/structure/ship_elements/command_monitor/bottom/linked_bot_screen
var/ship_name = "none"
var/repair_shutdown = 0
var/window_size = "500x300"

/obj/structure/ship_elements/command_chair/proc/ProcessShutdown(status = null)
switch(status)
Expand Down Expand Up @@ -44,18 +45,21 @@
for(var/obj/structure/ship_elements/command_monitor/top/top_to_link in area_contents)
if(top_to_link.ship_name == linked_master_console.sector_map_data["name"])
linked_top_screen = top_to_link
linked_top_screen.linked_command_chair = src
to_chat(world, SPAN_INFO("Top Moniotor for ship [linked_master_console.sector_map_data["name"]] loaded."))
break
if(!linked_front_screen)
for(var/obj/structure/ship_elements/command_monitor/front/front_to_link in area_contents)
if(front_to_link.ship_name == linked_master_console.sector_map_data["name"])
linked_front_screen = front_to_link
linked_front_screen.linked_command_chair = src
to_chat(world, SPAN_INFO("Front Monitor for ship [linked_master_console.sector_map_data["name"]] loaded."))
break
if(!linked_bot_screen)
for(var/obj/structure/ship_elements/command_monitor/bottom/bot_to_link in area_contents)
if(bot_to_link.ship_name == linked_master_console.sector_map_data["name"])
linked_bot_screen = bot_to_link
linked_bot_screen.linked_command_chair = src
to_chat(world, SPAN_INFO("Bottom Monitor for ship [linked_master_console.sector_map_data["name"]] loaded."))
break

Expand Down Expand Up @@ -84,18 +88,11 @@
}
</head>
</style>
<body>
<div id="main_window">
<div class="box">
<div class="text">
<p style="font-size: 120%;">
<b>SECTOR PATROL DM PANEL</b>
</p>
</div>
</div>
"}
//content
dat += {"
<body>
<div id="main_window"
<div class="box">
<div class="text">
"}
Expand Down Expand Up @@ -144,9 +141,12 @@
"}
if("ship_status")
var/ship_status = jointext(linked_master_console.GetStatusReadout(), "</p><p>")
window_size = "500x400"
dat +={"<p><b>Systems Integrity:</b></p>
<p>[ship_status]</p>
"}
else
return
dat += {"</div>
</div>
"}
Expand All @@ -155,9 +155,10 @@
</div>
</body>
"}
buckled_mob << browse(dat,"window=commander_console_[usr]_[type];display=1;size=800x800;border=5px;can_close=1;can_resize=1;can_minimize=1;titlebar=1")
buckled_mob << browse(dat,"window=commander_console_[usr]_[type];display=1;size=[window_size];border=5px;can_close=1;can_resize=1;can_minimize=1;titlebar=1")
window_size = initial(window_size)
if(buckled_mob.sp_uis.Find("commander_console_[usr]_[type]") == 0)
buckled_mob.sp_uis += "commander_console_[usr]_[type]"
buckled_mob.sp_uis.Add("commander_console_[usr]_[type]")
onclose(buckled_mob, "commander_console_[usr]_[type]")

/obj/structure/ship_elements/command_chair/proc/turn_off_check()
Expand Down
Loading

0 comments on commit 73f74ef

Please sign in to comment.