Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Munitions Pinpointers #2738

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nsv13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3962,6 +3962,7 @@
#include "nsv13\code\modules\mob\living\simple_animal\bot\secbot.dm"
#include "nsv13\code\modules\mob\living\simple_animal\hostile\dioclown.dm"
#include "nsv13\code\modules\modular_computer\wiki_uplink.dm"
#include "nsv13\code\modules\munitions\muni_pointer.dm"
#include "nsv13\code\modules\munitions\munitions_trolley.dm"
#include "nsv13\code\modules\munitions\ammunition\broadside_ammo.dm"
#include "nsv13\code\modules\munitions\ammunition\cannon_ammo.dm"
Expand Down
40 changes: 40 additions & 0 deletions nsv13/code/game/objects/items/nsv_circuitboards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,29 @@
build_path = /obj/machinery/computer/ams
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/circuitboard/computer/ams/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/computer/ams/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/obj/item/circuitboard/computer/anti_air
name = "anti-air turret console (Computer Board)"
build_path = /obj/machinery/computer/anti_air
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/circuitboard/computer/anti_air/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/computer/anti_air/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/obj/item/circuitboard/computer/ship/fighter_controller
Expand All @@ -108,9 +118,14 @@
build_path = /obj/machinery/ship_weapon/anti_air
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/circuitboard/machine/anti_air/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/machine/anti_air/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/obj/item/circuitboard/machine/anti_air/heavy
Expand Down Expand Up @@ -150,9 +165,14 @@
build_path = PATH_FLAK
*/

