Skip to content

Commit

Permalink
Deployable beacons!
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Nov 5, 2023
1 parent ec8b577 commit a248407
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 46 deletions.
74 changes: 74 additions & 0 deletions code/game/objects/items/beacons/deployable_beacons.dm
Original file line number Diff line number Diff line change
@@ -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

44 changes: 44 additions & 0 deletions code/game/objects/items/beacons/handheld_beacon.dm
Original file line number Diff line number Diff line change
@@ -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)]")
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)]")
62 changes: 62 additions & 0 deletions code/game/objects/structures/beacons/deployable_beacons.dm
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Binary file added icons/obj/items/deployable_beacon.dmi
Binary file not shown.
File renamed without changes.

0 comments on commit a248407

Please sign in to comment.