From 15152bd40c225e0fca2f8d07e04b72f34fbac258 Mon Sep 17 00:00:00 2001
From: ss13-beebot <56381746+ss13-beebot@users.noreply.github.com>
Date: Fri, 31 May 2024 00:13:49 +0000
Subject: [PATCH 1/8] Automatic changelog compile [ci skip]
---
html/changelog.html | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/html/changelog.html b/html/changelog.html
index b8ec82c6da9..d76350b1d4a 100644
--- a/html/changelog.html
+++ b/html/changelog.html
@@ -136,30 +136,6 @@
Bokkiewokkie updated:
Fixed auto-spooling not working for the Thirring FTL drive.
Enabled auto-spooling as an option for the Thirring FTL drive by default.
-
- 29 March 2024
- Bobbanz1 updated:
-
- - The destruction of a gauss turret now leaves behind the machine frame that had been used to construct it.
- - Gave the machine board of the gauss turret a req_components list with nothing inside it to prevent a runtime error from occurring.
- - Rerouted the piping network in the assault course a bit so it resolves the issue raised about them missing when they were actually going through the window instead.
- - Removed some wiring that didn't do anything.
- - Engineering Lobby now has the wiring coming from maintenance actually hooked up to the grid rather than ending a tile early.
- - Gave the Aetherwhisp laser weaponry circuit boards so they don't get completely round removed when destroyed,
-
- Bokkiewokkie updated:
-
- - Fixed some bad initializations
- - Added the ability to research and print naval gun parts
- - Moved the gauss gun upgrade board to level 2 munitions research "Macro Ballistics"
- - Added science tiers to NSV researches
- - Made it so printable naval gun part circuits can be destroyed
-
- DeltaFire15 updated:
-
- - Being recalled with an inactive thirring drive should no longer trap the ship in the darkness between stars.
- - Nucleium engine turfs now work. As may some other map cases of "nucleum" being used as incorrect term.
-
GoonStation 13 Development Team
From 9b568e9e7de7956c1023acacbe1f839b0b96390f Mon Sep 17 00:00:00 2001
From: Benjamin <9423435+benbot16@users.noreply.github.com>
Date: Fri, 31 May 2024 09:12:29 -0700
Subject: [PATCH 2/8] Some ammo rack fixes/tweaks (#2639)
---
nsv13.dme | 1 +
.../ballistic_weapons/revision2/ammo_rack.dm | 375 ++++++++++++++++++
.../ballistic_weapons/revision2/automation.dm | 368 -----------------
.../designs/nsv_circuitboard_designs.dm | 19 +
4 files changed, 395 insertions(+), 368 deletions(-)
create mode 100644 nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/ammo_rack.dm
diff --git a/nsv13.dme b/nsv13.dme
index 32ae7a97bea..f1c83cc7130 100644
--- a/nsv13.dme
+++ b/nsv13.dme
@@ -3986,6 +3986,7 @@
#include "nsv13\code\modules\munitions\ship_weapons\ballistic_weapons\railgun_construction.dm"
#include "nsv13\code\modules\munitions\ship_weapons\ballistic_weapons\torpedo_launcher.dm"
#include "nsv13\code\modules\munitions\ship_weapons\ballistic_weapons\torpedo_launcher_construction.dm"
+#include "nsv13\code\modules\munitions\ship_weapons\ballistic_weapons\revision2\ammo_rack.dm"
#include "nsv13\code\modules\munitions\ship_weapons\ballistic_weapons\revision2\automation.dm"
#include "nsv13\code\modules\munitions\ship_weapons\ballistic_weapons\revision2\vls.dm"
#include "nsv13\code\modules\munitions\ship_weapons\energy_weapons\bsa.dm"
diff --git a/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/ammo_rack.dm b/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/ammo_rack.dm
new file mode 100644
index 00000000000..7a8f1c019cc
--- /dev/null
+++ b/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/ammo_rack.dm
@@ -0,0 +1,375 @@
+/**
+ * This file contains the ammo rack and ammo rack control console.
+ * Each rack is linked to a console, which allows for remote dispensation and management of the rack.
+ * Ammo racks can be loaded via hand, dragging, or bumping, and they can be maintained using oil.
+ */
+
+// Ammo rack control console
+/obj/machinery/computer/ammo_sorter
+ name = "ammo rack control console"
+ icon_screen = "ammorack"
+ circuit = /obj/item/circuitboard/computer/ammo_sorter
+ var/id = null
+ var/list/linked_sorters = list()
+
+/obj/machinery/computer/ammo_sorter/Initialize(mapload, obj/item/circuitboard/C)
+ . = ..()
+ if(mapload)
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/computer/ammo_sorter/LateInitialize()
+ . = ..()
+ for(var/obj/machinery/ammo_sorter/W in GLOB.machines)
+ if(istype(W) && W.id == id)
+ linkSorter(W)
+ sortList(linked_sorters) //Alphabetise the list initially...
+
+/obj/machinery/computer/ammo_sorter/Destroy()
+ for(var/obj/machinery/ammo_sorter/AS as() in linked_sorters)
+ AS.linked_consoles -= src
+ . = ..()
+
+/obj/machinery/computer/ammo_sorter/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "AmmoSorter")
+ ui.open()
+
+/obj/machinery/computer/ammo_sorter/ui_act(action, params, datum/tgui/ui)
+ if(..())
+ return
+ var/obj/machinery/ammo_sorter/AS = locate(params["id"])
+ switch(action)
+ if("unload_all")
+ unload_all()
+ if("unload")
+ if(!AS)
+ return
+ if(!AS.pop())
+ to_chat(usr, "[src] displays an error message!")
+ if("unlink")
+ if(!AS)
+ return
+ unlinkSorter(AS)
+ if("rename")
+ if(!AS)
+ return
+ var/new_name = stripped_input(usr, message="Enter a new name for [AS]", max_length=MAX_CHARTER_LEN)
+
+ if(!new_name)
+ return
+
+ AS.name = new_name
+ message_admins("[key_name(usr)] renamed an ammo rack to [new_name].")
+ log_game("[key_name(usr)] renamed an ammo rack to [new_name].")
+ if("moveup")
+ if(!AS)
+ return
+ var/id = linked_sorters.Find(AS)
+ if (id <= 1)
+ return
+ linked_sorters.Swap(id,id-1)
+ if("movedown")
+ if(!AS)
+ return
+ var/id = linked_sorters.Find(AS)
+ if (id >= linked_sorters.len)
+ return
+ linked_sorters.Swap(id,id+1)
+ // update UI
+ ui_interact(usr)
+
+/obj/machinery/computer/ammo_sorter/ui_data(mob/user)
+ . = ..()
+ var/list/data = list()
+ var/list/racks_info = list()
+ for(var/obj/machinery/ammo_sorter/AS as() in linked_sorters)
+ var/atom/what = null
+ var/loadedlen = length(AS.loaded)
+ if(loadedlen)
+ what = AS.loaded[loadedlen]
+ racks_info[++racks_info.len] = list("name"=AS.name, "has_loaded"=loadedlen > 0, "id"="\ref[AS]", "top"=(what ? what.name : "Nothing"))
+ data["racks_info"] = racks_info
+ return data
+
+/obj/machinery/computer/ammo_sorter/proc/unload_all()
+ for(var/obj/machinery/ammo_sorter/AS as() in linked_sorters)
+ AS.unload()
+
+/obj/machinery/computer/ammo_sorter/multitool_act(mob/living/user, obj/item/I)
+ if(!multitool_check_buffer(user, I))
+ return TRUE
+ var/obj/item/multitool/M = I
+ M.buffer = src
+ to_chat(user, "You add [src] to [M]'s buffer.")
+ return TRUE
+
+/obj/machinery/computer/ammo_sorter/proc/linkSorter(var/obj/machinery/ammo_sorter/AS)
+ linked_sorters += AS
+ AS.linked_consoles += src
+ ui_update()
+
+/obj/machinery/computer/ammo_sorter/proc/unlinkSorter(var/obj/machinery/ammo_sorter/AS)
+ linked_sorters -= AS
+ AS.linked_consoles -= src
+ ui_update()
+
+// The ammo rack itself
+/obj/machinery/ammo_sorter
+ name = "Ammo Rack"
+ desc = "A machine that allows you to compartmentalise your ship's ammo stores, controlled by a central console. Drag and drop items onto it to load them."
+ icon = 'nsv13/icons/obj/munitions.dmi'
+ icon_state = "ammorack"
+ circuit = /obj/item/circuitboard/machine/ammo_sorter
+ density = TRUE
+ anchored = TRUE
+ var/id = null
+ var/list/linked_consoles = list() //to help with unlinking after destruction
+ var/list/loaded = list() //What's loaded in?
+ var/max_capacity = 12 //Max cap for holding.
+ var/durability = 100
+ var/max_durability = 100
+ var/repair_multiplier = 10 // How many points of durability we repair per unit of oil
+ var/jammed = FALSE //if at 0 durability, jam it, handled in weardown().
+ var/busy = FALSE
+
+/obj/machinery/ammo_sorter/Initialize(mapload)
+ . = ..()
+ for(var/obj/item/I in get_turf(src))
+ if(istype(I, /obj/item/ship_weapon/ammunition) || istype(I, /obj/item/powder_bag))
+ load(I, force = TRUE)
+
+/obj/machinery/ammo_sorter/Exited(atom/movable/gone, direction)
+ . = ..()
+ loaded -= gone
+ for(var/obj/machinery/computer/ammo_sorter/AS as() in linked_consoles)
+ AS.ui_update()
+
+/obj/machinery/ammo_sorter/attackby(obj/item/I, mob/user, params)
+ if(default_unfasten_wrench(user, I))
+ return
+ if(default_deconstruction_screwdriver(user, icon_state, icon_state, I))
+ busy = FALSE // Just in case it gets stuck somehow, you can reset it
+ update_icon()
+ return
+ // Makes sure you can't accidentally decon a jammed machine
+ if(!jammed && default_deconstruction_crowbar(I))
+ return
+ // Smacking
+ if(user.a_intent == INTENT_HARM)
+ return ..()
+ if(busy)
+ to_chat(user, "Someone's already working on [src]!")
+ return TRUE
+ if(panel_open && istype(I, /obj/item/reagent_containers))
+ if(jammed)
+ to_chat(user, "You can't lubricate a jammed machine!")
+ return TRUE
+ if(durability >= max_durability)
+ to_chat(user, "[src] doesn't need any oil right now!")
+ return TRUE
+ if(!I.reagents.has_reagent(/datum/reagent/oil))
+ to_chat(user, "You need oil to lubricate this!")
+ return TRUE
+ // get how much oil we have
+ var/oil_amount = min(I.reagents.get_reagent_amount(/datum/reagent/oil), max_durability/repair_multiplier)
+ var/oil_needed = CLAMP(ROUND_UP((max_durability-durability)/repair_multiplier), 1, oil_amount)
+ oil_amount = min(oil_amount, oil_needed)
+ user.visible_message("[user] begins lubricating [src]...", \
+ "You start lubricating the inner workings of [src]...")
+ busy = TRUE
+ if(!do_after(user, 5 SECONDS, target=src))
+ busy = FALSE
+ to_chat(user, "You were interrupted!")
+ return TRUE
+ if(!I.reagents.has_reagent(/datum/reagent/oil, oil_amount)) //things can change, check again.
+ to_chat(user, "You don't have enough oil left to lubricate [src]!")
+ busy = FALSE
+ return TRUE
+ user.visible_message("[user] lubricates [src].", \
+ "You lubricate the inner workings of [src].")
+ durability = min(durability + (oil_amount * repair_multiplier), max_durability)
+ I.reagents.remove_reagent(/datum/reagent/oil, oil_amount)
+ busy = FALSE
+ return TRUE
+ if(jammed && I.tool_behaviour == TOOL_CROWBAR)
+ if(panel_open)
+ to_chat(user, "You need to close the panel to get at the jammed machinery.")
+ return TRUE
+ busy = TRUE
+ user.visible_message("[user] begins clearing the jam in [src].", \
+ "You being clearing the jam in [src].")
+ if(!do_after(user, 10 SECONDS, target=src))
+ busy = FALSE
+ to_chat(user, "You were interrupted!")
+ return TRUE
+ user.visible_message("[user] clears the jam in [src].", \
+ "You clear the jam in [src].")
+ playsound(src, 'nsv13/sound/effects/ship/mac_load_unjam.ogg', 100, 1)
+ jammed = FALSE
+ durability += rand(0,5) //give the poor fools a few more uses if they're lucky
+ busy = FALSE
+ return TRUE
+ if(istype(I, /obj/item/ship_weapon/ammunition) || istype(I, /obj/item/powder_bag))
+ to_chat(user, "You start to load [src] with [I].")
+ if(!do_after(user, 0.5 SECONDS , target = src))
+ to_chat(user, "You were interrupted!")
+ return TRUE
+ load(I, user)
+ return TRUE
+ return ..()
+
+/obj/machinery/ammo_sorter/AltClick(mob/user)
+ . = ..()
+ setDir(turn(src.dir, -90))
+
+/obj/machinery/ammo_sorter/ex_act(severity, target)
+ for(var/obj/item/X in loaded)
+ X.ex_act(severity, target)
+ . = ..()
+
+/obj/machinery/ammo_sorter/multitool_act(mob/living/user, obj/item/I)
+ var/obj/item/multitool/M = I
+ if(!(M.buffer && istype(M.buffer, /obj/machinery/computer/ammo_sorter)))
+ to_chat(user, "There is no control console in [M]'s buffer.")
+ return TRUE
+ var/obj/machinery/computer/ammo_sorter/C = M.buffer
+ if(LAZYFIND(C.linked_sorters, src))
+ to_chat(user, "This sorter is already linked to [C]!")
+ return TRUE
+ C.linkSorter(src)
+ to_chat(user, "You link [src] to [C].")
+ return TRUE
+
+/obj/machinery/ammo_sorter/Destroy()
+ for(var/obj/machinery/computer/ammo_sorter/AS as() in linked_consoles)
+ AS.linked_sorters -= src
+ AS.ui_update()
+ . = ..()
+
+/obj/machinery/ammo_sorter/examine(mob/user)
+ . = ..()
+ if(panel_open)
+ . += "It's maintenance panel is open, you could probably add some oil to lubricate it." //it didnt tell the players if this was the case before.
+ if(jammed)
+ . += "It's jammed shut." //if it's jammed, don't show durability. only thing they need to know is that it's jammed.
+ else
+ switch(durability)
+ if(71 to 100)
+ . += "It doesn't need any maintenance right now."
+ if(31 to 70)
+ . += "It might need some maintenance done soon."
+ if(11 to 30)
+ . += "It could really do with some maintenance."
+ if(0 to 10)
+ . += "It's completely wrecked."
+ . += "
It's currently holding [length(loaded)]/[max_capacity] items:"
+ if(length(loaded))
+ var/listofitems = list()
+ for(var/obj/item/C in loaded)
+ var/path = C.type
+ if (listofitems[path])
+ listofitems[path]["amount"]++
+ else
+ listofitems[path] = list("name" = C.name, "amount" = 1)
+ for(var/i in listofitems)
+ . += "[listofitems[i]["name"]] x[listofitems[i]["amount"]]"
+
+/obj/machinery/ammo_sorter/RefreshParts()
+ max_capacity = 0
+ for(var/obj/item/stock_parts/matter_bin/MB in component_parts)
+ max_capacity += MB.rating+3
+ if(max_capacity < length(loaded))
+ pop()
+
+/obj/machinery/ammo_sorter/MouseDrop_T(atom/movable/A, mob/user)
+ . = ..()
+ if(!isliving(user))
+ return FALSE
+ //You can store any kind of ammo here for now.
+ if(istype(A, /obj/item/ship_weapon/ammunition) || istype(A, /obj/item/powder_bag))
+ to_chat(user, "You start to load [src] with [A].")
+ if(do_after(user, 2 SECONDS , target = src))
+ load(A, user)
+
+/obj/machinery/ammo_sorter/Bumped(atom/movable/AM)
+ . = ..()
+ load(AM) //Try load
+
+/obj/machinery/ammo_sorter/proc/pop()
+ var/length = length(loaded)
+ if(length)
+ return unload(loaded[length])
+ return FALSE
+
+/obj/machinery/ammo_sorter/proc/unload(atom/movable/AM)
+ if(!loaded.len)
+ return FALSE
+ if(jammed)
+ return FALSE
+ // do visuals/sound
+ playsound(src, 'nsv13/sound/effects/ship/mac_load.ogg', 100, 1)
+ flick("ammorack_dispense", src)
+ //Load it out the back.
+ loaded -= AM
+ AM.forceMove(get_turf(get_step(src, dir)))
+ weardown()
+ return TRUE
+
+/obj/machinery/ammo_sorter/proc/load(atom/movable/A, mob/user, force)
+ if(force && length(loaded) < max_capacity)
+ A.forceMove(src)
+ loaded += A
+ for(var/obj/machinery/computer/ammo_sorter/AS as() in linked_consoles)
+ AS.ui_update()
+ return TRUE
+ if(length(loaded) >= max_capacity)
+ if(user)
+ to_chat(user, "[src] is full!")
+ return FALSE
+ if(jammed || !(istype(A, /obj/item/ship_weapon/ammunition) || istype(A, /obj/item/powder_bag)))
+ return FALSE
+ playsound(src, 'nsv13/sound/effects/ship/mac_load.ogg', 100, 1)
+ flick("ammorack_dispense", src)
+ A.forceMove(src)
+ loaded += A
+ weardown()
+ for(var/obj/machinery/computer/ammo_sorter/AS as() in linked_consoles)
+ AS.ui_update()
+ return TRUE
+
+/obj/machinery/ammo_sorter/proc/weardown()
+ if(jammed)
+ return
+
+ // Subtract durability
+ if(durability > 0)
+ durability -= 1
+
+ // see if we're going to jam
+ var/jamchance = (durability > 0 ? CLAMP(-50*log(50, durability/50), 0, 100) : 100)
+ if(prob(jamchance))
+ jammed = TRUE
+ durability = 0
+
+ // Play a warning sound if the loader jams.
+ if(jammed)
+ playsound(src, 'nsv13/sound/effects/ship/mac_load_jam.ogg', 100, 1)
+
+/obj/machinery/ammo_sorter/upgraded
+ circuit = /obj/item/circuitboard/machine/ammo_sorter/upgraded
+ max_capacity = 21
+
+// Circuits for ammunition sorters
+/obj/item/circuitboard/computer/ammo_sorter
+ name = "ammo sorter console (circuitboard)"
+ build_path = /obj/machinery/computer/ammo_sorter
+
+/obj/item/circuitboard/machine/ammo_sorter
+ name = "ammo sorter (circuitboard)"
+ req_components = list(/obj/item/stock_parts/matter_bin = 3)
+ build_path = /obj/machinery/ammo_sorter
+ needs_anchored = FALSE
+
+/obj/item/circuitboard/machine/ammo_sorter/upgraded
+ def_components = list(/obj/item/stock_parts/matter_bin = /obj/item/stock_parts/matter_bin/bluespace) //item capacity of 21 (12+9)
diff --git a/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm b/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm
index 6c8ef2f73e1..5a45349d2e8 100644
--- a/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm
+++ b/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm
@@ -305,371 +305,3 @@
for(var/obj/item/ship_weapon/parts/missile/P in A)
P.forceMove(src)
held_components += P
-
-/datum/design/board/ammo_sorter_computer
- name = "Ammo sorter console (circuitboard)"
- desc = "The central control console for ammo sorters.."
- id = "ammo_sorter_computer"
- materials = list(/datum/material/glass = 2000, /datum/material/copper = 1000, /datum/material/gold = 500)
- build_path = /obj/item/circuitboard/computer/ammo_sorter
- category = list("Advanced Munitions")
- departmental_flags = DEPARTMENTAL_FLAG_MUNITIONS
-
-/datum/design/board/ammo_sorter
- name = "Ammo sorter (circuitboard)"
- desc = "A helpful storage unit that allows for mass storage of ammunition, with the ability to retrieve it all from a central console."
- id = "ammo_sorter"
- materials = list(/datum/material/glass = 2000, /datum/material/copper = 1000, /datum/material/gold = 500)
- build_path = /obj/item/circuitboard/machine/ammo_sorter
- category = list("Advanced Munitions")
- departmental_flags = DEPARTMENTAL_FLAG_MUNITIONS
-
-/obj/item/circuitboard/computer/ammo_sorter
- name = "ammo sorter console (circuitboard)"
- build_path = /obj/machinery/computer/ammo_sorter
-
-/obj/item/circuitboard/machine/ammo_sorter
- name = "ammo sorter (circuitboard)"
- req_components = list(/obj/item/stock_parts/matter_bin = 3)
- build_path = /obj/machinery/ammo_sorter
- needs_anchored = FALSE
-
-/obj/item/circuitboard/machine/ammo_sorter/upgraded
- def_components = list(/obj/item/stock_parts/matter_bin = /obj/item/stock_parts/matter_bin/bluespace) //item capacity of 21 (12+9)
-
-/obj/machinery/computer/ammo_sorter
- name = "ammo rack control console"
- icon_screen = "ammorack"
- circuit = /obj/item/circuitboard/computer/ammo_sorter
- var/id = null
- var/list/linked_sorters = list()
-
-/obj/machinery/computer/ammo_sorter/Initialize(mapload, obj/item/circuitboard/C)
- . = ..()
- if(mapload)
- return INITIALIZE_HINT_LATELOAD
-
-/obj/machinery/computer/ammo_sorter/LateInitialize()
- . = ..()
- for(var/obj/machinery/ammo_sorter/W in GLOB.machines)
- if(istype(W) && W.id == id)
- linkSorter(W)
- sortList(linked_sorters) //Alphabetise the list initially...
-
-/obj/machinery/computer/ammo_sorter/ui_interact(mob/user, datum/tgui/ui)
- ui = SStgui.try_update_ui(user, src, ui)
- if(!ui)
- ui = new(user, src, "AmmoSorter")
- ui.open()
-
-/obj/machinery/computer/ammo_sorter/ui_act(action, params, datum/tgui/ui)
- if(..())
- return
- var/obj/machinery/ammo_sorter/AS = locate(params["id"])
- switch(action)
- if("unload_all")
- unload_all()
- if("unload")
- if(!AS)
- return
- AS.pop()
- if("unlink")
- if(!AS)
- return
- unlinkSorter(AS)
- if("rename")
- if(!AS)
- return
- var/new_name = stripped_input(usr, message="Enter a new name for [AS]", max_length=MAX_CHARTER_LEN)
-
- if(!new_name)
- return
-
- AS.name = new_name
- message_admins("[key_name(usr)] renamed an ammo rack to [new_name].")
- log_game("[key_name(usr)] renamed an ammo rack to [new_name].")
- if("moveup")
- if(!AS)
- return
- var/id = linked_sorters.Find(AS)
- if (id <= 1)
- return
- linked_sorters.Swap(id,id-1)
- if("movedown")
- if(!AS)
- return
- var/id = linked_sorters.Find(AS)
- if (id >= linked_sorters.len)
- return
- linked_sorters.Swap(id,id+1)
- // update UI
- ui_interact(usr)
-
-/obj/machinery/computer/ammo_sorter/proc/unload_all()
- for(var/obj/machinery/ammo_sorter/AS as() in linked_sorters)
- AS.unload()
-
-/obj/machinery/computer/ammo_sorter/proc/linkSorter(var/obj/machinery/ammo_sorter/AS)
- linked_sorters += AS
- AS.linked_consoles += src
- ui_update()
-
-/obj/machinery/computer/ammo_sorter/proc/unlinkSorter(var/obj/machinery/ammo_sorter/AS)
- linked_sorters -= AS
- AS.linked_consoles -= src
- ui_update()
-
-/obj/machinery/computer/ammo_sorter/ui_data(mob/user)
- . = ..()
- var/list/data = list()
- var/list/racks_info = list()
- for(var/obj/machinery/ammo_sorter/AS as() in linked_sorters)
- var/atom/what = null
- var/loadedlen = length(AS.loaded)
- if(loadedlen)
- what = AS.loaded[loadedlen]
- racks_info[++racks_info.len] = list("name"=AS.name, "has_loaded"=loadedlen > 0, "id"="\ref[AS]", "top"=(what ? what.name : "Nothing"))
- data["racks_info"] = racks_info
- return data
-
-/obj/machinery/ammo_sorter
- name = "Ammo Rack"
- desc = "A machine that allows you to compartmentalise your ship's ammo stores, controlled by a central console. Drag and drop items onto it to load them."
- icon = 'nsv13/icons/obj/munitions.dmi'
- icon_state = "ammorack"
- circuit = /obj/item/circuitboard/machine/ammo_sorter
- density = TRUE
- anchored = TRUE
- var/id = null
- var/list/linked_consoles = list() //to help with unlinking after destruction
- var/list/loaded = list() //What's loaded in?
- var/max_capacity = 12 //Max cap for holding.
- var/loading = FALSE
- var/durability = 100
- var/max_durability = 100
- var/repair_multiplier = 10 // How many points of durability we repair per unit of oil
- var/jammed = FALSE //if at 0 durability, jam it, handled in weardown().
- var/jamchance = 0 //probability to jam every weardown
- var/busy = FALSE
-
-/obj/machinery/ammo_sorter/attackby(obj/item/I, mob/user, params)
- if(default_unfasten_wrench(user, I))
- return
- if(default_deconstruction_screwdriver(user, icon_state, icon_state, I))
- busy = FALSE // Just in case it gets stuck somehow, you can reset it
- update_icon()
- return
- if(default_deconstruction_crowbar(I))
- return
- if(busy)
- to_chat(user, "Someone's already working on [src]!")
- return TRUE
- if(panel_open && istype(I, /obj/item/reagent_containers))
- if(!jammed)
- if(durability < 100)
- if(I.reagents.has_reagent(/datum/reagent/oil))
- // get how much oil we have
- var/oil_amount = min(I.reagents.get_reagent_amount(/datum/reagent/oil), max_durability/repair_multiplier)
- var/oil_needed = CLAMP(round((max_durability-durability)/repair_multiplier), 1, oil_amount)
- oil_amount = min(oil_amount, oil_needed)
- to_chat(user, "You start lubricating the inner workings of [src]...")
- busy = TRUE
- if(!do_after(user, 5 SECONDS, target=src))
- busy = FALSE
- return
- if(!I.reagents.has_reagent(/datum/reagent/oil, oil_amount)) //things can change, check again.
- to_chat(user, "You don't have enough oil left to lubricate [src]!")
- busy = FALSE
- return TRUE
- to_chat(user, "You lubricate the inner workings of [src].")
- durability = min(durability + (oil_amount * repair_multiplier), max_durability)
- I.reagents.remove_reagent(/datum/reagent/oil, oil_amount)
- busy = FALSE
- return TRUE
- else
- to_chat(user, "You need oil to lubricate this!")
- return TRUE
- else
- to_chat(user, "[src] doesn't need any oil right now!")
- return TRUE
- else
- to_chat(user, "You can't lubricate a jammed machine!")
- return TRUE
- if(jammed && I.tool_behaviour == TOOL_CROWBAR)
- if(!panel_open)
- busy = TRUE
- to_chat(user, "You begin clearing the jam...")
- if(!do_after(user, 10 SECONDS, target=src))
- busy = FALSE
- return
- to_chat(user, "You clear the jam with the crowbar.")
- playsound(src, 'nsv13/sound/effects/ship/mac_load_unjam.ogg', 100, 1)
- jammed = FALSE
- durability += rand(0,5) //give the poor fools a few more uses if they're lucky
- busy = FALSE
- else
- to_chat(user, "You need to close the panel to get at the jammed machinery.")
- return TRUE
- return ..()
-
-/obj/machinery/ammo_sorter/AltClick(mob/user)
- . = ..()
- setDir(turn(src.dir, -90))
-
-/obj/machinery/ammo_sorter/ex_act(severity, target)
- for(var/obj/item/X in loaded)
- X.ex_act(severity, target)
- . = ..()
-
-/obj/machinery/ammo_sorter/Initialize(mapload)
- . = ..()
- for(var/obj/item/I in get_turf(src))
- if(istype(I, /obj/item/ship_weapon/ammunition) || istype(I, /obj/item/powder_bag))
- load(I, force = TRUE)
-
-/obj/machinery/ammo_sorter/multitool_act(mob/living/user, obj/item/I)
- var/obj/item/multitool/M = I
- if(M.buffer && istype(M.buffer, /obj/machinery/computer/ammo_sorter))
- var/obj/machinery/computer/ammo_sorter/C = M.buffer
- if(LAZYFIND(C.linked_sorters, src))
- to_chat(user, "This sorter is already linked to [C]...")
- return TRUE
- C.linkSorter(src)
- to_chat(user, "You've linked [src] to [C]...")
- else
- to_chat(user, "There is no control console in [M]'s buffer.")
- return TRUE
-
-/obj/machinery/computer/ammo_sorter/multitool_act(mob/living/user, obj/item/I)
- if(!multitool_check_buffer(user, I))
- return TRUE
- var/obj/item/multitool/M = I
- M.buffer = src
- to_chat(user, "You add [src] to [M]'s buffer.")
- return TRUE
-
-/obj/machinery/computer/ammo_sorter/Destroy()
- for(var/obj/machinery/ammo_sorter/AS as() in linked_sorters)
- AS.linked_consoles -= src
- . = ..()
-
-/obj/machinery/ammo_sorter/Destroy()
- for(var/obj/machinery/computer/ammo_sorter/AS as() in linked_consoles)
- AS.linked_sorters -= src
- AS.ui_update()
- . = ..()
-
-/obj/machinery/ammo_sorter/examine(mob/user)
- . = ..()
- if(panel_open)
- . += "Its maintenance panel is open, you could probably add some oil to lubricate it." //it didnt tell the players if this was the case before.
- if(jammed)
- . += "It's jammed shut." //if it's jammed, don't show durability. only thing they need to know is that it's jammed.
- else
- switch(durability)
- if(71 to 100)
- . += "It doesn't need any maintenance right now."
- if(31 to 70)
- . += "It might need some maintenance done soon."
- if(11 to 30)
- . += "It could really do with some maintenance."
- if(0 to 10)
- . += "It's completely wrecked."
- . += "
It's currently holding [loaded.len]/[max_capacity] items:"
- if(loaded.len)
- var/listofitems = list()
- for(var/obj/item/C in loaded)
- var/path = C.type
- if (listofitems[path])
- listofitems[path]["amount"]++
- else
- listofitems[path] = list("name" = C.name, "amount" = 1)
- for(var/i in listofitems)
- . += "[listofitems[i]["name"]] x[listofitems[i]["amount"]]"
-
-/obj/machinery/ammo_sorter/RefreshParts()
- max_capacity = 0
- for(var/obj/item/stock_parts/matter_bin/MB in component_parts)
- max_capacity += MB.rating+3
- if(max_capacity < length(loaded))
- pop()
-
-/obj/machinery/ammo_sorter/MouseDrop_T(atom/movable/A, mob/user)
- . = ..()
- if(!isliving(user))
- return FALSE
- //You can store any kind of ammo here for now.
- if(istype(A, /obj/item/ship_weapon/ammunition) || istype(A, /obj/item/powder_bag))
- to_chat(user, "You start to load [src] with [A]")
- if(do_after(user, 2 SECONDS , target = src))
- load(A, user)
-
-/obj/machinery/ammo_sorter/Bumped(atom/movable/AM)
- . = ..()
- load(AM) //Try load
-
-/obj/machinery/ammo_sorter/proc/pop()
- var/length = length(loaded)
- if(length)
- unload(loaded[length])
-
-/obj/machinery/ammo_sorter/proc/unload(atom/movable/AM)
- if(!loaded.len)
- return FALSE
- if(jammed)
- playsound(src, 'nsv13/sound/effects/ship/mac_load_jam.ogg', 100, 1)
- return FALSE
- else
- playsound(src, 'nsv13/sound/effects/ship/mac_load.ogg', 100, 1)
- flick("ammorack_dispense", src)
- loaded -= AM
- //Load it out the back.
- AM.forceMove(get_turf(get_step(src, dir)))
- weardown()
-
-
-/obj/machinery/ammo_sorter/proc/load(atom/movable/A, mob/user, force)
- if(force && length(loaded) < max_capacity)
- A.forceMove(src)
- loaded += A
- for(var/obj/machinery/computer/ammo_sorter/AS as() in linked_consoles)
- AS.ui_update()
- return TRUE
- if(length(loaded) >= max_capacity)
- if(user)
- to_chat(user, "[src] is full!")
- loading = FALSE
- return FALSE
- if(jammed)
- if(istype(A, /obj/item/ship_weapon/ammunition) || istype(A, /obj/item/powder_bag))
- playsound(src, 'nsv13/sound/effects/ship/mac_load_jam.ogg', 100, 1)
- loading = FALSE
- return FALSE
- else
- if(istype(A, /obj/item/ship_weapon/ammunition) || istype(A, /obj/item/powder_bag))
- playsound(src, 'nsv13/sound/effects/ship/mac_load.ogg', 100, 1)
- flick("ammorack_dispense", src)
- A.forceMove(src)
- loading = FALSE
- loaded += A
- weardown()
- for(var/obj/machinery/computer/ammo_sorter/AS as() in linked_consoles)
- AS.ui_update()
- return TRUE
- else
- loading = FALSE
- return FALSE
-
-/obj/machinery/ammo_sorter/proc/weardown()
- if(durability > 0) //don't go under 0, that's bad
- durability -= 1 //using it wears it down.
- else
- jammed = TRUE // if it's at 0, jam it.
- durability = 0 // in case an admin plays with this and doesn't know how to use it, we reset it here for good measure.
- jamchance = CLAMP(-50*log(50, durability/50), 0, 100) //logarithmic function; at 50 it starts increasing from 0
- if(prob(jamchance))
- jammed = TRUE
-
-/obj/machinery/ammo_sorter/upgraded
- circuit = /obj/item/circuitboard/machine/ammo_sorter/upgraded
- max_capacity = 21
diff --git a/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm b/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm
index fe3d9edd61b..9f4fd686b8d 100644
--- a/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm
+++ b/nsv13/code/modules/research/designs/nsv_circuitboard_designs.dm
@@ -130,3 +130,22 @@
build_path = /obj/item/circuitboard/machine/navbeacon
category = list ("Research Machinery")
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE | DEPARTMENTAL_FLAG_ENGINEERING
+
+// Ammo sorter circuit designs
+/datum/design/board/ammo_sorter_computer
+ name = "Ammo sorter console (circuitboard)"
+ desc = "The central control console for ammo sorters.."
+ id = "ammo_sorter_computer"
+ materials = list(/datum/material/glass = 2000, /datum/material/copper = 1000, /datum/material/gold = 500)
+ build_path = /obj/item/circuitboard/computer/ammo_sorter
+ category = list("Advanced Munitions")
+ departmental_flags = DEPARTMENTAL_FLAG_MUNITIONS
+
+/datum/design/board/ammo_sorter
+ name = "Ammo sorter (circuitboard)"
+ desc = "A helpful storage unit that allows for mass storage of ammunition, with the ability to retrieve it all from a central console."
+ id = "ammo_sorter"
+ materials = list(/datum/material/glass = 2000, /datum/material/copper = 1000, /datum/material/gold = 500)
+ build_path = /obj/item/circuitboard/machine/ammo_sorter
+ category = list("Advanced Munitions")
+ departmental_flags = DEPARTMENTAL_FLAG_MUNITIONS
From 982e666de0ab005671047ff3b1d1609af90e34e7 Mon Sep 17 00:00:00 2001
From: ss13-beebot <56381746+ss13-beebot@users.noreply.github.com>
Date: Fri, 31 May 2024 11:13:08 -0500
Subject: [PATCH 3/8] Automatic changelog generation for PR #2639 [ci skip]
---
html/changelogs/AutoChangeLog-pr-2639.yml | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 html/changelogs/AutoChangeLog-pr-2639.yml
diff --git a/html/changelogs/AutoChangeLog-pr-2639.yml b/html/changelogs/AutoChangeLog-pr-2639.yml
new file mode 100644
index 00000000000..cf9b24452b0
--- /dev/null
+++ b/html/changelogs/AutoChangeLog-pr-2639.yml
@@ -0,0 +1,6 @@
+author: benbot16
+delete-after: true
+changes:
+ - rscadd: Ammo racks may now be loaded by attacking them with ammunition
+ - tweak: Jam SFX now plays on jam instead of on load attempt
+ - bugfix: Fixes a few ammo rack-related edge cases
From 1c3dcb791ec19c181acaeab0fbf2607e5feffbc3 Mon Sep 17 00:00:00 2001
From: DeltaFire <46569814+DeltaFire15@users.noreply.github.com>
Date: Fri, 31 May 2024 18:13:55 +0200
Subject: [PATCH 4/8] Very minor code stuff (#2645)
---
.../code/modules/overmap/armour/nano_pump.dm | 23 +++-------
.../code/modules/overmap/armour/nano_well.dm | 16 +++++--
.../modules/overmap/fighters/_fighters.dm | 45 ++++++++++++-------
3 files changed, 49 insertions(+), 35 deletions(-)
diff --git a/nsv13/code/modules/overmap/armour/nano_pump.dm b/nsv13/code/modules/overmap/armour/nano_pump.dm
index 377d9f07175..a6bb758fdba 100644
--- a/nsv13/code/modules/overmap/armour/nano_pump.dm
+++ b/nsv13/code/modules/overmap/armour/nano_pump.dm
@@ -228,29 +228,20 @@
ui.set_autoupdate(TRUE)
/obj/machinery/armour_plating_nanorepair_pump/ui_act(action, params, datum/tgui/ui)
- if(..())
+ . = ..()
+ if(.)
return
- if(!(in_range(src, usr) | IsAdminGhost(usr)))
+ if(!(in_range(src, usr) || IsAdminGhost(usr)))
return
var/adjust = text2num(params["adjust"])
if(action == "armour_allocation")
if(isnum(adjust))
- armour_allocation = adjust
- if(armour_allocation > 100 - structure_allocation)
- armour_allocation = 100 - structure_allocation
- return
- if(armour_allocation <= 0)
- armour_allocation = 0
- return
+ armour_allocation = CLAMP(adjust, 0, 100 - structure_allocation)
+ return TRUE
if(action == "structure_allocation")
if(isnum(adjust))
- structure_allocation = adjust
- if(structure_allocation > 100 - armour_allocation)
- structure_allocation = 100 - armour_allocation
- return
- if(structure_allocation <= 0)
- structure_allocation = 0
- return
+ structure_allocation = CLAMP(adjust, 0, 100 - armour_allocation)
+ return TRUE
/obj/machinery/armour_plating_nanorepair_pump/ui_data(mob/user)
var/list/data = list()
diff --git a/nsv13/code/modules/overmap/armour/nano_well.dm b/nsv13/code/modules/overmap/armour/nano_well.dm
index 241f095de8e..7005822ea59 100644
--- a/nsv13/code/modules/overmap/armour/nano_well.dm
+++ b/nsv13/code/modules/overmap/armour/nano_well.dm
@@ -352,16 +352,16 @@ Starting Materials
ui.set_autoupdate(TRUE)
/obj/machinery/armour_plating_nanorepair_well/ui_act(action, params, datum/tgui/ui)
- if(..())
+ . = ..()
+ if(.)
return
if(!(in_range(src, usr) || IsAdminGhost(usr)))
return
var/adjust = text2num(params["adjust"])
if(action == "power_allocation")
if(isnum(adjust))
- power_allocation = adjust
- adjust = CLAMP(adjust, 0, maximum_power_allocation)
- return
+ power_allocation = CLAMP(adjust, 0, maximum_power_allocation)
+ return TRUE
switch(action)
if("iron")
if(material_tier != 0)
@@ -371,6 +371,7 @@ Starting Materials
return
else
material_tier = 1
+ . = TRUE
if("plasteel")
if(material_tier != 0)
@@ -380,6 +381,7 @@ Starting Materials
return
else
material_tier = 2
+ . = TRUE
if("ferrotitanium")
if(material_tier != 0)
@@ -389,6 +391,7 @@ Starting Materials
return
else
material_tier = 3
+ . = TRUE
if("durasteel")
if(material_tier != 0)
@@ -398,6 +401,7 @@ Starting Materials
return
else
material_tier = 4
+ . = TRUE
if("duranium")
if(material_tier != 0)
@@ -407,6 +411,7 @@ Starting Materials
return
else
material_tier = 5
+ . = TRUE
if("purge")
if(resourcing_system)
@@ -427,6 +432,7 @@ Starting Materials
var/current_temp = env.return_temperature()
env.set_temperature(current_temp + 25)
air_update_turf()
+ . = TRUE
if("unload")
if(resourcing_system)
@@ -437,6 +443,7 @@ Starting Materials
else
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
materials.retrieve_all(get_turf(usr))
+ . = TRUE
if("toggle")
if(material_tier == 0)
@@ -445,6 +452,7 @@ Starting Materials
playsound(src, sound, 100, 1)
else
resourcing_system = !resourcing_system
+ . = TRUE
/obj/machinery/armour_plating_nanorepair_well/ui_data(mob/user)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
diff --git a/nsv13/code/modules/overmap/fighters/_fighters.dm b/nsv13/code/modules/overmap/fighters/_fighters.dm
index 7b930cdfd01..543c4bf5cd7 100644
--- a/nsv13/code/modules/overmap/fighters/_fighters.dm
+++ b/nsv13/code/modules/overmap/fighters/_fighters.dm
@@ -82,7 +82,8 @@ Been a mess since 2018, we'll fix it someday (probably)
/obj/structure/overmap/small_craft/key_down(key, client/user)
if(disruption && prob(min(95, disruption)))
- to_chat(src, "The controls buzz angrily.")
+ if(user)
+ to_chat(user, "The controls buzz angrily!")
playsound(helm, 'sound/machines/buzz-sigh.ogg', 75, 1)
return
. = ..()
@@ -195,18 +196,20 @@ Been a mess since 2018, we'll fix it someday (probably)
return data
/obj/structure/overmap/small_craft/ui_act(action, params, datum/tgui/ui)
- if(..() || ((usr != pilot) && (!IsAdminGhost(usr))))
+ . = ..()
+ if(. || ((usr != pilot) && (!IsAdminGhost(usr))))
return
if(disruption && prob(min(95, disruption)))
- to_chat(src, "The controls buzz angrily.")
+ to_chat(usr, "The controls buzz angrily!")
relay('sound/machines/buzz-sigh.ogg')
- return
+ return TRUE
var/atom/movable/target = locate(params["id"])
switch(action)
if("examine")
if(!target)
return
to_chat(usr, "[target.desc]")
+ . = TRUE
if("eject_hardpoint")
if(!target)
return
@@ -218,6 +221,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
to_chat(usr, "")
loadout.dump_contents(FC)
+ . = TRUE
if("kick")
if(!target)
return
@@ -239,6 +244,7 @@ Been a mess since 2018, we'll fix it someday (probably)
canopy_open = FALSE
toggle_canopy()
stop_piloting(L)
+ . = TRUE
if("fuel_pump")
var/obj/item/fighter_component/apu/APU = loadout.get_slot(HARDPOINT_SLOT_APU)
if(!APU)
@@ -246,9 +252,11 @@ Been a mess since 2018, we'll fix it someday (probably)
return
var/obj/item/fighter_component/engine/engine = loadout.get_slot(HARDPOINT_SLOT_ENGINE)
if(!engine)
- to_chat(usr, "You can't send fuel to an APU that isn't installed.")
+ to_chat(usr, "[src] does not have an engine installed!")
+ return
APU.toggle_fuel_line()
playsound(src, 'nsv13/sound/effects/fighters/warmup.ogg', 100, FALSE)
+ . = TRUE
if("battery")
var/obj/item/fighter_component/battery/battery = loadout.get_slot(HARDPOINT_SLOT_BATTERY)
if(!battery)
@@ -256,6 +264,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
battery.toggle()
to_chat(usr, "You flip the battery switch.")
+ . = TRUE
if("apu")
var/obj/item/fighter_component/apu/APU = loadout.get_slot(HARDPOINT_SLOT_APU)
if(!APU)
@@ -263,17 +272,20 @@ Been a mess since 2018, we'll fix it someday (probably)
return
APU.toggle()
playsound(src, 'nsv13/sound/effects/fighters/warmup.ogg', 100, FALSE)
+ . = TRUE
if("ignition")
var/obj/item/fighter_component/engine/engine = loadout.get_slot(HARDPOINT_SLOT_ENGINE)
if(!engine)
to_chat(usr, "[src] does not have an engine installed!")
return
engine.try_start()
+ . = TRUE
if("canopy_lock")
var/obj/item/fighter_component/canopy/canopy = loadout.get_slot(HARDPOINT_SLOT_CANOPY)
if(!canopy)
return
toggle_canopy()
+ . = TRUE
if("docking_mode")
var/obj/item/fighter_component/docking_computer/DC = loadout.get_slot(HARDPOINT_SLOT_DOCKING)
if(!DC || !istype(DC))
@@ -282,33 +294,34 @@ Been a mess since 2018, we'll fix it someday (probably)
to_chat(usr, "You [DC.docking_mode ? "disengage" : "engage"] [src]'s docking computer.")
DC.docking_mode = !DC.docking_mode
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("brakes")
toggle_brakes()
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("inertial_dampeners")
toggle_inertia()
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("weapon_safety")
toggle_safety()
relay('nsv13/sound/effects/fighters/switch.ogg')
- return
+ return TRUE
if("target_lock")
relay('nsv13/sound/effects/fighters/switch.ogg')
dump_locks()
- return
+ return TRUE
if("mag_release")
if(!mag_lock)
return
mag_lock.abort_launch()
+ . = TRUE
if("master_caution")
set_master_caution(FALSE)
- return
+ return TRUE
if("show_dradis")
dradis?.ui_interact(usr)
- return
+ return TRUE
if("toggle_ftl")
var/obj/item/fighter_component/ftl/ftl = loadout.get_slot(HARDPOINT_SLOT_FTL)
if(!ftl)
@@ -316,6 +329,7 @@ Been a mess since 2018, we'll fix it someday (probably)
return
ftl.toggle()
relay('nsv13/sound/effects/fighters/switch.ogg')
+ . = TRUE
if("anchor_ftl")
var/obj/item/fighter_component/ftl/ftl = loadout.get_slot(HARDPOINT_SLOT_FTL)
if(!ftl)
@@ -327,6 +341,7 @@ Been a mess since 2018, we'll fix it someday (probably)
else
to_chat(usr, "Unable to update telemetry. Ensure you are in proximity to a Seegson FTL drive.")
relay('nsv13/sound/effects/fighters/switch.ogg')
+ . = TRUE
if("return_jump")
var/obj/item/fighter_component/ftl/ftl = loadout.get_slot(HARDPOINT_SLOT_FTL)
if(!ftl)
@@ -342,7 +357,7 @@ Been a mess since 2018, we'll fix it someday (probably)
to_chat(usr, "Unable to comply. Target beacon is currently in FTL transit.")
return
ftl.jump(dest)
- return
+ return TRUE
if("set_name")
var/new_name = stripped_input(usr, message="What do you want to name \
your fighter? Keep in mind that particularly terrible names may be \
@@ -351,10 +366,10 @@ Been a mess since 2018, we'll fix it someday (probably)
return
message_admins("[key_name_admin(usr)] renamed a fighter to [new_name] [ADMIN_LOOKUPFLW(src)].")
name = new_name
- return
+ return TRUE
if("toggle_maintenance")
maintenance_mode = !maintenance_mode
- return
+ return TRUE
relay('nsv13/sound/effects/fighters/switch.ogg')
From 96efc9441503a34f691e0df43e703d78e72b3ae8 Mon Sep 17 00:00:00 2001
From: Ikalpo
Date: Fri, 31 May 2024 09:14:08 -0700
Subject: [PATCH 5/8] Slow Belts Are Yellow Now + Some Minor Fixes and
Additions to Conveyors (#2642)
---
code/modules/recycling/conveyor.dm | 85 ++++++++++++++++---
.../ballistic_weapons/revision2/automation.dm | 3 +
2 files changed, 74 insertions(+), 14 deletions(-)
diff --git a/code/modules/recycling/conveyor.dm b/code/modules/recycling/conveyor.dm
index 732db5c9c66..dc06ca9f0bd 100644
--- a/code/modules/recycling/conveyor.dm
+++ b/code/modules/recycling/conveyor.dm
@@ -233,8 +233,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
if(I.use_tool(src, user, 40, volume=40))
set_operating(FALSE)
if(!(machine_stat & BROKEN))
- var/obj/item/stack/conveyor/C = new /obj/item/stack/conveyor(loc, 1, TRUE, null, id)
- C.conveyor_type = type //NSV13 - conveyor type
+ var/obj/C = new stack_type(loc, 1, TRUE, null, id) //NSV13 - slow conveyors
if(!QDELETED(C)) //God I hate stacks
transfer_fingerprints_to(C)
to_chat(user, "You remove the conveyor belt.")
@@ -308,6 +307,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
icon = 'icons/obj/recycling.dmi'
icon_state = "switch-off"
processing_flags = START_PROCESSING_MANUALLY
+ obj_flags = UNIQUE_RENAME //NSV13 conveyor switch changes
var/position = 0 // 0 off, -1 reverse, 1 forward
var/last_pos = -1 // last direction setting
@@ -316,10 +316,21 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
var/id = "" // must match conveyor IDs to control them
-/obj/machinery/conveyor_switch/Initialize(mapload, newid)
+
+/obj/machinery/conveyor_switch/examine() //NSV13 conveyor switch changes
+ . = ..()
+ if(oneway)
+ . += "It has been set to only go in one direction."
+ . += "You can force it to go the other way with Alt-click."
+
+/obj/machinery/conveyor_switch/Initialize(mapload, newid, isoneway, isinvert)
. = ..()
if (newid)
id = newid
+ if (isoneway) // NSV13 conveyor switch changes
+ oneway = isoneway //could be negative for reverse
+ if (isinvert)
+ invert_icon = TRUE
update_icon()
LAZYADD(GLOB.conveyors_by_id[id], src)
@@ -361,16 +372,19 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
/// Finds any switches with same `id` as this one, and set their position and icon to match us.
/obj/machinery/conveyor_switch/proc/update_linked_switches()
for(var/obj/machinery/conveyor_switch/S in GLOB.conveyors_by_id[id])
- S.invert_icon = invert_icon
+ // S.invert_icon = invert_icon //NSV13 conveyor switch changes
S.position = position
S.update_icon()
CHECK_TICK
/// Updates the switch's `position` and `last_pos` variable. Useful so that the switch can properly cycle between the forwards, backwards and neutral positions.
-/obj/machinery/conveyor_switch/proc/update_position()
+/obj/machinery/conveyor_switch/proc/update_position(altClicked) //NSV13 conveyor switch changes
if(position == 0)
if(oneway) //is it a oneway switch
- position = oneway
+ if(altClicked) //NSV13 conveyor switch changes
+ position = -1
+ else
+ position = oneway
else
if(last_pos < 0)
position = 1
@@ -386,23 +400,33 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
/obj/machinery/conveyor_switch/interact(mob/user)
add_fingerprint(user)
play_click_sound("switch")
- update_position()
+ update_position(FALSE) //NSV13 conveyor switch changes
update_icon()
update_linked_conveyors()
update_linked_switches()
+/obj/machinery/conveyor_switch/AltClick(mob/user) //NSV13 conveyor switch changes
+ if(can_interact(user))
+ add_fingerprint(user)
+ play_click_sound("switch")
+ update_position(TRUE)
+ update_icon()
+ update_linked_conveyors()
+ update_linked_switches()
+
/obj/machinery/conveyor_switch/attackby(obj/item/I, mob/user, params)
if(I.tool_behaviour == TOOL_CROWBAR)
var/obj/item/conveyor_switch_construct/C = new/obj/item/conveyor_switch_construct(src.loc)
C.id = id
+ C.oneway = oneway //NSV13 conveyor switch changes
+ C.invert_icon = invert_icon //NSV13
transfer_fingerprints_to(C)
to_chat(user, "You detach the conveyor switch.")
qdel(src)
/obj/machinery/conveyor_switch/oneway
- icon_state = "conveyor_switch_oneway"
- desc = "A conveyor control switch. It appears to only go in one direction."
+ icon_state = "conveyor_switch_oneway" //NSV13 conveyor switch changes - dynamic description
oneway = TRUE
/obj/machinery/conveyor_switch/oneway/Initialize(mapload)
@@ -416,16 +440,49 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
icon = 'icons/obj/recycling.dmi'
icon_state = "switch-off"
w_class = WEIGHT_CLASS_BULKY
+ var/oneway = FALSE //NSV13 conveyor switch changes
+ var/invert_icon = FALSE //NSV13
var/id = "" //inherited by the switch
/obj/item/conveyor_switch_construct/Initialize(mapload)
. = ..()
id = "[rand()]" //this couldn't possibly go wrong
+/obj/item/conveyor_switch_construct/examine() //NSV13 conveyor switch changes
+ . = ..()
+ . += "Use on a conveyor belt or switch assembly to link them to it."
+ . += "Use a belt assembly on it to use the belt's link instead."
+ . += "You can use a screwdriver to adjust the direction lock, and a wrench to rotate it."
+ . += "Use in hand to reset the switch's links."
+
+/obj/item/conveyor_switch_construct/attackby(obj/item/I, mob/user, params) //NSV13 conveyor switch changes
+ if(I.tool_behaviour == TOOL_SCREWDRIVER)
+ if (!oneway)
+ oneway = 1 //forward
+ to_chat(user, "You engage the direction lock.")
+ else if (oneway > 0)
+ oneway = -1 //reverse
+ to_chat(user, "You reverse the direction lock.")
+ else
+ oneway = 0 //off
+ to_chat(user, "You disengage the direction lock.")
+ else if (I.tool_behaviour == TOOL_WRENCH)
+ invert_icon = !invert_icon
+ to_chat(user, "You rotate the switch's direction.")
+ else if(istype(I, /obj/item/conveyor_switch_construct))
+ to_chat(user, "You copy the switch's link to the other.")
+ var/obj/item/conveyor_switch_construct/C = I
+ id = C.id
+ else if(istype(I, /obj/item/stack/conveyor))// the opposite of the original linking process - this updates the switch's ID to the belt
+ to_chat(user, "You link the switch to the conveyor belt assembly.")
+ var/obj/item/stack/conveyor/C = I
+ id = C.id
+ else
+ return ..()
+
/obj/item/conveyor_switch_construct/attack_self(mob/user)
- for(var/obj/item/stack/conveyor/C in view())
- C.id = id
- to_chat(user, "You have linked all nearby conveyor belt assemblies to this switch.")
+ id = "[rand()]" //NSV13 conveyor switch changes
+ to_chat(user, "You reset the switch's links.") //NSV13
/obj/item/conveyor_switch_construct/afterattack(atom/A, mob/user, proximity)
. = ..()
@@ -439,7 +496,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
if(!found)
to_chat(user, "[icon2html(src, user)]The conveyor switch did not detect any linked conveyor belts in range.")
return
- var/obj/machinery/conveyor_switch/NC = new/obj/machinery/conveyor_switch(A, id)
+ var/obj/machinery/conveyor_switch/NC = new/obj/machinery/conveyor_switch(A, id, oneway, invert_icon) //NSV13 conveyor switch changes
transfer_fingerprints_to(NC)
qdel(src)
@@ -476,7 +533,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
/obj/item/stack/conveyor/attackby(obj/item/I, mob/user, params)
..()
if(istype(I, /obj/item/conveyor_switch_construct))
- to_chat(user, "You link the switch to the conveyor belt assembly.")
+ to_chat(user, "You link the conveyor belt assembly to the switch.") //NSV13 conveyor switch changes
var/obj/item/conveyor_switch_construct/C = I
id = C.id
diff --git a/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm b/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm
index 5a45349d2e8..ea00d4a3729 100644
--- a/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm
+++ b/nsv13/code/modules/munitions/ship_weapons/ballistic_weapons/revision2/automation.dm
@@ -52,12 +52,15 @@
/obj/item/stack/conveyor/slow
name = "Slow conveyor assembly"
conveyor_type = /obj/machinery/conveyor/slow
+ merge_type = /obj/item/stack/conveyor/slow
+ color = list(1,1,0,0, 0,0,0,0, 0,0.1,1,0, 0,0,0,1, 0,0,0,0) //Yellow Belt
/obj/machinery/conveyor/slow
name = "Slow conveyor"
subsystem_type = /datum/controller/subsystem/machines
stack_type = /obj/item/stack/conveyor/slow //What does this conveyor drop when decon'd?
conveyor_speed = 2 SECONDS
+ color = list(1,1,0,0, 0,0,0,0, 0,0.1,1,0, 0,0,0,1, 0,0,0,0) //Yellow Belt
/obj/machinery/missile_builder/wirer
name = "Seegson model 'Ford' robotic autowirer"
From 82b1a3fe8dc0b34bcac31d8330ecba5be6219c76 Mon Sep 17 00:00:00 2001
From: ss13-beebot <56381746+ss13-beebot@users.noreply.github.com>
Date: Fri, 31 May 2024 11:14:33 -0500
Subject: [PATCH 6/8] Automatic changelog generation for PR #2645 [ci skip]
---
html/changelogs/AutoChangeLog-pr-2645.yml | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 html/changelogs/AutoChangeLog-pr-2645.yml
diff --git a/html/changelogs/AutoChangeLog-pr-2645.yml b/html/changelogs/AutoChangeLog-pr-2645.yml
new file mode 100644
index 00000000000..391c12cc370
--- /dev/null
+++ b/html/changelogs/AutoChangeLog-pr-2645.yml
@@ -0,0 +1,4 @@
+author: DeltaFire15
+delete-after: true
+changes:
+ - code_imp: Slightly improved some ui_acts of Fighters, APNP and APNW.
From c39b20adde8ac1c3568dd7ab007a397403152792 Mon Sep 17 00:00:00 2001
From: ss13-beebot <56381746+ss13-beebot@users.noreply.github.com>
Date: Fri, 31 May 2024 11:14:43 -0500
Subject: [PATCH 7/8] Automatic changelog generation for PR #2642 [ci skip]
---
html/changelogs/AutoChangeLog-pr-2642.yml | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 html/changelogs/AutoChangeLog-pr-2642.yml
diff --git a/html/changelogs/AutoChangeLog-pr-2642.yml b/html/changelogs/AutoChangeLog-pr-2642.yml
new file mode 100644
index 00000000000..deb3f571732
--- /dev/null
+++ b/html/changelogs/AutoChangeLog-pr-2642.yml
@@ -0,0 +1,9 @@
+author: Ikalpo
+delete-after: true
+changes:
+ - rscadd: Conveyor switch assemblies keep all their settings, which can be changed
+ using tools
+ - rscadd: Conveyor switch assemblies can get a link from a belt
+ - rscadd: Conveyor switches can be renamed
+ - bugfix: Slow conveyor belts no longer stack with normal ones
+ - imageadd: Slow belts are now yellow
From 569df41163a2d80ae069fdb5eb929c22d0cd9273 Mon Sep 17 00:00:00 2001
From: ss13-beebot <56381746+ss13-beebot@users.noreply.github.com>
Date: Fri, 31 May 2024 17:03:47 +0000
Subject: [PATCH 8/8] Automatic changelog compile [ci skip]
---
html/changelog.html | 20 ++++++++++++++++++++
html/changelogs/.all_changelog.yml | 14 ++++++++++++++
html/changelogs/AutoChangeLog-pr-2639.yml | 6 ------
html/changelogs/AutoChangeLog-pr-2642.yml | 9 ---------
html/changelogs/AutoChangeLog-pr-2645.yml | 4 ----
5 files changed, 34 insertions(+), 19 deletions(-)
delete mode 100644 html/changelogs/AutoChangeLog-pr-2639.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-2642.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-2645.yml
diff --git a/html/changelog.html b/html/changelog.html
index d76350b1d4a..1ae400eca5b 100644
--- a/html/changelog.html
+++ b/html/changelog.html
@@ -56,6 +56,26 @@
-->
+
31 May 2024
+
DeltaFire15 updated:
+
+ - Slightly improved some ui_acts of Fighters, APNP and APNW.
+
+
Ikalpo updated:
+
+ - Conveyor switch assemblies keep all their settings, which can be changed using tools
+ - Conveyor switch assemblies can get a link from a belt
+ - Conveyor switches can be renamed
+ - Slow conveyor belts no longer stack with normal ones
+ - Slow belts are now yellow
+
+
benbot16 updated:
+
+ - Ammo racks may now be loaded by attacking them with ammunition
+ - Jam SFX now plays on jam instead of on load attempt
+ - Fixes a few ammo rack-related edge cases
+
+
21 May 2024
Haliris, BriggsIDP, Powerfulbacon, TsunamiAnt, PestoVerde322 updated:
diff --git a/html/changelogs/.all_changelog.yml b/html/changelogs/.all_changelog.yml
index 885ab6854c2..8a9f3b84930 100644
--- a/html/changelogs/.all_changelog.yml
+++ b/html/changelogs/.all_changelog.yml
@@ -2027,3 +2027,17 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.
allow for easier subtypes implementation. Removed holographic flag preventing
the crafting menu from working.
- tweak: Genpop code and icons moved out of nsv13 folder
+2024-05-31:
+ DeltaFire15:
+ - code_imp: Slightly improved some ui_acts of Fighters, APNP and APNW.
+ Ikalpo:
+ - rscadd: Conveyor switch assemblies keep all their settings, which can be changed
+ using tools
+ - rscadd: Conveyor switch assemblies can get a link from a belt
+ - rscadd: Conveyor switches can be renamed
+ - bugfix: Slow conveyor belts no longer stack with normal ones
+ - imageadd: Slow belts are now yellow
+ benbot16:
+ - rscadd: Ammo racks may now be loaded by attacking them with ammunition
+ - tweak: Jam SFX now plays on jam instead of on load attempt
+ - bugfix: Fixes a few ammo rack-related edge cases
diff --git a/html/changelogs/AutoChangeLog-pr-2639.yml b/html/changelogs/AutoChangeLog-pr-2639.yml
deleted file mode 100644
index cf9b24452b0..00000000000
--- a/html/changelogs/AutoChangeLog-pr-2639.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-author: benbot16
-delete-after: true
-changes:
- - rscadd: Ammo racks may now be loaded by attacking them with ammunition
- - tweak: Jam SFX now plays on jam instead of on load attempt
- - bugfix: Fixes a few ammo rack-related edge cases
diff --git a/html/changelogs/AutoChangeLog-pr-2642.yml b/html/changelogs/AutoChangeLog-pr-2642.yml
deleted file mode 100644
index deb3f571732..00000000000
--- a/html/changelogs/AutoChangeLog-pr-2642.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-author: Ikalpo
-delete-after: true
-changes:
- - rscadd: Conveyor switch assemblies keep all their settings, which can be changed
- using tools
- - rscadd: Conveyor switch assemblies can get a link from a belt
- - rscadd: Conveyor switches can be renamed
- - bugfix: Slow conveyor belts no longer stack with normal ones
- - imageadd: Slow belts are now yellow
diff --git a/html/changelogs/AutoChangeLog-pr-2645.yml b/html/changelogs/AutoChangeLog-pr-2645.yml
deleted file mode 100644
index 391c12cc370..00000000000
--- a/html/changelogs/AutoChangeLog-pr-2645.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: DeltaFire15
-delete-after: true
-changes:
- - code_imp: Slightly improved some ui_acts of Fighters, APNP and APNW.