/obj/item/circuitboard/machine/pdc_mount/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/machine/pdc_mount/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/* Flak isn't used right now
Expand Down Expand Up @@ -191,9 +211,14 @@
/obj/item/circuitboard/machine/deck_turret/apply_default_parts()
//dont

/obj/item/circuitboard/machine/deck_turret/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/machine/deck_turret/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/obj/item/circuitboard/computer/deckgun
Expand Down Expand Up @@ -297,9 +322,14 @@
/obj/item/stack/cable_coil = 10)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/circuitboard/machine/vls/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/machine/vls/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

//Gauss guns
Expand All @@ -309,9 +339,14 @@
req_components = list()
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/circuitboard/machine/gauss_turret/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/machine/gauss_turret/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/obj/item/circuitboard/computer/iff
Expand Down Expand Up @@ -384,9 +419,14 @@
build_path = /obj/machinery/computer/laser_pd
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/circuitboard/computer/laser_pd/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/computer/laser_pd/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

// Laser PD
Expand Down
1 change: 1 addition & 0 deletions nsv13/code/game/objects/structures/custom_closets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
new /obj/item/encryptionkey/atc(src)
new /obj/item/circuitboard/machine/techfab/department/munitions(src)
new /obj/item/stamp/maa(src)
new /obj/item/pinpointer/munitions(src)

/obj/structure/closet/secure_closet/munitions_technician
name = "munitions technician's locker"
Expand Down
12 changes: 12 additions & 0 deletions nsv13/code/modules/cargo/packs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@
crate_type = /obj/structure/closet/crate/wooden
crate_name = "Captain Plasmasalt's finest gunpowder"

/datum/supply_pack/munitions/muni_pointer
name = "Munitions Pinpointer"
desc = "Clown spaced your turrets? MAA slipped and threw their pointer into the recycler? This is the solution to your problems!"
cost = 5000 //Don't lose yours, MAA.
contains = list(/obj/item/pinpointer/munitions)

/datum/supply_pack/munitions/muni_pointer/fill(obj/structure/closet/crate/C)
if(prob(1))
new /obj/item/pinpointer/munitions/not_puce(C)
else
new /obj/item/pinpointer/munitions(C)

/datum/supply_pack/munitions/pdc_ammo
name = "PDC mount rounds (x5)"
desc = "5 boxes of PDC rounds, ideal for repelling torpedoes and missiles."
Expand Down
5 changes: 5 additions & 0 deletions nsv13/code/modules/munitions/ammunition/gauss_ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
/obj/item/ship_weapon/parts/loading_tray = 1)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/circuitboard/machine/gauss_dispenser/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/machine/gauss_dispenser/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/obj/machinery/gauss_dispenser
Expand Down
73 changes: 73 additions & 0 deletions nsv13/code/modules/munitions/muni_pointer.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
GLOBAL_LIST_EMPTY(critical_muni_items)

/obj/item/pinpointer/munitions
name = "munitions pinpointer"
desc = "A device designed to track critical munitions objects."
icon_state = "pinpointer_muni"
icon = 'nsv13/icons/obj/device.dmi'
resistance_flags = NONE

//Some crew pinpointer copypasta because I only need part of their functions.

/obj/item/pinpointer/munitions/examine(mob/user)
. = ..()
if(!active || !target)
return
. += "It is currently tracking <b>[target]</b>."

/obj/item/pinpointer/munitions/attack_self(mob/living/user)
if(active)
toggle_on()
user.visible_message("<span class='notice'>[user] deactivates [user.p_their()] pinpointer.</span>", "<span class='notice'>You deactivate your pinpointer.</span>")
return

var/list/found_items = list()
var/obj/structure/overmap/current_overmap = get_overmap()
for(var/obj/critical_item as anything in GLOB.critical_muni_items)
if(critical_item.get_overmap() != current_overmap)
continue
if(isnull(critical_item.loc))
continue
var/prefix = ""
if(istype(critical_item, /obj/item/circuitboard))
var/obj/item/circuitboard/critical_circuit = critical_item
if(istype(critical_circuit.loc, critical_circuit.build_path))
prefix = "\[NRM\]"
else
prefix = "\[LSE\]"
else
prefix = "\[OTR\]"
var/effective_basename = "[prefix] [critical_item]"
var/final_name = effective_basename
var/number_bonus = 1
while(TRUE)
if(!found_items[final_name])
found_items[final_name] = critical_item
break
else
final_name = "[effective_basename] ([number_bonus])"
number_bonus++

if(!length(found_items))
user.visible_message("<span class='notice'>[user]'s pinpointer fails to detect a signal.</span>", "<span class='notice'>Your pinpointer fails to detect a signal.</span>")
return

var/A = input(user, "Item Beacon to Track", "Pinpoint") in sortList(found_items)
if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
return

target = found_items[A]
toggle_on()
user.visible_message("<span class='notice'>[user] activates [user.p_their()] pinpointer.</span>", "<span class='notice'>You activate your pinpointer.</span>")

/obj/item/pinpointer/munitions/scan_for_target()
if(target)
if(QDELETED(target) || (get_overmap() != target.get_overmap()))
target = null

if(!target) //target can be set to null from above code, or elsewhere
active = FALSE

/obj/item/pinpointer/munitions/not_puce
desc = "A device designed to track critical munitions objects. Wait.. Is this..?"
icon_state = "pinpointer_not_puce"
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
build_path = /obj/machinery/ship_weapon/broadside

/obj/item/circuitboard/machine/broadside/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

/obj/item/circuitboard/machine/broadside/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()

/datum/ship_weapon/broadside
Expand Down
17 changes: 12 additions & 5 deletions nsv13/code/modules/munitions/ship_weapons/ship_weapon_parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
icon_state = "mcontroller"
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF

/obj/item/ship_weapon/parts/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
return ..()

/**
* Firing electronics - used in construction of <s>new</s> old munitions machinery
*/
Expand All @@ -19,6 +14,18 @@
icon = 'icons/obj/module.dmi'
icon_state = "mcontroller"

/obj/item/ship_weapon/parts/firing_electronics/Initialize(mapload)
. = ..()
GLOB.critical_muni_items += src

//Almost all of the ship weapon parts are supposed to be destroyed a LOT, this is the only one where that is not the case.
/obj/item/ship_weapon/parts/firing_electronics/Destroy(force=FALSE)
if(!force)
return QDEL_HINT_LETMELIVE
GLOB.critical_muni_items -= src
return ..()


/**
* Railgun loading tray
*/
Expand Down
Binary file modified nsv13/icons/obj/device.dmi
Binary file not shown.
Loading