diff --git a/modular_skyrat/modules/armaments/code/armament_entries.dm b/modular_skyrat/modules/armaments/code/armament_entries.dm
index 0cc13a15115..5f2ebc54600 100644
--- a/modular_skyrat/modules/armaments/code/armament_entries.dm
+++ b/modular_skyrat/modules/armaments/code/armament_entries.dm
@@ -34,7 +34,7 @@ GLOBAL_LIST_INIT(armament_entries, build_armament_list())
// ditto for the description
spawned_armament_entry.description ||= initial(spawned_armament_entry.item_type.desc)
// Make our icon cache for the UI.
- spawned_armament_entry.create_icon_cache()
+ spawned_armament_entry.setup()
// Now that we've set up our datum, we can add it to the correct category
if(spawned_armament_entry.category)
if(spawned_armament_entry.subcategory)
@@ -94,9 +94,17 @@ GLOBAL_LIST_INIT(armament_entries, build_armament_list())
var/cached_base64
/// The maximum amount of this item that can be equipped.
var/max_purchase = 1
+ /// Do we have magazines for purchase?
+ var/magazine
+ /// If we have a magazine, how much is it?
+ var/magazine_cost = 1
-/datum/armament_entry/proc/create_icon_cache() // TODO: Make this use overlays.
+/datum/armament_entry/proc/setup() // TODO: Make this use overlays.
var/obj/item/test_item = new item_type()
+ if(istype(test_item, /obj/item/gun/ballistic))
+ var/obj/item/gun/ballistic/ballistic_test = test_item
+ if(!ballistic_test.internal_magazine)
+ magazine = ballistic_test.mag_type
cached_base64 = icon2base64(getFlatIcon(test_item, no_anim = TRUE))
qdel(test_item)
diff --git a/modular_skyrat/modules/armaments/code/armament_station.dm b/modular_skyrat/modules/armaments/code/armament_station.dm
index b359d59e448..5f5a9f9e358 100644
--- a/modular_skyrat/modules/armaments/code/armament_station.dm
+++ b/modular_skyrat/modules/armaments/code/armament_station.dm
@@ -68,6 +68,8 @@
"icon" = armament_entry.cached_base64,
"name" = armament_entry.name,
"cost" = armament_entry.cost,
+ "buyable_ammo" = armament_entry.magazine ? TRUE : FALSE,
+ "magazine_cost" = armament_entry.magazine_cost,
"quantity" = armament_entry.max_purchase,
"purchased" = purchased_items[armament_entry] ? purchased_items[armament_entry] : 0,
"description" = armament_entry.description,
@@ -98,22 +100,47 @@
switch(action)
if("equip_item")
- var/datum/armament_entry/armament_entry
- for(var/category in GLOB.armament_entries)
- for(var/subcategory in GLOB.armament_entries[category][CATEGORY_ENTRY])
- armament_entry = locate(params["armament_ref"]) in GLOB.armament_entries[category][CATEGORY_ENTRY][subcategory]
- if(armament_entry)
- break
- if(armament_entry)
- break
- if(!armament_entry)
+ var/check = check_item(params["armament_ref"])
+ if(!check)
return
- if(products && !(armament_entry.type in products))
+ select_armament(usr, check)
+ if("buy_ammo")
+ var/check = check_item(params["armament_ref"])
+ if(!check)
return
- select_armament(usr, armament_entry)
+ buy_ammo(usr, check, params["quantity"])
if("eject_card")
eject_card(usr)
+/obj/machinery/armament_station/proc/buy_ammo(mob/user, datum/armament_entry/armament_entry, quantity = 1)
+ if(!armament_entry.magazine)
+ return
+ if(!inserted_card)
+ to_chat(user, span_warning("No card inserted!"))
+ return
+ var/quantity_cost = armament_entry.magazine_cost * quantity
+ if(!inserted_card.use_points(quantity_cost))
+ to_chat(user, span_warning("Not enough points!"))
+ return
+ for(var/i in 1 to quantity)
+ new armament_entry.magazine(drop_location())
+
+
+/obj/machinery/armament_station/proc/check_item(reference)
+ var/datum/armament_entry/armament_entry
+ for(var/category in GLOB.armament_entries)
+ for(var/subcategory in GLOB.armament_entries[category][CATEGORY_ENTRY])
+ armament_entry = locate(reference) in GLOB.armament_entries[category][CATEGORY_ENTRY][subcategory]
+ if(armament_entry)
+ break
+ if(armament_entry)
+ break
+ if(!armament_entry)
+ return FALSE
+ if(products && !(armament_entry.type in products))
+ return FALSE
+ return armament_entry
+
/obj/machinery/armament_station/proc/eject_card(mob/user)
if(!inserted_card)
to_chat(user, span_warning("No card inserted!"))
diff --git a/modular_skyrat/modules/assault_operatives/code/shuttle.dm b/modular_skyrat/modules/assault_operatives/code/shuttle.dm
index bf3cc8321a6..8d96d45340a 100644
--- a/modular_skyrat/modules/assault_operatives/code/shuttle.dm
+++ b/modular_skyrat/modules/assault_operatives/code/shuttle.dm
@@ -32,7 +32,7 @@
shuttleId = "goldeneye_cruiser"
jump_to_ports = list("syndicate_n" = 1, "whiteship_away" = 1, "whiteship_home" = 1, "whiteship_z4" = 1)
view_range = 14
- whitelist_turfs = list(/turf/open/space, /turf/open/floor/plating, /turf/open/lava, /turf/closed/mineral)
+ whitelist_turfs = list(/turf/open/space, /turf/open/floor/plating, /turf/open/lava, /turf/closed/mineral, /turf/open/misc/ice/icemoon, /turf/open/misc/ice)
see_hidden = TRUE
x_offset = -10
y_offset = 5
diff --git a/tgui/packages/tgui/interfaces/ArmamentStation.js b/tgui/packages/tgui/interfaces/ArmamentStation.js
index 5fc7caf0dd1..1bae796eafa 100644
--- a/tgui/packages/tgui/interfaces/ArmamentStation.js
+++ b/tgui/packages/tgui/interfaces/ArmamentStation.js
@@ -134,6 +134,12 @@ export const ArmamentStation = (props, context) => {
textColor={(item.cost > card_points || !card_inserted) ? "red" : "green"}>
{'Cost: ' + item.cost}
+ {!!item.buyable_ammo && (
+ card_points || !card_inserted) ? "red" : "green"}>
+ {'Ammo Cost: ' + item.magazine_cost}
+
+ )}
+ {!!item.buyable_ammo && (
+
+
+ )}
)
))