Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GM control for spawned xeno hive #95

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion code/modules/admin/game_master/game_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
// Spawn stuff
#define DEFAULT_SPAWN_XENO_STRING XENO_CASTE_DRONE
#define GAME_MASTER_AI_XENOS list(XENO_CASTE_DRONE, XENO_CASTE_RUNNER, XENO_CASTE_LURKER, XENO_CASTE_CRUSHER)
#define DEFAULT_SPAWN_HIVE_STRING XENO_HIVE_NORMAL

#define DEFAULT_XENO_AMOUNT_TO_SPAWN 1

Expand Down Expand Up @@ -71,6 +72,9 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
/// The xeno selected to be spawned in the spawn section
var/selected_xeno = DEFAULT_SPAWN_XENO_STRING

/// The hive selected to be spawned in the spawn section
var/selected_hive = DEFAULT_SPAWN_HIVE_STRING

/// The amount of xenos to spawn in the spawn section
var/xeno_spawn_count = DEFAULT_XENO_AMOUNT_TO_SPAWN

Expand Down Expand Up @@ -139,6 +143,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

// Spawn stuff
data["selected_xeno"] = selected_xeno
data["selected_hive"] = selected_hive
data["spawn_ai"] = spawn_ai
data["spawn_click_intercept"] = spawn_click_intercept
data["xeno_spawn_count"] = xeno_spawn_count
Expand All @@ -163,6 +168,8 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

data["spawnable_xenos"] = GAME_MASTER_AI_XENOS

data["spawnable_hives"] = ALL_XENO_HIVES

data["selectable_behaviors"] = SELECTABLE_XENO_BEHAVIORS

return data
Expand All @@ -186,6 +193,11 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
xeno_spawn_count = DEFAULT_XENO_AMOUNT_TO_SPAWN
return

if("set_selected_hive")
selected_hive = params["new_hive"]
xeno_spawn_count = DEFAULT_XENO_AMOUNT_TO_SPAWN
return

if("xeno_spawn_ai_toggle")
spawn_ai = !spawn_ai
return
Expand Down Expand Up @@ -337,7 +349,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)
var/turf/spawn_turf = get_turf(object)

for(var/i = 1 to xeno_spawn_count)
new spawning_xeno_type(spawn_turf, null, XENO_HIVE_NORMAL, !spawn_ai)
new spawning_xeno_type(spawn_turf, null, selected_hive, !spawn_ai)

return TRUE

Expand Down Expand Up @@ -449,6 +461,7 @@ GLOBAL_VAR_INIT(radio_communication_clarity, 100)

#undef DEFAULT_SPAWN_XENO_STRING
#undef GAME_MASTER_AI_XENOS
#undef DEFAULT_SPAWN_HIVE_STRING
#undef DEFAULT_XENO_AMOUNT_TO_SPAWN

#undef OBJECTIVE_NUMBER_OPTIONS
Expand Down
25 changes: 22 additions & 3 deletions code/modules/admin/game_master/game_master_submenu/ambush.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#define DEFAULT_SPAWN_XENO_STRING XENO_CASTE_DRONE
#define GAME_MASTER_AMBUSH_AI_XENOS list(XENO_CASTE_DRONE, XENO_CASTE_RUNNER, XENO_CASTE_LURKER)
#define DEFAULT_SPAWN_HIVE_STRING XENO_HIVE_NORMAL

#define DEFAULT_XENO_AMOUNT_TO_SPAWN 1

Expand All @@ -16,9 +17,15 @@
/// Current selected xeno string to spawn when we hit spawn
var/selected_xeno = DEFAULT_SPAWN_XENO_STRING

/// Current selected hive string to spawn when we hit spawn
var/selected_hive = DEFAULT_SPAWN_HIVE_STRING

/// Current xenos to spawn in an ambush, organized as xeno_type = number_to_spawn
var/list/current_ambush = list()

