[READY] Stacks will change item_states and w_class based on how full they are. (#1370)

This commit is contained in:
CitadelStationBot
2017-06-04 11:08:33 -05:00
committed by kevinz000
parent 4ac745a275
commit b5d2cf3c99
11 changed files with 56 additions and 2 deletions
@@ -60,6 +60,7 @@
origin_tech = "bluespace=6;materials=3"
materials = list(MAT_BLUESPACE=MINERAL_MATERIAL_AMOUNT)
attack_verb = list("bluespace polybashed", "bluespace polybattered", "bluespace polybludgeoned", "bluespace polythrashed", "bluespace polysmashed")
novariants = TRUE
var/crystal_type = /obj/item/weapon/ore/bluespace_crystal/refined
/obj/item/stack/sheet/bluespace_crystal/attack_self(mob/user)// to prevent the construction menu from ever happening
@@ -5,11 +5,13 @@
amount = 6
max_amount = 6
w_class = WEIGHT_CLASS_TINY
full_w_class = WEIGHT_CLASS_TINY
throw_speed = 3
throw_range = 7
resistance_flags = FLAMMABLE
obj_integrity = 40
max_integrity = 40
novariants = FALSE
var/heal_brute = 0
var/heal_burn = 0
var/stop_bleeding = 0
+1
View File
@@ -20,6 +20,7 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
max_amount = 50
attack_verb = list("hit", "bludgeoned", "whacked")
hitsound = 'sound/weapons/grenadelaunch.ogg'
novariants = TRUE
/obj/item/stack/rods/Initialize(mapload, new_amount, merge = TRUE)
..()
@@ -2,12 +2,14 @@
name = "hide"
desc = "Something went wrong."
origin_tech = "biotech=3"
novariants = TRUE
/obj/item/stack/sheet/animalhide/human
name = "human skin"
desc = "The by-product of human farming."
singular_name = "human skin piece"
icon_state = "sheet-hide"
novariants = FALSE
GLOBAL_LIST_INIT(human_recipes, list( \
new/datum/stack_recipe("bloated human costume", /obj/item/clothing/suit/hooded/bloated_human, 5, on_floor = 1), \
@@ -22,6 +24,7 @@ GLOBAL_LIST_INIT(human_recipes, list( \
desc = "A piece of skin."
singular_name = "skin piece"
icon_state = "sheet-hide"
novariants = FALSE
/obj/item/stack/sheet/animalhide/corgi
name = "corgi hide"
@@ -87,6 +90,7 @@ GLOBAL_LIST_INIT(xeno_recipes, list ( \
icon = 'icons/mob/alien.dmi'
icon_state = "chitin"
origin_tech = null
novariants = TRUE
/obj/item/xenos_claw
name = "alien claw"
@@ -153,6 +157,7 @@ GLOBAL_LIST_INIT(leather_recipes, list ( \
singular_name = "watcher sinew"
icon_state = "sinew"
origin_tech = "biotech=4"
novariants = TRUE
GLOBAL_LIST_INIT(sinew_recipes, list ( \
@@ -166,23 +171,27 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( \
/*
* Plates
*/
/obj/item/stack/sheet/animalhide/goliath_hide
name = "goliath hide plates"
desc = "Pieces of a goliath's rocky hide, these might be able to make your suit a bit more durable to attack from the local fauna."
icon = 'icons/obj/mining.dmi'
icon_state = "goliath_hide"
singular_name = "hide plate"
max_amount = 6
novariants = FALSE
flags = NOBLUDGEON
w_class = WEIGHT_CLASS_NORMAL
layer = MOB_LAYER
/obj/item/stack/sheet/animalhide/ashdrake
name = "ash drake hide"
desc = "The strong, scaled hide of an ash drake."
icon = 'icons/obj/mining.dmi'
icon_state = "dragon_hide"
singular_name = "drake plate"
max_amount = 10
novariants = FALSE
flags = NOBLUDGEON
w_class = WEIGHT_CLASS_NORMAL
layer = MOB_LAYER
@@ -68,6 +68,7 @@ GLOBAL_LIST_INIT(sandstone_recipes, list ( \
singular_name = "sandbag"
layer = LOW_ITEM_LAYER
origin_tech = "materials=2"
novariants = TRUE
GLOBAL_LIST_INIT(sandbag_recipes, list ( \
new/datum/stack_recipe("sandbags", /obj/structure/barricade/sandbags, 1, time = 25, one_per_turf = 1, on_floor = 1), \
@@ -104,6 +105,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \
origin_tech = "materials=6"
sheettype = "diamond"
materials = list(MAT_DIAMOND=MINERAL_MATERIAL_AMOUNT)
novariants = TRUE
GLOBAL_LIST_INIT(diamond_recipes, list ( \
new/datum/stack_recipe("diamond door", /obj/structure/mineral_door/transparent/diamond, 10, one_per_turf = 1, on_floor = 1), \
@@ -127,6 +129,7 @@ GLOBAL_LIST_INIT(diamond_recipes, list ( \
origin_tech = "materials=5"
sheettype = "uranium"
materials = list(MAT_URANIUM=MINERAL_MATERIAL_AMOUNT)
novariants = TRUE
GLOBAL_LIST_INIT(uranium_recipes, list ( \
new/datum/stack_recipe("uranium door", /obj/structure/mineral_door/uranium, 10, one_per_turf = 1, on_floor = 1), \
@@ -237,6 +240,7 @@ GLOBAL_LIST_INIT(silver_recipes, list ( \
origin_tech = "materials=4"
sheettype = "clown"
materials = list(MAT_BANANIUM=MINERAL_MATERIAL_AMOUNT)
novariants = TRUE
GLOBAL_LIST_INIT(clown_recipes, list ( \
new/datum/stack_recipe("bananium tile", /obj/item/stack/tile/mineral/bananium, 1, 4, 20), \
@@ -355,6 +359,7 @@ GLOBAL_LIST_INIT(adamantine_recipes, list(
icon_state = "sheet-mythril"
singular_name = "mythril sheet"
origin_tech = "materials=4"
novariants = TRUE
/*
* Alien Alloy
@@ -162,6 +162,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 0)
resistance_flags = FLAMMABLE
merge_type = /obj/item/stack/sheet/mineral/wood
novariants = TRUE
/obj/item/stack/sheet/mineral/wood/Initialize(mapload, new_amount, merge = TRUE)
recipes = GLOB.wood_recipes
@@ -239,6 +240,7 @@ GLOBAL_LIST_INIT(cardboard_recipes, list ( \
origin_tech = "materials=1"
resistance_flags = FLAMMABLE
merge_type = /obj/item/stack/sheet/cardboard
novariants = TRUE
/obj/item/stack/sheet/cardboard/Initialize(mapload, new_amount, merge = TRUE)
recipes = GLOB.cardboard_recipes
@@ -268,6 +270,7 @@ GLOBAL_LIST_INIT(runed_metal_recipes, list ( \
icon = 'icons/obj/items.dmi'
sheettype = "runed"
merge_type = /obj/item/stack/sheet/runed_metal
novariants = TRUE
/obj/item/stack/sheet/runed_metal/ratvar_act()
new /obj/item/stack/tile/brass(loc, amount)
@@ -322,6 +325,7 @@ GLOBAL_LIST_INIT(brass_recipes, list ( \
throw_speed = 1
throw_range = 3
turf_type = /turf/open/floor/clockwork
novariants = FALSE
/obj/item/stack/tile/brass/narsie_act()
new /obj/item/stack/sheet/runed_metal(loc, amount)
@@ -339,6 +343,7 @@ GLOBAL_LIST_INIT(brass_recipes, list ( \
singular_name = "lesser gem"
icon_state = "sheet-lessergem"
origin_tech = "materials=4"
novariants = TRUE
/obj/item/stack/sheet/greatergem
@@ -347,6 +352,7 @@ GLOBAL_LIST_INIT(brass_recipes, list ( \
singular_name = "greater gem"
icon_state = "sheet-greatergem"
origin_tech = "materials=7"
novariants = TRUE
/*
* Bones
@@ -359,6 +365,7 @@ GLOBAL_LIST_INIT(brass_recipes, list ( \
desc = "Someone's been drinking their milk."
force = 7
throwforce = 5
max_amount = 12
w_class = WEIGHT_CLASS_NORMAL
throw_speed = 1
throw_range = 3
@@ -1,11 +1,12 @@
/obj/item/stack/sheet
name = "sheet"
w_class = WEIGHT_CLASS_NORMAL
full_w_class = WEIGHT_CLASS_NORMAL
force = 5
throwforce = 5
max_amount = 50
throw_speed = 1
throw_range = 3
attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed")
novariants = FALSE
var/perunit = MINERAL_MATERIAL_AMOUNT
var/sheettype = null //this is used for girders in the creation of walls/false walls
+26
View File
@@ -18,6 +18,8 @@
var/datum/robot_energy_storage/source
var/cost = 1 // How much energy from storage it costs
var/merge_type = null // This path and its children should merge with this stack, defaults to src.type
var/full_w_class = WEIGHT_CLASS_NORMAL //The weight class the stack should have at amount > 2/3rds max_amount
var/novariants = TRUE //Determines whether the item should update it's sprites based on amount.
/obj/item/stack/Initialize(mapload, new_amount=null , merge = TRUE)
..()
@@ -29,6 +31,28 @@
for(var/obj/item/stack/S in loc)
if(S.merge_type == merge_type)
merge(S)
update_weight()
update_icon()
/obj/item/stack/proc/update_weight()
if(amount <= (max_amount * (1/3)))
w_class = Clamp(full_w_class-2, WEIGHT_CLASS_TINY, full_w_class)
else if (amount <= (max_amount * (2/3)))
w_class = Clamp(full_w_class-1, WEIGHT_CLASS_TINY, full_w_class)
else
w_class = full_w_class
/obj/item/stack/update_icon()
if(novariants)
return ..()
if(amount <= (max_amount * (1/3)))
icon_state = initial(icon_state)
else if (amount <= (max_amount * (2/3)))
icon_state = "[initial(icon_state)]_2"
else
icon_state = "[initial(icon_state)]_3"
..()
/obj/item/stack/Destroy()
if (usr && usr.machine==src)
@@ -188,6 +212,7 @@
amount -= used
zero_amount()
update_icon()
update_weight()
return 1
/obj/item/stack/proc/zero_amount()
@@ -204,6 +229,7 @@
else
src.amount += amount
update_icon()
update_weight()
/obj/item/stack/proc/merge(obj/item/stack/S) //Merge src into S, as much as possible
if(QDELETED(S) || QDELETED(src) || S == src) //amusingly this can cause a stack to consume itself, let's not allow that.
@@ -12,6 +12,7 @@
origin_tech = "materials=1"
var/turf_type = null
var/mineralType = null
novariants = TRUE
/obj/item/stack/tile/Initialize(mapload, amount)
. = ..()
@@ -22,6 +22,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list(
icon_state = "marker"
merge_type = /obj/item/stack/marker_beacon
max_amount = 100
novariants = TRUE
var/picked_color = "random"
/obj/item/stack/marker_beacon/ten //miners start with 10 of these
Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 65 KiB