Merge pull request #6635 from Citadel-Station-13/upstream-merge-37626

[MIRROR] You can no longer print infinite ammunition.
This commit is contained in:
LetterJay
2018-05-04 22:54:00 -05:00
committed by GitHub
5 changed files with 19 additions and 2 deletions
@@ -7,6 +7,7 @@
slot_flags = SLOT_BELT
throwforce = 0
w_class = WEIGHT_CLASS_TINY
materials = list(MAT_METAL = 500)
var/fire_sound = null //What sound should play when this ammo is fired
var/caliber = null //Which kind of guns it can be loaded into
var/projectile_type = null //The bullet type to create when New() is called
@@ -61,3 +61,4 @@
desc = "Whose smart idea was it to use toys as crowd control? Ages 18 and up."
projectile_type = /obj/item/projectile/bullet/reusable/foam_dart/riot
icon_state = "foamdart_riot"
materials = list(MAT_METAL = 1000)
@@ -8,7 +8,7 @@
item_state = "syringe_kit"
lefthand_file = 'icons/mob/inhands/equipment/medical_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
materials = list(MAT_METAL=30000)
materials = list(MAT_METAL = 30000)
throwforce = 2
w_class = WEIGHT_CLASS_TINY
throw_speed = 3
@@ -20,9 +20,19 @@
var/caliber
var/multiload = 1
var/start_empty = 0
var/list/bullet_cost
var/list/base_cost// override this one as well if you override bullet_cost
/obj/item/ammo_box/Initialize()
. = ..()
if (!bullet_cost)
for (var/material in materials)
var/material_amount = materials[material]
LAZYSET(base_cost, material, (material_amount * 0.10))
material_amount *= 0.90 // 10% for the container
material_amount /= max_ammo
LAZYSET(bullet_cost, material, material_amount)
if(!start_empty)
for(var/i = 1, i <= max_ammo, i++)
stored_ammo += new ammo_type(src)
@@ -108,6 +118,10 @@
if(2)
icon_state = "[initial(icon_state)]-[stored_ammo.len ? "[max_ammo]" : "0"]"
desc = "[initial(desc)] There are [stored_ammo.len] shell\s left!"
for (var/material in bullet_cost)
var/material_amount = bullet_cost[material]
material_amount = (material_amount*stored_ammo.len) + base_cost[material]
materials[material] = material_amount
//Behavior for magazines
/obj/item/ammo_box/magazine/proc/ammo_count()
@@ -13,6 +13,7 @@
ammo_type = /obj/item/ammo_casing/c38
max_ammo = 6
multiple_sprites = 1
materials = list(MAT_METAL = 20000)
/obj/item/ammo_box/c9mm
name = "ammo box (9mm)"
@@ -451,7 +451,7 @@
name = "Speed Loader (.38)"
id = "c38"
build_type = AUTOLATHE
materials = list(MAT_METAL = 30000)
materials = list(MAT_METAL = 20000)
build_path = /obj/item/ammo_box/c38
category = list("initial", "Security")