From 97a2c2823dfc32227b9a7278f088878b35bd7ae0 Mon Sep 17 00:00:00 2001 From: Fira Date: Tue, 7 Nov 2023 14:46:24 +0000 Subject: [PATCH] Adds possibility to customize req crates --- .../__DEFINES/dcs/signals/atom/signals_obj.dm | 2 + code/datums/components/crate_tag.dm | 35 ++++++++++++++++ .../structures/crates_lockers/crates.dm | 14 +++++++ .../crates_lockers/secure_crates.dm | 1 + code/modules/cm_marines/overwatch.dm | 10 ++--- code/modules/cm_tech/droppod/supply.dm | 25 +++++++++--- code/modules/recycling/sortingmachinery.dm | 40 +++++++++++++------ colonialmarines.dme | 1 + maps/map_files/USS_Almayer/USS_Almayer.dmm | 3 ++ 9 files changed, 107 insertions(+), 24 deletions(-) create mode 100644 code/datums/components/crate_tag.dm diff --git a/code/__DEFINES/dcs/signals/atom/signals_obj.dm b/code/__DEFINES/dcs/signals/atom/signals_obj.dm index aebd0d09d0d2..93579e068ec7 100644 --- a/code/__DEFINES/dcs/signals/atom/signals_obj.dm +++ b/code/__DEFINES/dcs/signals/atom/signals_obj.dm @@ -29,3 +29,5 @@ /// from /obj/proc/afterbuckle() #define COSMIG_OBJ_AFTER_BUCKLE "signal_obj_after_buckle" + +#define COMSIG_STRUCTURE_CRATE_SQUAD_LAUNCHED "structure_crate_squad_launched" diff --git a/code/datums/components/crate_tag.dm b/code/datums/components/crate_tag.dm new file mode 100644 index 000000000000..a628099a3a4c --- /dev/null +++ b/code/datums/components/crate_tag.dm @@ -0,0 +1,35 @@ +/datum/component/crate_tag + dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS + /// The crate tag used for notifications and as label + var/name + +/datum/component/crate_tag/Initialize(name, obj/structure/closet/crate/masquarade_type) + var/obj/structure/closet/crate/crate = parent + if(!istype(crate)) + return COMPONENT_INCOMPATIBLE + setup(name, masquarade_type) + RegisterSignal(parent, COMSIG_STRUCTURE_CRATE_SQUAD_LAUNCHED, PROC_REF(notify_squad)) + +/datum/component/crate_tag/InheritComponent(datum/component/C, i_am_original, name, obj/structure/closet/crate/masquarade_type) + . = ..() + setup(name, masquarade_type) + +/datum/component/crate_tag/proc/setup(name, obj/structure/closet/crate/masquarade_type) + var/obj/structure/closet/crate/crate = parent + if(masquarade_type) + crate.name = initial(masquarade_type.name) + crate.desc = initial(masquarade_type.desc) + crate.icon_opened = initial(masquarade_type.icon_opened) + crate.icon_closed = initial(masquarade_type.icon_closed) + if(crate.opened) + crate.icon_state = crate.icon_opened + else + crate.icon_state = crate.icon_closed + if(name) + parent.AddComponent(/datum/component/label, name) + src.name = name // Keep it around additionally for notifications + +/datum/component/crate_tag/proc/notify_squad(datum/source, datum/squad/squad) + SIGNAL_HANDLER + squad.send_message("'[name]' supply drop incoming. Heads up!") + squad.send_maptext(name, "Incoming Supply Drop:") diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index 9f0417ccb372..119615ab7aed 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -12,6 +12,19 @@ throwpass = 1 //prevents moving crates by hurling things at them store_mobs = FALSE var/rigged = 0 + /// Types this crate can be made into + var/list/crate_customizing_types = list( + "Plain" = /obj/structure/closet/crate, + "Weapons" = /obj/structure/closet/crate/weapon, + "Supply" = /obj/structure/closet/crate/supply, + "Ammo" = /obj/structure/closet/crate/ammo, + "Construction" = /obj/structure/closet/crate/construction, + "Explosives" = /obj/structure/closet/crate/explosives, + "Alpha" = /obj/structure/closet/crate/alpha, + "Bravo" = /obj/structure/closet/crate/bravo, + "Charlie" = /obj/structure/closet/crate/charlie, + "Delta" = /obj/structure/closet/crate/delta, + ) /obj/structure/closet/crate/initialize_pass_flags(datum/pass_flags_container/PF) ..() @@ -207,6 +220,7 @@ icon_state = "closed_freezer" icon_opened = "open_freezer" icon_closed = "closed_freezer" + crate_customizing_types = null var/target_temp = T0C - 40 var/cooling_power = 40 diff --git a/code/game/objects/structures/crates_lockers/secure_crates.dm b/code/game/objects/structures/crates_lockers/secure_crates.dm index a308c4c0a21c..e720199f9fbe 100644 --- a/code/game/objects/structures/crates_lockers/secure_crates.dm +++ b/code/game/objects/structures/crates_lockers/secure_crates.dm @@ -4,6 +4,7 @@ icon_state = "secure_locked_basic" icon_opened = "secure_open_basic" icon_closed = "secure_locked_basic" + crate_customizing_types = null var/icon_locked = "secure_locked_basic" var/icon_unlocked = "secure_unlocked_basic" var/sparks = "securecratesparks" diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index 5d651e0aa220..6db426a348c3 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -841,18 +841,14 @@ busy = TRUE C.visible_message(SPAN_WARNING("\The [C] loads into a launch tube. Stand clear!")) - C.anchored = TRUE //To avoid accidental pushes - current_squad.send_message("'[C.name]' supply drop incoming. Heads up!") - current_squad.send_maptext(C.name, "Incoming Supply Drop:") - var/datum/squad/S = current_squad //in case the operator changes the overwatched squad mid-drop - COOLDOWN_START(S, next_supplydrop, 500 SECONDS) + SEND_SIGNAL(C, COMSIG_STRUCTURE_CRATE_SQUAD_LAUNCHED, current_squad) + COOLDOWN_START(current_squad, next_supplydrop, 500 SECONDS) if(ismob(usr)) var/mob/M = usr M.count_niche_stat(STATISTICS_NICHE_CRATES) playsound(C.loc,'sound/effects/bamf.ogg', 50, 1) //Ehh - var/obj/structure/droppod/supply/pod = new() - C.forceMove(pod) + var/obj/structure/droppod/supply/pod = new(null, C) pod.launch(T) visible_message("[icon2html(src, viewers(src))] [SPAN_BOLDNOTICE("'[C.name]' supply drop launched! Another launch will be available in five minutes.")]") busy = FALSE diff --git a/code/modules/cm_tech/droppod/supply.dm b/code/modules/cm_tech/droppod/supply.dm index 326bc42f6c3f..bfe6ca36316d 100644 --- a/code/modules/cm_tech/droppod/supply.dm +++ b/code/modules/cm_tech/droppod/supply.dm @@ -1,16 +1,31 @@ /obj/structure/droppod/supply - name = "\improper USCM requisitions droppod" + name = "\improper USCM requisitions package" drop_time = 10 SECONDS dropping_time = 2 SECONDS open_time = 2 SECONDS + var/obj/structure/package + +/obj/structure/droppod/supply/Initialize(mapload, obj/structure/closet/crate/package) + . = ..() + if(!istype(package)) + return INITIALIZE_HINT_QDEL + package.forceMove(src) + src.package = package + +/obj/structure/droppod/supply/Destroy() + . = ..() + package = null + +/* Pose as the crate so we see it falling from the skies */ +/obj/structure/droppod/supply/update_icon() + . = ..() + icon = package.icon + icon_state = package.icon_state /obj/structure/droppod/supply/open() . = ..() for(var/atom/movable/content as anything in contents) - ///Crates are anchored when launched to avoid pushing them while launching and this created issues with them being anchored when they landed groundside. - ///This unanchors them before moving them out to make sure that crates are able to be moved when groundside. - if(istype(content, /obj/structure/closet/crate)) - content.anchored = FALSE content.forceMove(loc) + package = null qdel(src) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index e61357188ad6..da7b0a51d40e 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -215,7 +215,7 @@ icon = 'icons/obj/items/items.dmi' icon_state = "deliveryPaper" w_class = SIZE_MEDIUM - var/amount = 25 + var/amount = 50 /obj/item/packageWrap/afterattack(obj/target as obj, mob/user as mob, proximity) @@ -267,18 +267,34 @@ SPAN_NOTICE("You wrap \the [target], leaving [amount] units of paper on \the [src]."),\ "You hear someone taping paper around a small object.") else if (istype(target, /obj/structure/closet/crate)) - var/obj/structure/closet/crate/O = target - if (src.amount > 3 && !O.opened) - var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(O.loc)) - P.icon_state = "deliverycrate" - P.wrapped = O - O.forceMove(P) + var/obj/structure/closet/crate/crate = target + var/answer = tgui_alert(user, "Wrap the crate for delivery or customize it?", "Crate wrapping", list("Customize", "Wrap")) + if(!answer || !user.Adjacent(target) || !target.z) + return + if(answer == "Customize") + if(!length(crate.crate_customizing_types)) + to_chat(user, SPAN_WARNING("You cannot customize this kind of crate.")) + return + var/label = tgui_input_text(user, "Give the crate a new logistic tag:", "Customizing") + if(!label || !user.Adjacent(target) || !target.z) + return + var/chosen_type = tgui_input_list(user, "Select the kind of crate to make this into:", "Customizing", crate.crate_customizing_types) + if(!chosen_type || !ispath(crate.crate_customizing_types[chosen_type]) || !user.Adjacent(target) || !target.z) + return + target.AddComponent(/datum/component/crate_tag, label, crate.crate_customizing_types[chosen_type]) src.amount -= 3 - user.visible_message("\The [user] wraps \a [target] with \a [src].",\ - SPAN_NOTICE("You wrap \the [target], leaving [amount] units of paper on \the [src]."),\ - "You hear someone taping paper around a large object.") - else if(src.amount < 3) - to_chat(user, SPAN_WARNING("You need more paper.")) + else + if (src.amount > 3 && !crate.opened) + var/obj/structure/bigDelivery/P = new /obj/structure/bigDelivery(get_turf(crate.loc)) + P.icon_state = "deliverycrate" + P.wrapped = crate + crate.forceMove(P) + src.amount -= 3 + user.visible_message("\The [user] wraps \a [target] with \a [src].",\ + SPAN_NOTICE("You wrap \the [target], leaving [amount] units of paper on \the [src]."),\ + "You hear someone taping paper around a large object.") + else if(src.amount < 3) + to_chat(user, SPAN_WARNING("You need more paper.")) else if (istype (target, /obj/structure/closet)) var/obj/structure/closet/O = target if (src.amount > 3 && !O.opened) diff --git a/colonialmarines.dme b/colonialmarines.dme index 9c3a5868d693..3a723bbf848c 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -373,6 +373,7 @@ #include "code\datums\components\bonus_damage_stack.dm" #include "code\datums\components\cluster_stack.dm" #include "code\datums\components\connect_mob_behalf.dm" +#include "code\datums\components\crate_tag.dm" #include "code\datums\components\footstep.dm" #include "code\datums\components\healing_reduction.dm" #include "code\datums\components\id_lock.dm" diff --git a/maps/map_files/USS_Almayer/USS_Almayer.dmm b/maps/map_files/USS_Almayer/USS_Almayer.dmm index 95352008b2ae..a37cd9d07230 100644 --- a/maps/map_files/USS_Almayer/USS_Almayer.dmm +++ b/maps/map_files/USS_Almayer/USS_Almayer.dmm @@ -42111,6 +42111,7 @@ amount = 50 }, /obj/structure/surface/rack, +/obj/item/packageWrap, /turf/open/floor/almayer{ dir = 4; icon_state = "green" @@ -56264,6 +56265,7 @@ /obj/structure/surface/table/almayer, /obj/effect/spawner/random/powercell, /obj/effect/spawner/random/tool, +/obj/item/packageWrap, /turf/open/floor/almayer{ dir = 8; icon_state = "green" @@ -77582,6 +77584,7 @@ "xfw" = ( /obj/structure/surface/table/almayer, /obj/item/storage/fancy/cigarettes/lucky_strikes, +/obj/item/packageWrap, /turf/open/floor/almayer{ dir = 9; icon_state = "green"