From 9a7c26be7a233444b8dd0ca95dd50d6f6102b0d1 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Fri, 28 Jun 2024 20:23:05 -0400 Subject: [PATCH 1/3] initial --- code/modules/admin/admin_verbs.dm | 2 + code/modules/admin/game_master/resin_panel.dm | 157 ++++++++++++++++++ code/modules/cm_aliens/weeds.dm | 6 +- .../xenomorph/abilities/general_powers.dm | 2 +- colonialmarines.dme | 1 + tgui/packages/tgui/interfaces/ResinPanel.tsx | 92 ++++++++++ 6 files changed, 256 insertions(+), 4 deletions(-) create mode 100644 code/modules/admin/game_master/resin_panel.dm create mode 100644 tgui/packages/tgui/interfaces/ResinPanel.tsx diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 50cb19a7e9..6e47391fc1 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -330,6 +330,7 @@ var/list/roundstart_mod_verbs = list( if(CLIENT_HAS_RIGHTS(src, R_BUILDMODE)) add_verb(src, /client/proc/togglebuildmodeself) add_verb(src, /client/proc/toggle_game_master) + add_verb(src, /client/proc/open_resin_panel) add_verb(src, /client/proc/open_sound_panel) add_verb(src, /client/proc/toggle_join_xeno) add_verb(src, /client/proc/game_master_rename_platoon) @@ -365,6 +366,7 @@ var/list/roundstart_mod_verbs = list( admin_verbs_default, /client/proc/togglebuildmodeself, /client/proc/toggle_game_master, + /client/proc/open_resin_panel, /client/proc/open_sound_panel, /client/proc/toggle_join_xeno, /client/proc/game_master_rename_platoon, diff --git a/code/modules/admin/game_master/resin_panel.dm b/code/modules/admin/game_master/resin_panel.dm new file mode 100644 index 0000000000..1a551c321b --- /dev/null +++ b/code/modules/admin/game_master/resin_panel.dm @@ -0,0 +1,157 @@ +#define RESIN_PANEL_CONSTRUCTIONS \ +list( \ + /datum/resin_construction/resin_turf/wall, \ + /datum/resin_construction/resin_turf/wall/thick, \ + /datum/resin_construction/resin_turf/wall/reflective, \ + /datum/resin_construction/resin_turf/membrane, \ + /datum/resin_construction/resin_turf/membrane/thick, \ + /datum/resin_construction/resin_obj/door, \ + /datum/resin_construction/resin_obj/door/thick, \ + /datum/resin_construction/resin_obj/resin_node, \ + /datum/resin_construction/resin_obj/sticky_resin, \ + /datum/resin_construction/resin_obj/fast_resin, \ + /datum/resin_construction/resin_obj/resin_spike, \ + /datum/resin_construction/resin_obj/acid_pillar \ +) + +/client/proc/open_resin_panel() + set name = "Resin Panel" + set category = "Game Master" + + if(!check_rights(R_ADMIN)) + return + + new /datum/resin_panel(usr) + +/datum/resin_panel + var/static/list/constructions_list + var/selected_hive = XENO_HIVE_NORMAL + var/selected_resin + var/client/holder + var/build_click_intercept = FALSE + +/datum/resin_panel/New(user) + if(isnull(constructions_list)) //first run, init statics + constructions_list = get_constructions() + + if(isclient(user)) + holder = user + else + var/mob/mob = user + holder = mob.client + + holder.click_intercept = src + tgui_interact(holder.mob) + +/datum/resin_panel/proc/get_constructions() + var/list/constructions = list() + for(var/datum/resin_construction/RC as anything in RESIN_PANEL_CONSTRUCTIONS) + var/list/entry = list() + + entry["name"] = RC.name + entry["desc"] = RC.desc + entry["image"] = replacetext(RC.construction_name, " ", "-") + entry["plasma_cost"] = RC.cost + entry["max_per_xeno"] = RC.max_per_xeno + entry["id"] = "[RC]" + + constructions += list(entry) + + return constructions + +/datum/resin_panel/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/choose_resin), + ) + +/datum/resin_panel/ui_static_data(mob/user) + var/list/data = list() + + data["constructions_list"] = constructions_list + data["hives_list"] = ALL_XENO_HIVES + + return data + +/datum/resin_panel/ui_data(mob/user) + var/list/data = list() + + data["selected_resin"] = selected_resin + data["selected_hive"] = selected_hive + data["build_click_intercept"] = build_click_intercept + + return data + +/datum/resin_panel/ui_close(mob/user) + holder = null + build_click_intercept = FALSE + qdel(src) + +/datum/resin_panel/ui_state(mob/user) + return GLOB.admin_state + +/datum/resin_panel/ui_status(mob/user, datum/ui_state/state) + return UI_INTERACTIVE + +/datum/resin_panel/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "ResinPanel", "Resin Panel") + ui.set_autoupdate(FALSE) + ui.open() + +/datum/resin_panel/proc/InterceptClickOn(mob/user, params, atom/object) + if(!build_click_intercept) + return + + var/turf/current_turf = get_turf(object) + + /* + if(SSinterior.in_interior(current_turf)) + to_chat(user, SPAN_XENOWARNING("It's too tight in here to build.")) + return + */ + + var/datum/resin_construction/construction = GLOB.resin_constructions_list[selected_resin] + + /* + if(!construction.can_build_here(current_turf, user)) + return + */ + + /* + var/obj/effect/alien/weeds/alien_weeds = current_turf.weeds + if(!alien_weeds || alien_weeds.secreting) + return + */ + + var/atom/new_resin = construction.build(current_turf, selected_hive) + new_resin.add_hiddenprint(user) //so admins know who placed it + + return TRUE + +/datum/resin_panel/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) + return + + if(!check_rights(R_ADMIN)) + return + + switch(action) + if("set_selected_resin") + var/selected_type = text2path(params["type"]) + if(!(selected_type in RESIN_PANEL_CONSTRUCTIONS)) + return + selected_resin = selected_type + return TRUE + if("set_selected_hive") + var/hive = params["selected_hive"] + if(!(hive in ALL_XENO_HIVES)) + return + selected_hive = hive + return TRUE + if("toggle_build_click_intercept") + build_click_intercept = !build_click_intercept + return TRUE + +#undef RESIN_PANEL_CONSTRUCTIONS diff --git a/code/modules/cm_aliens/weeds.dm b/code/modules/cm_aliens/weeds.dm index 736d4f9474..9d15211f21 100644 --- a/code/modules/cm_aliens/weeds.dm +++ b/code/modules/cm_aliens/weeds.dm @@ -511,9 +511,9 @@ overlay_node = TRUE overlays += staticnode -/obj/effect/alien/weeds/node/Initialize(mapload, obj/effect/alien/weeds/node/node, mob/living/carbon/xenomorph/xeno, datum/hive_status/hive) - if (istype(hive)) - linked_hive = hive +/obj/effect/alien/weeds/node/Initialize(mapload, hive, mob/living/carbon/xenomorph/xeno) + if (hive) + linked_hive = GLOB.hive_datum[hive] else if (istype(xeno) && xeno.hive) linked_hive = xeno.hive else diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm index 958e0f7a2f..aa8bf7eae6 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm @@ -67,7 +67,7 @@ xeno.visible_message(SPAN_XENONOTICE("\The [xeno] regurgitates a pulsating node and plants it on the ground!"), \ SPAN_XENONOTICE("You regurgitate a pulsating node and plant it on the ground!"), null, 5) - var/obj/effect/alien/weeds/node/new_node = new node_type(xeno.loc, src, xeno) + var/obj/effect/alien/weeds/node/new_node = new node_type(xeno.loc, xeno.hivenumber, xeno) if(to_convert) for(var/cur_weed in to_convert) diff --git a/colonialmarines.dme b/colonialmarines.dme index d75338ecfe..58cee33fcf 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1388,6 +1388,7 @@ #include "code\modules\admin\ToRban.dm" #include "code\modules\admin\game_master\game_master.dm" #include "code\modules\admin\game_master\game_master_submenu.dm" +#include "code\modules\admin\game_master\resin_panel.dm" #include "code\modules\admin\game_master\sound_panel.dm" #include "code\modules\admin\game_master\extra_buttons\rappel_menu.dm" #include "code\modules\admin\game_master\extra_buttons\rename_platoon.dm" diff --git a/tgui/packages/tgui/interfaces/ResinPanel.tsx b/tgui/packages/tgui/interfaces/ResinPanel.tsx new file mode 100644 index 0000000000..9a1b5df142 --- /dev/null +++ b/tgui/packages/tgui/interfaces/ResinPanel.tsx @@ -0,0 +1,92 @@ +import { useBackend } from 'tgui/backend'; +import { Box, Button, Dropdown, Section, Stack, Tabs } from 'tgui/components'; +import { Window } from 'tgui/layouts'; +import { BooleanLike, classes } from 'common/react'; + +interface ResinPanelData { + constructions_list: ConstructionsEntry[]; + hives_list: string[]; + selected_resin: string; + selected_hive: string; + build_click_intercept: BooleanLike; +} + +interface ConstructionsEntry { + name: string; + desc: string; + image: string; + id: string; +} + +export const ResinPanel = (props, context) => { + const { act, data } = useBackend(context); + const { + constructions_list, + hives_list, + selected_resin, + selected_hive, + build_click_intercept, + } = data; + + let compact = false; + + return ( + + +
+ +
+
+
+ ); +}; From ea45c52634be7db62d6dad74f8235d4743a4cd12 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Tue, 2 Jul 2024 23:28:51 -0400 Subject: [PATCH 2/3] remove with mmb, skeletal resin when in click mode can remove placeable structures with mmb, skeletal resin can now be placed, can handle other turfs --- code/modules/admin/game_master/resin_panel.dm | 106 +++++++++++------- tgui/packages/tgui/interfaces/ResinPanel.tsx | 21 ++-- 2 files changed, 74 insertions(+), 53 deletions(-) diff --git a/code/modules/admin/game_master/resin_panel.dm b/code/modules/admin/game_master/resin_panel.dm index 1a551c321b..80d8c82eab 100644 --- a/code/modules/admin/game_master/resin_panel.dm +++ b/code/modules/admin/game_master/resin_panel.dm @@ -1,8 +1,9 @@ -#define RESIN_PANEL_CONSTRUCTIONS \ +#define RESIN_PANEL_STRUCTURES \ list( \ /datum/resin_construction/resin_turf/wall, \ /datum/resin_construction/resin_turf/wall/thick, \ /datum/resin_construction/resin_turf/wall/reflective, \ + /turf/closed/wall/mineral/bone_resin, \ /datum/resin_construction/resin_turf/membrane, \ /datum/resin_construction/resin_turf/membrane/thick, \ /datum/resin_construction/resin_obj/door, \ @@ -24,15 +25,24 @@ list( \ new /datum/resin_panel(usr) /datum/resin_panel - var/static/list/constructions_list + var/static/list/structure_list + var/static/list/removal_allowlist + var/selected_structure var/selected_hive = XENO_HIVE_NORMAL - var/selected_resin var/client/holder var/build_click_intercept = FALSE /datum/resin_panel/New(user) - if(isnull(constructions_list)) //first run, init statics - constructions_list = get_constructions() + if(isnull(structure_list)) //first run, init statics + structure_list = get_structures() + + removal_allowlist = list() + for(var/structure as anything in RESIN_PANEL_STRUCTURES) + if(structure in GLOB.resin_constructions_list) + var/datum/resin_construction/construct = structure + removal_allowlist += construct.build_path + else + removal_allowlist += structure if(isclient(user)) holder = user @@ -43,21 +53,29 @@ list( \ holder.click_intercept = src tgui_interact(holder.mob) -/datum/resin_panel/proc/get_constructions() - var/list/constructions = list() - for(var/datum/resin_construction/RC as anything in RESIN_PANEL_CONSTRUCTIONS) +/datum/resin_panel/proc/get_structures() + var/list/structures = list() + for(var/structure as anything in RESIN_PANEL_STRUCTURES) var/list/entry = list() - entry["name"] = RC.name - entry["desc"] = RC.desc - entry["image"] = replacetext(RC.construction_name, " ", "-") - entry["plasma_cost"] = RC.cost - entry["max_per_xeno"] = RC.max_per_xeno - entry["id"] = "[RC]" - - constructions += list(entry) - - return constructions + if(structure in GLOB.resin_constructions_list) + var/datum/resin_construction/construct = structure + entry["name"] = construct.name + entry["image"] = replacetext(construct.construction_name, " ", "-") + entry["id"] = "[construct]" + else if(structure in typesof(/turf)) + var/turf/turf = structure + entry["name"] = turf.name + switch(turf) + if(/turf/closed/wall/mineral/bone_resin) + entry["image"] = "reflective-resin-wall" //looks just like it, saves on making new spritesheet for one image + else + entry["image"] = turf.icon_state + entry["id"] = "[turf]" + + structures += list(entry) + + return structures /datum/resin_panel/ui_assets(mob/user) return list( @@ -67,7 +85,7 @@ list( \ /datum/resin_panel/ui_static_data(mob/user) var/list/data = list() - data["constructions_list"] = constructions_list + data["structure_list"] = structure_list data["hives_list"] = ALL_XENO_HIVES return data @@ -75,7 +93,7 @@ list( \ /datum/resin_panel/ui_data(mob/user) var/list/data = list() - data["selected_resin"] = selected_resin + data["selected_structure"] = selected_structure data["selected_hive"] = selected_hive data["build_click_intercept"] = build_click_intercept @@ -103,29 +121,31 @@ list( \ if(!build_click_intercept) return - var/turf/current_turf = get_turf(object) + var/list/modifiers = params2list(params) - /* - if(SSinterior.in_interior(current_turf)) - to_chat(user, SPAN_XENOWARNING("It's too tight in here to build.")) - return - */ + if(LAZYACCESS(modifiers, MIDDLE_CLICK)) //remove + if(!(object.type in removal_allowlist)) + return - var/datum/resin_construction/construction = GLOB.resin_constructions_list[selected_resin] + if(isturf(object)) + var/turf/turf = object + turf.ScrapeAway() + else + qdel(object) + else //add + if(!selected_structure) + return - /* - if(!construction.can_build_here(current_turf, user)) - return - */ - - /* - var/obj/effect/alien/weeds/alien_weeds = current_turf.weeds - if(!alien_weeds || alien_weeds.secreting) - return - */ + var/turf/current_turf = get_turf(object) - var/atom/new_resin = construction.build(current_turf, selected_hive) - new_resin.add_hiddenprint(user) //so admins know who placed it + var/atom/new_structure + if(selected_structure in GLOB.resin_constructions_list) + var/datum/resin_construction/construct = GLOB.resin_constructions_list[selected_structure] + new_structure = construct.build(current_turf, selected_hive) + else if(selected_structure in typesof(/turf)) + var/turf/turf = selected_structure + new_structure = current_turf.PlaceOnTop(turf) + new_structure?.add_hiddenprint(user) //so admins know who placed it return TRUE @@ -138,11 +158,11 @@ list( \ return switch(action) - if("set_selected_resin") + if("set_selected_structure") var/selected_type = text2path(params["type"]) - if(!(selected_type in RESIN_PANEL_CONSTRUCTIONS)) + if(!(selected_type in RESIN_PANEL_STRUCTURES)) return - selected_resin = selected_type + selected_structure = selected_type return TRUE if("set_selected_hive") var/hive = params["selected_hive"] @@ -154,4 +174,4 @@ list( \ build_click_intercept = !build_click_intercept return TRUE -#undef RESIN_PANEL_CONSTRUCTIONS +#undef RESIN_PANEL_STRUCTURES diff --git a/tgui/packages/tgui/interfaces/ResinPanel.tsx b/tgui/packages/tgui/interfaces/ResinPanel.tsx index 9a1b5df142..db7304651d 100644 --- a/tgui/packages/tgui/interfaces/ResinPanel.tsx +++ b/tgui/packages/tgui/interfaces/ResinPanel.tsx @@ -4,16 +4,15 @@ import { Window } from 'tgui/layouts'; import { BooleanLike, classes } from 'common/react'; interface ResinPanelData { - constructions_list: ConstructionsEntry[]; + structure_list: StructureEntry[]; hives_list: string[]; - selected_resin: string; + selected_structure: string; selected_hive: string; build_click_intercept: BooleanLike; } -interface ConstructionsEntry { +interface StructureEntry { name: string; - desc: string; image: string; id: string; } @@ -21,9 +20,9 @@ interface ConstructionsEntry { export const ResinPanel = (props, context) => { const { act, data } = useBackend(context); const { - constructions_list, + structure_list, hives_list, - selected_resin, + selected_structure, selected_hive, build_click_intercept, } = data; @@ -33,7 +32,7 @@ export const ResinPanel = (props, context) => { return ( @@ -63,11 +62,13 @@ export const ResinPanel = (props, context) => { scrollable fill> - {constructions_list.map((item, index) => ( + {structure_list.map((item, index) => ( act('set_selected_resin', { type: item.id })}> + selected={item.id === selected_structure} + onClick={() => + act('set_selected_structure', { type: item.id }) + }> Date: Tue, 2 Jul 2024 23:46:52 -0400 Subject: [PATCH 3/3] reorder, tooltip move skeletal resin away from reflective in the list to avoid confusion, tooltip to advertise MMB functionality --- code/modules/admin/game_master/resin_panel.dm | 4 ++-- tgui/packages/tgui/interfaces/ResinPanel.tsx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/game_master/resin_panel.dm b/code/modules/admin/game_master/resin_panel.dm index 80d8c82eab..bab4097173 100644 --- a/code/modules/admin/game_master/resin_panel.dm +++ b/code/modules/admin/game_master/resin_panel.dm @@ -3,7 +3,6 @@ list( \ /datum/resin_construction/resin_turf/wall, \ /datum/resin_construction/resin_turf/wall/thick, \ /datum/resin_construction/resin_turf/wall/reflective, \ - /turf/closed/wall/mineral/bone_resin, \ /datum/resin_construction/resin_turf/membrane, \ /datum/resin_construction/resin_turf/membrane/thick, \ /datum/resin_construction/resin_obj/door, \ @@ -12,7 +11,8 @@ list( \ /datum/resin_construction/resin_obj/sticky_resin, \ /datum/resin_construction/resin_obj/fast_resin, \ /datum/resin_construction/resin_obj/resin_spike, \ - /datum/resin_construction/resin_obj/acid_pillar \ + /datum/resin_construction/resin_obj/acid_pillar, \ + /turf/closed/wall/mineral/bone_resin \ ) /client/proc/open_resin_panel() diff --git a/tgui/packages/tgui/interfaces/ResinPanel.tsx b/tgui/packages/tgui/interfaces/ResinPanel.tsx index db7304651d..e4587fe826 100644 --- a/tgui/packages/tgui/interfaces/ResinPanel.tsx +++ b/tgui/packages/tgui/interfaces/ResinPanel.tsx @@ -44,6 +44,7 @@ export const ResinPanel = (props, context) => {