/// Current hive to spawn in an ambush
var/current_ambushing_hive = DEFAULT_SPAWN_HIVE_STRING

/// Current info on the ambush passed to the menu
var/ambush_info = "No Current Ambush"

Expand Down Expand Up @@ -55,6 +62,7 @@

data["xeno_spawn_count"] = xeno_spawn_count
data["selected_xeno"] = selected_xeno
data["selected_hive"] = selected_hive
data["ambush_info"] = ambush_info

return data
Expand All @@ -66,6 +74,8 @@

data["spawnable_xenos"] = GAME_MASTER_AMBUSH_AI_XENOS

data["spawnable_hives"] = ALL_XENO_HIVES

return data

/datum/game_master_submenu/ambush/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
Expand All @@ -85,6 +95,11 @@
xeno_spawn_count = DEFAULT_XENO_AMOUNT_TO_SPAWN
return TRUE

if("set_selected_hive")
selected_hive = params["new_hive"]
xeno_spawn_count = DEFAULT_XENO_AMOUNT_TO_SPAWN
return TRUE

if("ambush")
setup_ambush()
return TRUE
Expand Down Expand Up @@ -126,18 +141,21 @@

temp_string = copytext(temp_string, 1, -2)

temp_string += " of [selected_hive]"

ambush_info = temp_string

SEND_SIGNAL(referenced_atom, COMSIG_GAME_MASTER_AMBUSH_SET, current_ambush.Copy(), ambush_info)
SEND_SIGNAL(referenced_atom, COMSIG_GAME_MASTER_AMBUSH_SET, current_ambush.Copy(), selected_hive, ambush_info)

primary = TRUE

/datum/game_master_submenu/ambush/proc/other_ambush_set(atom/movable/other_parent, new_ambush, new_ambush_info)
/datum/game_master_submenu/ambush/proc/other_ambush_set(atom/movable/other_parent, new_ambush, new_hive, new_ambush_info)
SIGNAL_HANDLER

primary = FALSE

current_ambush = new_ambush
current_ambushing_hive = new_hive
ambush_info = new_ambush_info

#define AMBUSH_ESCAPE_INCREMENT_TIME (1 SECONDS)
Expand Down Expand Up @@ -187,12 +205,13 @@

playsound(referenced_atom, pick(ambush_sounds), 25, 1)

new xeno_type(spawn_turf, null, XENO_HIVE_NORMAL)
new xeno_type(spawn_turf, null, selected_hive)

/// Shakes the spawner via animation and returns a callback to reset the animation
/datum/game_master_submenu/ambush/proc/shake_spawner()
return

#undef DEFAULT_SPAWN_XENO_STRING
#undef GAME_MASTER_AMBUSH_AI_XENOS
#undef DEFAULT_SPAWN_HIVE_STRING
#undef DEFAULT_XENO_AMOUNT_TO_SPAWN
10 changes: 10 additions & 0 deletions tgui/packages/tgui/interfaces/GameMaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ export const GameMasterSpawningPanel = (props, context) => {
}}
/>
</Stack.Item>
<Stack.Item>
<Dropdown
options={data.spawnable_hives}
selected={data.selected_hive}
width="15rem"
onSelected={(new_hive) => {
act('set_selected_hive', { new_hive });
}}
/>
</Stack.Item>
</Stack>
</Stack.Item>
<Stack.Item>
Expand Down
10 changes: 10 additions & 0 deletions tgui/packages/tgui/interfaces/GameMasterSubmenuAmbush.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ export const GameMasterSubmenuAmbushSpawningPanel = (props, context) => {
}}
/>
</Stack.Item>
<Stack.Item>
<Dropdown
options={data.spawnable_hives}
selected={data.selected_hive}
width="15rem"
onSelected={(new_hive) => {
act('set_selected_hive', { new_hive });
}}
/>
</Stack.Item>
</Stack>
</Stack.Item>
<Stack.Item>
Expand Down
Loading