From a24840775293a91e520dd05e39258beef917ca76 Mon Sep 17 00:00:00 2001 From: Morrow Date: Sun, 5 Nov 2023 14:40:04 -0500 Subject: [PATCH] Deployable beacons! --- .../items/beacons/deployable_beacons.dm | 74 ++++++++++++++++++ .../objects/items/beacons/handheld_beacon.dm | 44 +++++++++++ .../{ => beacons}/handheld_distress_beacon.dm | 46 +---------- .../structures/beacons/deployable_beacons.dm | 62 +++++++++++++++ colonialmarines.dme | 5 +- icons/obj/items/deployable_beacon.dmi | Bin 0 -> 649 bytes ...istress_beacon.dmi => handheld_beacon.dmi} | Bin 7 files changed, 185 insertions(+), 46 deletions(-) create mode 100644 code/game/objects/items/beacons/deployable_beacons.dm create mode 100644 code/game/objects/items/beacons/handheld_beacon.dm rename code/game/objects/items/{ => beacons}/handheld_distress_beacon.dm (71%) create mode 100644 code/game/objects/structures/beacons/deployable_beacons.dm create mode 100644 icons/obj/items/deployable_beacon.dmi rename icons/obj/items/{handheld_distress_beacon.dmi => handheld_beacon.dmi} (100%) diff --git a/code/game/objects/items/beacons/deployable_beacons.dm b/code/game/objects/items/beacons/deployable_beacons.dm new file mode 100644 index 0000000000..e46e76e801 --- /dev/null +++ b/code/game/objects/items/beacons/deployable_beacons.dm @@ -0,0 +1,74 @@ +/// Generic deployable beacon for objectives +/obj/item/deployable_beacon + name = "deployable beacon" + desc = "A standard deployable beacon. Generally used by teams who may be out of regular communications range but must signal for various reasons. This one is branded with a Weyland Yutani symbol and sold en masse." + icon = 'icons/obj/items/deployable_beacon.dmi' + icon_state = "beacon_inactive" + w_class = SIZE_SMALL + + /// The type of beacon it turns into + var/beacon_type = /obj/structure/deployable_beacon + + /// Color of the beacon's light + var/beacon_light_color = COLOR_WHITE + +/obj/item/deployable_beacon/Initialize(mapload, ...) + . = ..() + + var/image/overlay_image = new('icons/obj/items/deployable_beacon.dmi', icon_state = "beacon_inactive_overlay") + overlay_image.color = beacon_light_color + + overlays += overlay_image + +/obj/item/deployable_beacon/attack_self(mob/user) + . = ..() + + var/turf/deploying_turf = get_turf(user) + + var/blocked = FALSE + for(var/obj/potential_blocking_object in deploying_turf) + if(potential_blocking_object.density || potential_blocking_object.can_block_movement) + blocked = potential_blocking_object + break + + if(!istype(deploying_turf, /turf/open)) + blocked = deploying_turf + + var/turf/open/floor = deploying_turf + if(!floor.allow_construction) + to_chat(user, SPAN_WARNING("You cannot deploy \a [src] here, find a more secure surface!")) + return FALSE + + if(blocked) + to_chat(usr, SPAN_WARNING("You need a clear, open area to deploy [src], [blocked] is blocking the way!")) + return + + if(user.action_busy) + return + + if(!do_after(user, (1 SECONDS), INTERRUPT_ALL, BUSY_ICON_BUILD, src)) + return + + playsound(deploying_turf, 'sound/mecha/mechmove01.ogg', 30, 1) + + var/obj/structure/deployable_beacon/deployed_beacon = new beacon_type(get_turf(src), user) + transfer_label_component(deployed_beacon) + + qdel(src) + +/obj/item/deployable_beacon/red + beacon_type = /obj/structure/deployable_beacon/red + beacon_light_color = COLOR_RED + +/obj/item/deployable_beacon/green + beacon_type = /obj/structure/deployable_beacon/green + beacon_light_color = COLOR_GREEN + +/obj/item/deployable_beacon/blue + beacon_type = /obj/structure/deployable_beacon/blue + beacon_light_color = COLOR_BLUE + +/obj/item/deployable_beacon/purple + beacon_type = /obj/structure/deployable_beacon/purple + beacon_light_color = COLOR_PURPLE + diff --git a/code/game/objects/items/beacons/handheld_beacon.dm b/code/game/objects/items/beacons/handheld_beacon.dm new file mode 100644 index 0000000000..4b26dc3373 --- /dev/null +++ b/code/game/objects/items/beacons/handheld_beacon.dm @@ -0,0 +1,44 @@ +/// Generic beacon for objectives +/obj/item/handheld_beacon + name = "handheld beacon" + desc = "A standard handheld beacon. Generally used by teams who may be out of regular communications range but must signal for various reasons. This one is branded with a Weyland Yutani symbol and sold en masse." + icon = 'icons/obj/items/handheld_beacon.dmi' + icon_state = "beacon_inactive" + w_class = SIZE_SMALL + + /// Whether the beacon is active or not + var/active = FALSE + +/obj/item/handheld_beacon/get_examine_text(mob/user) + . = ..() + + if(active) + . += "The beacon has been activated!" + +/obj/item/handheld_beacon/update_icon() + . = ..() + + if(active) + icon_state = "beacon_active" + return + icon_state = initial(icon_state) + +/obj/item/handheld_beacon/attack_self(mob/user) + . = ..() + + if(.) + return + + active = !active + update_icon() + + to_chat(user, SPAN_NOTICE("The beacon pings quietly and turns [active ? "on" : "off"].")) + + if(!active) + return + + for(var/client/admin_client in GLOB.admins) + if((R_ADMIN|R_MOD) & admin_client.admin_holder.rights) + playsound_client(admin_client,'sound/effects/sos-morse-code.ogg',10) + + message_admins("[key_name(user)] has activated [src]! [ADMIN_JMP_USER(user)]") diff --git a/code/game/objects/items/handheld_distress_beacon.dm b/code/game/objects/items/beacons/handheld_distress_beacon.dm similarity index 71% rename from code/game/objects/items/handheld_distress_beacon.dm rename to code/game/objects/items/beacons/handheld_distress_beacon.dm index 19a64c2c37..bb1e0330f0 100644 --- a/code/game/objects/items/handheld_distress_beacon.dm +++ b/code/game/objects/items/beacons/handheld_distress_beacon.dm @@ -3,7 +3,7 @@ /obj/item/handheld_distress_beacon name = "\improper PMC handheld distress beacon" desc = "A standard handheld distress beacon. Generally used by teams who may be out of regular communications range but must signal for assistance. This one is branded with a Weyland Yutani symbol and sold en masse to colonies across the Neroid Sector." - icon = 'icons/obj/items/handheld_distress_beacon.dmi' + icon = 'icons/obj/items/handheld_beacon.dmi' icon_state = "beacon_inactive" w_class = SIZE_SMALL @@ -64,47 +64,3 @@ recipient = "Anchorpoint Station" ert_full_name = list("CMB - Patrol Team - Marshals in Distress (Friendly)", "CMB - Anchorpoint Station Colonial Marine QRF (Friendly)") ert_short_name = list("SEND CMB", "SEND QRF") - -/// Generic beacon for objectives -/obj/item/handheld_beacon - name = "handheld beacon" - desc = "A standard handheld beacon. Generally used by teams who may be out of regular communications range but must signal for various reasons. This one is branded with a Weyland Yutani symbol and sold en masse." - icon = 'icons/obj/items/handheld_distress_beacon.dmi' - icon_state = "beacon_inactive" - w_class = SIZE_SMALL - - /// Whether the beacon is active or not - var/active = FALSE - -/obj/item/handheld_beacon/get_examine_text(mob/user) - . = ..() - - if(active) - . += "The beacon has been activated!" - -/obj/item/handheld_beacon/update_icon() - . = ..() - - if(active) - icon_state = "beacon_active" - return - icon_state = initial(icon_state) - -/obj/item/handheld_beacon/attack_self(mob/user) - . = ..() - - if(.) - return - - active = !active - update_icon() - - to_chat(user, SPAN_NOTICE("The beacon pings quietly and turns [active ? "on" : "off"].")) - - if(!active) - return - - for(var/client/admin_client in GLOB.admins) - if((R_ADMIN|R_MOD) & admin_client.admin_holder.rights) - playsound_client(admin_client,'sound/effects/sos-morse-code.ogg',10) - message_admins("[key_name(user)] has used [name]! [ADMIN_JMP_USER(user)]") diff --git a/code/game/objects/structures/beacons/deployable_beacons.dm b/code/game/objects/structures/beacons/deployable_beacons.dm new file mode 100644 index 0000000000..f355aa3ba7 --- /dev/null +++ b/code/game/objects/structures/beacons/deployable_beacons.dm @@ -0,0 +1,62 @@ +/obj/structure/deployable_beacon + name = "deployable beacon" + desc = "A standard deployable beacon. Generally used by teams who may be out of regular communications range but must signal for various reasons. This one is branded with a Weyland Yutani symbol and sold en masse." + icon = 'icons/obj/items/deployable_beacon.dmi' + icon_state = "beacon_active" + + /// The type of beacon it turns into + var/beacon_type = /obj/item/deployable_beacon + + /// Color of the beacon's light + var/beacon_light_color = COLOR_WHITE + +/obj/structure/deployable_beacon/Initialize(mapload, mob/user) + . = ..() + + var/image/overlay_image = new('icons/obj/items/deployable_beacon.dmi', icon_state = "beacon_active_overlay") + overlay_image.color = beacon_light_color + + overlays += overlay_image + + visible_message(SPAN_NOTICE("[src] beeps quietly as it begins broadcasting preprogrammed signals.")) + + for(var/client/admin_client in GLOB.admins) + if((R_ADMIN|R_MOD) & admin_client.admin_holder.rights) + playsound_client(admin_client,'sound/effects/sos-morse-code.ogg',10) + + message_admins("[key_name(user)] has deployed [src]! [ADMIN_JMP_USER(user)]") + +/obj/structure/deployable_beacon/attackby(obj/item/attacking_item, mob/user) + if(!HAS_TRAIT(attacking_item, TRAIT_TOOL_MULTITOOL)) + return ..() + + if(user.action_busy) + return + + if(!do_after(user, (1 SECONDS), INTERRUPT_ALL, BUSY_ICON_BUILD, src)) + return + + visible_message(SPAN_NOTICE("[src] gives a drone as it powers down and collapses into itself for easier carrying.")) + + var/obj/item/deployable_beacon/undeployed_beacon = new beacon_type() + transfer_label_component(undeployed_beacon) + + user.put_in_hands(undeployed_beacon) + + qdel(src) + +/obj/structure/deployable_beacon/red + beacon_type = /obj/item/deployable_beacon/red + beacon_light_color = COLOR_RED + +/obj/structure/deployable_beacon/green + beacon_type = /obj/item/deployable_beacon/green + beacon_light_color = COLOR_GREEN + +/obj/structure/deployable_beacon/blue + beacon_type = /obj/item/deployable_beacon/blue + beacon_light_color = COLOR_BLUE + +/obj/structure/deployable_beacon/purple + beacon_type = /obj/item/deployable_beacon/purple + beacon_light_color = COLOR_PURPLE diff --git a/colonialmarines.dme b/colonialmarines.dme index 6b46ddacf1..43cb54bd99 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -1036,7 +1036,6 @@ #include "code\game\objects\items\fulton.dm" #include "code\game\objects\items\gift_wrappaper.dm" #include "code\game\objects\items\handcuffs.dm" -#include "code\game\objects\items\handheld_distress_beacon.dm" #include "code\game\objects\items\hoverpack.dm" #include "code\game\objects\items\legcuffs.dm" #include "code\game\objects\items\lightstick.dm" @@ -1049,6 +1048,9 @@ #include "code\game\objects\items\stock_parts.dm" #include "code\game\objects\items\trash.dm" #include "code\game\objects\items\XMAS.dm" +#include "code\game\objects\items\beacons\deployable_beacons.dm" +#include "code\game\objects\items\beacons\handheld_beacon.dm" +#include "code\game\objects\items\beacons\handheld_distress_beacon.dm" #include "code\game\objects\items\books\book.dm" #include "code\game\objects\items\books\manuals.dm" #include "code\game\objects\items\circuitboards\airlock.dm" @@ -1276,6 +1278,7 @@ #include "code\game\objects\structures\barricade\misc.dm" #include "code\game\objects\structures\barricade\plasteel.dm" #include "code\game\objects\structures\barricade\sandbags.dm" +#include "code\game\objects\structures\beacons\deployable_beacons.dm" #include "code\game\objects\structures\crates_lockers\closets.dm" #include "code\game\objects\structures\crates_lockers\crates.dm" #include "code\game\objects\structures\crates_lockers\largecrate.dm" diff --git a/icons/obj/items/deployable_beacon.dmi b/icons/obj/items/deployable_beacon.dmi new file mode 100644 index 0000000000000000000000000000000000000000..7359914d617491509b8a7588fe74e0881abf5983 GIT binary patch literal 649 zcmV;40(Sk0P)fFDZ*Bkpc$`yK zaB_9`^iy#0_2eo`Eh^5;&r`5fFwryM;w;ZhDainGjE%TBGg33tGfE(w;*!LYR3K9+ zDK#-UKQBHrFEP0!vn*AKi!&v&s2C_?$i z_`M<<9+S-EF?+*giC3YIM>4UB%N7)f4%)BN&pk~qs3 z3WZB>GkVC~=s#e9IRjMC7`^?7mmiS64|Jct4>Ap4NXz#@&WC(|9Ma_(Pxj{b96sVQ jpbYp215W>;6?S+5Mg1H2klp+V00000NkvXXu0mjfuBIE+ literal 0 HcmV?d00001 diff --git a/icons/obj/items/handheld_distress_beacon.dmi b/icons/obj/items/handheld_beacon.dmi similarity index 100% rename from icons/obj/items/handheld_distress_beacon.dmi rename to icons/obj/items/handheld_beacon.dmi