Adds differing stack sprites

Ports most of /tg/'s sprites for stacks displaying their contents.  I added some of my own as well to fill in materials that we have but they didn't.
Moves all stack icons to their own dmi.
Reworks fifty_spawners to use paths instead of strings, as it prevents bugs in the long term.
This commit is contained in:
Neerti
2017-09-28 01:04:19 -04:00
parent f32efabffc
commit 2f173dd16b
13 changed files with 118 additions and 46 deletions
@@ -4,16 +4,18 @@
desc = "This item spawns stack of 50 of a given material."
icon = 'icons/misc/mark.dmi'
icon_state = "x4"
var/material = ""
// var/material = ""
var/obj/item/stack/type_to_spawn = null
/obj/fiftyspawner/New()
//spawns the 50-stack and qdels self
..()
var/obj_path = text2path("/obj/item/stack/[material]")
var/obj/item/stack/M = new obj_path(src.loc)
// var/obj_path = text2path("/obj/item/stack/[material]")
var/obj/item/stack/M = new type_to_spawn(src.loc)
M.amount = M.max_amount //some stuff spawns with 60, we're still calling it fifty
M.update_icon() // Some stacks have different sprites depending on how full they are.
qdel(src)
/obj/fiftyspawner/rods
name = "stack of rods" //this needs to be defined for cargo
material = "rods"
type_to_spawn = /obj/item/stack/rods
+3 -1
View File
@@ -1,7 +1,7 @@
/obj/item/stack/medical
name = "medical pack"
singular_name = "medical pack"
icon = 'icons/obj/items.dmi'
icon = 'icons/obj/stacks.dmi'
amount = 10
max_amount = 10
w_class = ITEMSIZE_SMALL
@@ -64,6 +64,7 @@
desc = "Some sterile gauze to wrap around bloody stumps."
icon_state = "brutepack"
origin_tech = list(TECH_BIO = 1)
no_variants = FALSE
/obj/item/stack/medical/bruise_pack/attack(mob/living/carbon/M as mob, mob/user as mob)
if(..())
@@ -123,6 +124,7 @@
icon_state = "ointment"
heal_burn = 1
origin_tech = list(TECH_BIO = 1)
no_variants = FALSE
/obj/item/stack/medical/ointment/attack(mob/living/carbon/M as mob, mob/user as mob)
if(..())
+3 -2
View File
@@ -2,11 +2,12 @@
name = "nanopaste"
singular_name = "nanite swarm"
desc = "A tube of paste containing swarms of repair nanites. Very effective in repairing robotic machinery."
icon = 'icons/obj/nanopaste.dmi'
icon_state = "tube"
icon = 'icons/obj/stacks.dmi'
icon_state = "nanopaste"
origin_tech = list(TECH_MATERIAL = 4, TECH_ENGINEERING = 3)
amount = 10
w_class = ITEMSIZE_SMALL
no_variants = FALSE
/obj/item/stack/nanopaste/attack(mob/living/M as mob, mob/user as mob)
if (!istype(M) || !istype(user))
+9
View File
@@ -21,10 +21,19 @@
uses_charge = 1
charge_costs = list(500)
stacktype = /obj/item/stack/rods
no_variants = TRUE
/obj/item/stack/rods/New()
..()
recipes = rods_recipes
update_icon()
/obj/item/stack/rods/update_icon()
var/amount = get_amount()
if((amount <= 5) && (amount > 0))
icon_state = "rods-[amount]"
else
icon_state = "rods"
var/global/list/datum/stack_recipe/rods_recipes = list( \
new/datum/stack_recipe("grille", /obj/structure/grille, 2, time = 10, one_per_turf = 1, on_floor = 1),
@@ -3,6 +3,7 @@
desc = "The by-product of human farming."
singular_name = "human skin piece"
icon_state = "sheet-hide"
no_variants = FALSE
/obj/item/stack/material/animalhide/human
amount = 50
@@ -80,6 +81,7 @@
desc = "This hide was stripped of it's hair, but still needs tanning."
singular_name = "hairless hide piece"
icon_state = "sheet-hairlesshide"
no_variants = FALSE
/obj/item/stack/material/hairlesshide
amount = 50
@@ -91,6 +93,7 @@
icon_state = "sheet-wetleather"
var/wetness = 30 //Reduced when exposed to high temperautres
var/drying_threshold_temperature = 500 //Kelvin to start drying
no_variants = FALSE
/obj/item/stack/material/wetleather
amount = 50
+18 -1
View File
@@ -12,6 +12,7 @@
/obj/item/stack
gender = PLURAL
origin_tech = list(TECH_MATERIAL = 1)
icon = 'icons/obj/stacks.dmi'
var/list/datum/stack_recipe/recipes
var/singular_name
var/amount = 1
@@ -21,6 +22,7 @@
var/uses_charge = 0
var/list/charge_costs = null
var/list/datum/matter_synth/synths = null
var/no_variants = TRUE // Determines whether the item should update it's sprites based on amount.
/obj/item/stack/New(var/loc, var/amount=null)
..()
@@ -28,6 +30,7 @@
stacktype = type
if (amount)
src.amount = amount
update_icon()
return
/obj/item/stack/Destroy()
@@ -37,6 +40,18 @@
usr << browse(null, "window=stack")
return ..()
/obj/item/stack/update_icon()
if(no_variants)
icon_state = initial(icon_state)
else
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"
item_state = initial(icon_state)
/obj/item/stack/examine(mob/user)
if(..(user, 1))
if(!uses_charge)
@@ -189,6 +204,7 @@
if(usr)
usr.remove_from_mob(src)
qdel(src) //should be safe to qdel immediately since if someone is still using this stack it will persist for a little while longer
update_icon()
return 1
else
if(get_amount() < used)
@@ -205,6 +221,7 @@
return 0
else
amount += extra
update_icon()
return 1
else if(!synths || synths.len < uses_charge)
return 0
@@ -298,7 +315,7 @@
/obj/item/stack/attack_hand(mob/user as mob)
if (user.get_inactive_hand() == src)
var/N = input("How many stacks of [src] would you like to split off?", "Split stacks", 1) as num|null
var/N = input("How many stacks of [src] would you like to split off? There are currently [amount].", "Split stacks", 1) as num|null
if(N)
var/obj/item/stack/F = src.split(N)
if (F)
@@ -2,48 +2,48 @@
/obj/fiftyspawner/grass
name = "stack of grass"
material = "tile/grass"
type_to_spawn = /obj/item/stack/tile/grass
/obj/fiftyspawner/wood
name = "stack of wood"
material = "tile/wood"
type_to_spawn = /obj/item/stack/tile/wood
/obj/fiftyspawner/carpet
name = "stack of carpet"
material = "tile/carpet"
type_to_spawn = /obj/item/stack/tile/carpet
/obj/fiftyspawner/bluecarpet
name = "stack of blue carpet"
material = "tile/carpet/blue"
type_to_spawn = /obj/item/stack/tile/carpet/blue
/obj/fiftyspawner/floor
name = "stack of floor tiles"
material = "tile/floor"
type_to_spawn = /obj/item/stack/tile/floor
/obj/fiftyspawner/floor_red
name = "stack of red floor tiles"
material = "tile/floor_red"
type_to_spawn = /obj/item/stack/tile/floor/red
/obj/fiftyspawner/floor_steel
name = "stack of steel floor tiles"
material = "tile/floor_steel"
type_to_spawn = /obj/item/stack/tile/floor/steel
/obj/fiftyspawner/floor_white
name = "stack of white floor tiles"
material = "tile/floor_white"
type_to_spawn = /obj/item/stack/tile/floor/white
/obj/fiftyspawner/floor_yellow
name = "stack of yellow floor tiles"
material = "tile/floor_yellow"
type_to_spawn = /obj/item/stack/tile/floor/yellow
/obj/fiftyspawner/floor_dark
name = "stack of dark floor tiles"
material = "tile/floor_dark"
type_to_spawn = /obj/item/stack/tile/floor/dark
/obj/fiftyspawner/floor_freezer
name = "stack of freezer tiles"
material = "tile/floor_freezer"
type_to_spawn = /obj/item/stack/tile/floor/freezer
/obj/fiftyspawner/linoleum
name = "stack of linoleum tiles"
material = "tile/linoleum"
type_to_spawn = /obj/item/stack/tile/linoleum
@@ -36,6 +36,7 @@
throw_range = 20
flags = 0
origin_tech = list(TECH_BIO = 1)
no_variants = FALSE
/obj/item/stack/tile/grass/fifty
amount = 50
@@ -52,6 +53,7 @@
throw_speed = 5
throw_range = 20
flags = 0
no_variants = FALSE
/obj/item/stack/tile/wood/fifty
amount = 50
@@ -77,12 +79,14 @@
throw_speed = 5
throw_range = 20
flags = 0
no_variants = FALSE
/obj/item/stack/tile/carpet/blue
name = "blue carpet"
singular_name = "blue carpet"
desc = "A piece of blue carpet. It is the same size as a normal floor tile!"
icon_state = "tile-bluecarpet"
no_variants = FALSE
// TODO - Add descriptions to these
/obj/item/stack/tile/carpet/bcarpet
@@ -111,29 +115,34 @@
throw_speed = 5
throw_range = 20
flags = CONDUCT
no_variants = FALSE
/obj/item/stack/tile/floor/red
name = "red floor tile"
singular_name = "red floor tile"
color = COLOR_RED_GRAY
icon_state = "tile_white"
no_variants = FALSE
// VOREStation Edit
/obj/item/stack/tile/floor/techgrey
name = "grey techfloor tile"
singular_name = "grey techfloor tile"
icon_state = "techtile_grey"
no_variants = FALSE
/obj/item/stack/tile/floor/techgrid
name = "grid techfloor tile"
singular_name = "grid techfloor tile"
icon_state = "techtile_grid"
no_variants = FALSE
/obj/item/stack/tile/floor/steel_dirty
name = "steel floor tile"
singular_name = "steel floor tile"
icon_state = "tile_steel"
matter = list("plasteel" = SHEET_MATERIAL_AMOUNT / 4)
no_variants = FALSE
// VOREStation Edit End
/obj/item/stack/tile/floor/steel
@@ -141,30 +150,35 @@
singular_name = "steel floor tile"
icon_state = "tile_steel"
matter = list("plasteel" = SHEET_MATERIAL_AMOUNT / 4)
no_variants = FALSE
/obj/item/stack/tile/floor/white
name = "white floor tile"
singular_name = "white floor tile"
icon_state = "tile_white"
matter = list("plastic" = SHEET_MATERIAL_AMOUNT / 4)
no_variants = FALSE
/obj/item/stack/tile/floor/yellow
name = "yellow floor tile"
singular_name = "yellow floor tile"
color = COLOR_BROWN
icon_state = "tile_white"
no_variants = FALSE
/obj/item/stack/tile/floor/dark
name = "dark floor tile"
singular_name = "dark floor tile"
icon_state = "fr_tile"
icon_state = "tile_steel"
matter = list("plasteel" = SHEET_MATERIAL_AMOUNT / 4)
no_variants = FALSE
/obj/item/stack/tile/floor/freezer
name = "freezer floor tile"
singular_name = "freezer floor tile"
icon_state = "tile_freezer"
matter = list("plastic" = SHEET_MATERIAL_AMOUNT / 4)
no_variants = FALSE
/obj/item/stack/tile/floor/cyborg
name = "floor tile synthesizer"
@@ -186,3 +200,4 @@
throw_speed = 5
throw_range = 20
flags = 0
no_variants = FALSE