diff --git a/code/game/gamemodes/colonialmarines/ai/colonialmarines_ai.dm b/code/game/gamemodes/colonialmarines/ai/colonialmarines_ai.dm index 8e4563f636..79ddc146e9 100644 --- a/code/game/gamemodes/colonialmarines/ai/colonialmarines_ai.dm +++ b/code/game/gamemodes/colonialmarines/ai/colonialmarines_ai.dm @@ -46,9 +46,12 @@ /datum/game_mode/colonialmarines/ai/end_round_message() return ..() -/datum/game_mode/colonialmarines/ai/proc/handle_xeno_spawn(datum/source, mob/living/carbon/xenomorph/X) +/datum/game_mode/colonialmarines/ai/proc/handle_xeno_spawn(datum/source, mob/living/carbon/xenomorph/spawning_xeno, ai_hard_off = FALSE) SIGNAL_HANDLER - X.make_ai() + if(ai_hard_off) + return + + spawning_xeno.make_ai() /datum/game_mode/colonialmarines/ai/check_win() if(!game_started || round_finished || SSticker.current_state != GAME_STATE_PLAYING) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 5554aba066..e609aee4b9 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -325,6 +325,7 @@ var/list/roundstart_mod_verbs = list( add_verb(src, /datum/admins/proc/imaginary_friend) if(CLIENT_HAS_RIGHTS(src, R_BUILDMODE)) add_verb(src, /client/proc/togglebuildmodeself) + add_verb(src, /client/proc/toggle_game_master) if(CLIENT_HAS_RIGHTS(src, R_SERVER)) add_verb(src, admin_verbs_server) if(CLIENT_HAS_RIGHTS(src, R_DEBUG)) @@ -354,6 +355,7 @@ var/list/roundstart_mod_verbs = list( remove_verb(src, list( admin_verbs_default, /client/proc/togglebuildmodeself, + /client/proc/toggle_game_master, admin_verbs_admin, admin_verbs_ban, admin_verbs_minor_event, diff --git a/code/modules/admin/game_master.dm b/code/modules/admin/game_master.dm new file mode 100644 index 0000000000..1f65e33ae1 --- /dev/null +++ b/code/modules/admin/game_master.dm @@ -0,0 +1,131 @@ +/proc/open_game_master_panel(client/using_client) + set name = "Game Master Panel" + set category = "Game Master" + + new /datum/game_master(using_client) + + +/client/proc/toggle_game_master() + set name = "Game Master Panel" + set category = "Game Master" + if(!check_rights(R_ADMIN)) + return + + if(src) + open_game_master_panel(src) + + +#define DEFAULT_SPAWN_XENO_STRING XENO_CASTE_DRONE +#define GAME_MASTER_AI_XENOS list(XENO_CASTE_DRONE, XENO_CASTE_RUNNER, XENO_CASTE_CRUSHER) + +#define DEFAULT_XENO_AMOUNT_TO_SPAWN 1 + +#define SPAWN_CLICK_INTERCEPT_ACTION "spawn_click_intercept_action" + +/datum/game_master + + var/selected_xeno = DEFAULT_SPAWN_XENO_STRING + var/xenos_to_spawn = DEFAULT_XENO_AMOUNT_TO_SPAWN + var/spawn_ai = TRUE + var/spawn_click_intercept = FALSE + + var/current_click_intercept_action + +/datum/game_master/New(client/using_client) + . = ..() + + if(using_client.mob) + tgui_interact(using_client.mob) + +/datum/game_master/Destroy(force, ...) + . = ..() + +/datum/game_master/ui_data(mob/user) + . = ..() + + var/list/data = list() + + data["selected_xeno"] = selected_xeno + data["spawn_ai"] = spawn_ai + data["spawn_click_intercept"] = spawn_click_intercept + + return data + + +/datum/game_master/ui_static_data(mob/user) + . = ..() + + var/list/data = list() + + data["default_spawnable_xeno_string"] = DEFAULT_SPAWN_XENO_STRING + data["spawnable_xenos"] = GAME_MASTER_AI_XENOS + + return data + + +/datum/game_master/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + + switch(action) + if("toggle_click_spawn") + var/client/user_client = ui.user.client + if(user_client.click_intercept == src) + user_client.click_intercept = null + spawn_click_intercept = FALSE + current_click_intercept_action = null + return + + user_client.click_intercept = src + spawn_click_intercept = TRUE + current_click_intercept_action = SPAWN_CLICK_INTERCEPT_ACTION + return + + if("xeno_spawn_ai_toggle") + spawn_ai = !spawn_ai + return + + if("set_selected_xeno") + selected_xeno = params["new_xeno"] + return + + if("set_xeno_spawns") + var/new_number = text2num(params["value"]) + if(!new_number) + return + + xenos_to_spawn = clamp(new_number, 1, 10) + return + +/datum/game_master/ui_close(mob/user) + . = ..() + + var/client/user_client = user.client + if(user_client?.click_intercept == src) + user_client.click_intercept = null + + qdel(src) + +/datum/game_master/ui_status(mob/user, datum/ui_state/state) + return UI_INTERACTIVE + +/datum/game_master/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "GameMaster", "Game Master Menu") + ui.open() + +/datum/game_master/proc/InterceptClickOn(mob/user, params, atom/object) + switch(current_click_intercept_action) + if(SPAWN_CLICK_INTERCEPT_ACTION) + var/spawning_xeno_type = RoleAuthority.get_caste_by_text(selected_xeno) + + if(!spawning_xeno_type) + to_chat(user, SPAN_NOTICE(SPAN_BOLD("Unable to find xeno type by name: [selected_xeno]"))) + return + + var/turf/spawn_turf = get_turf(object) + + for(var/i = 1 to xenos_to_spawn) + new spawning_xeno_type(spawn_turf, null, XENO_HIVE_NORMAL, !spawn_ai) + + return diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index 90c22e19c4..2d2853e7ac 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -359,7 +359,7 @@ var/atom/movable/vis_obj/xeno_wounds/wound_icon_carrier var/atom/movable/vis_obj/xeno_pack/backpack_icon_carrier -/mob/living/carbon/xenomorph/Initialize(mapload, mob/living/carbon/xenomorph/oldXeno, h_number) +/mob/living/carbon/xenomorph/Initialize(mapload, mob/living/carbon/xenomorph/oldXeno, h_number, ai_hard_off = FALSE) var/area/A = get_area(src) if(A && A.statistic_exempt) statistic_exempt = TRUE @@ -513,7 +513,7 @@ Decorate() RegisterSignal(src, COMSIG_MOB_SCREECH_ACT, PROC_REF(handle_screech_act)) - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_XENO_SPAWN, src) + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_XENO_SPAWN, src, ai_hard_off) /mob/living/carbon/xenomorph/proc/handle_screech_act(mob/self, mob/living/carbon/xenomorph/queen/queen) SIGNAL_HANDLER diff --git a/colonialmarines.dme b/colonialmarines.dme index bd831d893e..890a339b19 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1319,6 +1319,7 @@ s// DM Environment file for colonialmarines.dme. #include "code\modules\admin\create_object.dm" #include "code\modules\admin\create_turf.dm" #include "code\modules\admin\fax_templates.dm" +#include "code\modules\admin\game_master.dm" #include "code\modules\admin\holder2.dm" #include "code\modules\admin\IsBanned.dm" #include "code\modules\admin\NewBan.dm" diff --git a/tgui/packages/tgui/interfaces/GameMaster.js b/tgui/packages/tgui/interfaces/GameMaster.js new file mode 100644 index 0000000000..7a4c158695 --- /dev/null +++ b/tgui/packages/tgui/interfaces/GameMaster.js @@ -0,0 +1,63 @@ +import { useBackend } from '../backend'; +import { Flex, Dropdown, Button, Section } from '../components'; +import { Window } from '../layouts'; + +export const GameMaster = (props, context) => { + const { data, act } = useBackend(context); + + return ( + + +
+ + + + + { + act('set_xeno_spawns', { value }); + }} + /> + + + { + act('set_selected_xeno', { new_xeno }); + }} + /> + + + + + + + { + act('xeno_spawn_ai_toggle'); + }} + /> + + +
+
+
+ ); +};