Merge branch 'master' into upstream-merge-37476
This commit is contained in:
@@ -2,14 +2,13 @@
|
||||
/obj/item/ammo_box
|
||||
name = "ammo box (null_reference_exception)"
|
||||
desc = "A box of ammo."
|
||||
icon_state = "357"
|
||||
icon = 'icons/obj/ammo.dmi'
|
||||
flags_1 = CONDUCT_1
|
||||
slot_flags = ITEM_SLOT_BELT
|
||||
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
|
||||
@@ -21,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)
|
||||
@@ -109,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)"
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
/obj/item/ammo_box/magazine/toy/smgm45
|
||||
name = "donksoft SMG magazine"
|
||||
icon_state = "c20r45-toy"
|
||||
caliber = "foam_force"
|
||||
ammo_type = /obj/item/ammo_casing/caseless/foam_dart
|
||||
max_ammo = 20
|
||||
@@ -39,10 +40,12 @@
|
||||
icon_state = "c20r45-[round(ammo_count(),2)]"
|
||||
|
||||
/obj/item/ammo_box/magazine/toy/smgm45/riot
|
||||
icon_state = "c20r45-riot"
|
||||
ammo_type = /obj/item/ammo_casing/caseless/foam_dart/riot
|
||||
|
||||
/obj/item/ammo_box/magazine/toy/m762
|
||||
name = "donksoft box magazine"
|
||||
icon_state = "a762-toy"
|
||||
caliber = "foam_force"
|
||||
ammo_type = /obj/item/ammo_casing/caseless/foam_dart
|
||||
max_ammo = 50
|
||||
@@ -52,4 +55,5 @@
|
||||
icon_state = "a762-[round(ammo_count(),10)]"
|
||||
|
||||
/obj/item/ammo_box/magazine/toy/m762/riot
|
||||
icon_state = "a762-riot"
|
||||
ammo_type = /obj/item/ammo_casing/caseless/foam_dart/riot
|
||||
|
||||
Reference in New Issue
Block a user