All-In-One grinder results are now defined by type, not by huge lists

This commit is contained in:
Ashe Higgs
2017-12-14 16:48:25 -05:00
committed by CitadelStationBot
parent a22b225015
commit 2aef00daf0
48 changed files with 356 additions and 235 deletions
+15
View File
@@ -117,7 +117,13 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
var/trigger_guard = TRIGGER_GUARD_NONE
<<<<<<< HEAD
var/icon_override = null
=======
//Grinder vars
var/list/grind_results //A reagent list containing the reagents this item produces when ground up in a grinder - this can be an empty list to allow for reagent transferring only
var/list/juice_results //A reagent list containing blah blah... but when JUICED in a grinder!
>>>>>>> d447acd... All-In-One grinder results are now defined by type, not by huge lists (#33181)
/obj/item/Initialize()
if (!materials)
@@ -678,6 +684,15 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
/obj/item/proc/on_mob_death(mob/living/L, gibbed)
/obj/item/proc/grind_requirements(obj/machinery/reagentgrinder/R) //Used to check for extra requirements for grinding an object
return TRUE
//Called BEFORE the object is ground up - use this to change grind results based on conditions
//Use "return -1" to prevent the grinding from occurring
/obj/item/proc/on_grind()
/obj/item/proc/on_juice()
/obj/item/proc/set_force_string()
switch(force)
if(0 to 4)
+2 -1
View File
@@ -120,4 +120,5 @@
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
flags_1 = CONDUCT_1
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=50, MAT_GLASS=50)
materials = list(MAT_METAL=50, MAT_GLASS=50)
grind_results = list("iron" = 10, "silicon" = 10)
+4
View File
@@ -25,6 +25,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/smoketime = 5
w_class = WEIGHT_CLASS_TINY
heat = 1000
grind_results = list("phosphorus" = 2)
/obj/item/match/process()
smoketime--
@@ -104,6 +105,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
container_type = INJECTABLE_1
w_class = WEIGHT_CLASS_TINY
body_parts_covered = null
grind_results = list()
var/lit = FALSE
var/starts_lit = FALSE
var/icon_on = "cigon" //Note - these are in masks.dmi not in cigarette.dmi
@@ -363,6 +365,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
icon_state = "cigbutt"
w_class = WEIGHT_CLASS_TINY
throwforce = 0
grind_results = list("carbon" = 2)
/obj/item/cigbutt/cigarbutt
name = "cigar butt"
@@ -484,6 +487,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
heat = 1500
resistance_flags = FIRE_PROOF
light_color = LIGHT_COLOR_FIRE
grind_results = list("iron" = 1, "welding_fuel" = 5, "oil" = 5)
/obj/item/lighter/update_icon()
if(lit)
@@ -12,6 +12,7 @@
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
materials = list(MAT_GLASS=1000)
w_class = WEIGHT_CLASS_SMALL
grind_results = list("silicon" = 20, "sacid" = 0.5) //Retrieving acid this way is extremely inefficient
var/build_path = null
/obj/item/circuitboard/proc/apply_default_parts(obj/machinery/M)
+1
View File
@@ -21,6 +21,7 @@
throwforce = 0
throw_speed = 3
throw_range = 7
grind_results = list("lye" = 10)
var/cleanspeed = 50 //slower than mop
force_string = "robust... against germs"
+1
View File
@@ -26,6 +26,7 @@
item_color = "red"
w_class = WEIGHT_CLASS_TINY
attack_verb = list("attacked", "coloured")
grind_results = list()
var/paint_color = "#FF0000" //RGB
var/drawtype
@@ -256,6 +256,7 @@
var/produce_heat = 1500
heat = 1000
light_color = LIGHT_COLOR_FLARE
grind_results = list("sulfur" = 15)
/obj/item/device/flashlight/flare/New()
fuel = rand(800, 1000) // Sorry for changing this so much but I keep under-estimating how long X number of ticks last in seconds.
@@ -404,6 +405,7 @@
color = LIGHT_COLOR_GREEN
icon_state = "glowstick"
item_state = "glowstick"
grind_results = list("phenol" = 15, "hydrogen" = 10, "oxygen" = 5) //Meth-in-a-stick
var/fuel = 0
/obj/item/device/flashlight/glowstick/Initialize()
@@ -335,6 +335,7 @@ GAS ANALYZER
throw_speed = 3
throw_range = 7
materials = list(MAT_METAL=30, MAT_GLASS=20)
grind_results = list("mercury" = 5, "iron" = 5, "silicon" = 5)
/obj/item/device/analyzer/attack_self(mob/user)
@@ -9,6 +9,7 @@
points = 50
var/blink_range = 8 // The teleport range when crushed/thrown at someone.
refined_type = /obj/item/stack/sheet/bluespace_crystal
grind_results = list("bluespace" = 2)
/obj/item/ore/bluespace_crystal/refined
name = "refined bluespace crystal"
@@ -48,6 +49,7 @@
blink_range = 4 // Not as good as the organic stuff!
points = 0 //nice try
refined_type = null
grind_results = list("bluespace" = 1, "silicon" = 2)
//Polycrystals, aka stacks
/obj/item/stack/sheet/bluespace_crystal
@@ -58,6 +60,7 @@
materials = list(MAT_BLUESPACE=MINERAL_MATERIAL_AMOUNT)
attack_verb = list("bluespace polybashed", "bluespace polybattered", "bluespace polybludgeoned", "bluespace polythrashed", "bluespace polysmashed")
novariants = TRUE
grind_results = list("bluespace" = 2)
var/crystal_type = /obj/item/ore/bluespace_crystal/refined
/obj/item/stack/sheet/bluespace_crystal/attack_self(mob/user)// to prevent the construction menu from ever happening
@@ -111,6 +111,7 @@
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
heal_brute = 40
self_delay = 20
grind_results = list("styptic_powder" = 1)
/obj/item/stack/medical/bruise_pack/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is bludgeoning [user.p_them()]self with [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
@@ -147,3 +148,4 @@
righthand_file = 'icons/mob/inhands/equipment/medical_righthand.dmi'
heal_burn = 40
self_delay = 20
grind_results = list("silver_sulfadiazine" = 1)
@@ -22,6 +22,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 100)
resistance_flags = ACID_PROOF
merge_type = /obj/item/stack/sheet/glass
grind_results = list("silicon" = 1)
/obj/item/stack/sheet/glass/cyborg
materials = list()
@@ -79,6 +80,7 @@ GLOBAL_LIST_INIT(pglass_recipes, list ( \
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 75, "acid" = 100)
resistance_flags = ACID_PROOF
merge_type = /obj/item/stack/sheet/plasmaglass
grind_results = list("silicon" = 1, "plasma" = 1)
/obj/item/stack/sheet/plasmaglass/fifty
amount = 50
@@ -128,6 +130,7 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 70, acid = 100)
resistance_flags = ACID_PROOF
merge_type = /obj/item/stack/sheet/rglass
grind_results = list("silicon" = 1, "iron" = 1)
/obj/item/stack/sheet/rglass/attackby(obj/item/W, mob/user, params)
add_fingerprint(user)
@@ -168,6 +171,7 @@ GLOBAL_LIST_INIT(prglass_recipes, list ( \
armor = list("melee" = 20, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 100)
resistance_flags = ACID_PROOF
merge_type = /obj/item/stack/sheet/plasmarglass
grind_results = list("silicon" = 1, "plasma" = 1, "iron" = 1)
/obj/item/stack/sheet/plasmarglass/Initialize(mapload, new_amount, merge = TRUE)
recipes = GLOB.prglass_recipes
@@ -10,10 +10,18 @@
throw_speed = 3
throw_range = 7
flags_1 = CONDUCT_1
<<<<<<< HEAD
max_amount = 60
/obj/item/stack/light_w/attackby(obj/item/O, mob/user, params)
=======
max_amount = 60
grind_results = list("silicon" = 1, "copper" = 1)
/obj/item/stack/light_w/attackby(obj/item/O, mob/user, params)
>>>>>>> d447acd... All-In-One grinder results are now defined by type, not by huge lists (#33181)
if(istype(O, /obj/item/wirecutters))
var/obj/item/stack/cable_coil/CC = new (user.loc)
CC.amount = 5
@@ -126,6 +126,7 @@ GLOBAL_LIST_INIT(diamond_recipes, list ( \
sheettype = "uranium"
materials = list(MAT_URANIUM=MINERAL_MATERIAL_AMOUNT)
novariants = TRUE
grind_results = list("uranium" = 20)
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), \
@@ -149,6 +150,7 @@ GLOBAL_LIST_INIT(uranium_recipes, list ( \
resistance_flags = FLAMMABLE
max_integrity = 100
materials = list(MAT_PLASMA=MINERAL_MATERIAL_AMOUNT)
grind_results = list("plasma" = 20)
GLOBAL_LIST_INIT(plasma_recipes, list ( \
new/datum/stack_recipe("plasma door", /obj/structure/mineral_door/transparent/plasma, 10, one_per_turf = 1, on_floor = 1), \
@@ -182,6 +184,7 @@ GLOBAL_LIST_INIT(plasma_recipes, list ( \
singular_name = "gold bar"
sheettype = "gold"
materials = list(MAT_GOLD=MINERAL_MATERIAL_AMOUNT)
grind_results = list("gold" = 20)
GLOBAL_LIST_INIT(gold_recipes, list ( \
new/datum/stack_recipe("golden door", /obj/structure/mineral_door/gold, 10, one_per_turf = 1, on_floor = 1), \
@@ -207,6 +210,7 @@ GLOBAL_LIST_INIT(gold_recipes, list ( \
singular_name = "silver bar"
sheettype = "silver"
materials = list(MAT_SILVER=MINERAL_MATERIAL_AMOUNT)
grind_results = list("silver" = 20)
GLOBAL_LIST_INIT(silver_recipes, list ( \
new/datum/stack_recipe("silver door", /obj/structure/mineral_door/silver, 10, one_per_turf = 1, on_floor = 1), \
@@ -232,6 +236,7 @@ GLOBAL_LIST_INIT(silver_recipes, list ( \
sheettype = "clown"
materials = list(MAT_BANANIUM=MINERAL_MATERIAL_AMOUNT)
novariants = TRUE
grind_results = list("banana" = 20)
GLOBAL_LIST_INIT(clown_recipes, list ( \
new/datum/stack_recipe("bananium tile", /obj/item/stack/tile/mineral/bananium, 1, 4, 20), \
@@ -302,6 +307,7 @@ GLOBAL_LIST_INIT(plastitanium_recipes, list ( \
singular_name = "snow block"
force = 1
throwforce = 2
grind_results = list("ice" = 20)
GLOBAL_LIST_INIT(snow_recipes, list ( \
new/datum/stack_recipe("Snow Wall", /turf/closed/wall/mineral/snow, 5, one_per_turf = 1, on_floor = 1), \
@@ -99,6 +99,7 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
flags_1 = CONDUCT_1
resistance_flags = FIRE_PROOF
merge_type = /obj/item/stack/sheet/metal
grind_results = list("iron" = 20)
/obj/item/stack/sheet/metal/ratvar_act()
new /obj/item/stack/tile/brass(loc, amount)
@@ -151,6 +152,7 @@ GLOBAL_LIST_INIT(plasteel_recipes, list ( \
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 100, acid = 80)
resistance_flags = FIRE_PROOF
merge_type = /obj/item/stack/sheet/plasteel
grind_results = list("iron" = 20, "plasma" = 20)
/obj/item/stack/sheet/plasteel/Initialize(mapload, new_amount, merge = TRUE)
recipes = GLOB.plasteel_recipes
@@ -202,6 +204,7 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \
resistance_flags = FLAMMABLE
merge_type = /obj/item/stack/sheet/mineral/wood
novariants = TRUE
grind_results = list("carbon" = 20)
/obj/item/stack/sheet/mineral/wood/Initialize(mapload, new_amount, merge = TRUE)
recipes = GLOB.wood_recipes
@@ -322,6 +325,7 @@ GLOBAL_LIST_INIT(runed_metal_recipes, list ( \
sheettype = "runed"
merge_type = /obj/item/stack/sheet/runed_metal
novariants = TRUE
grind_results = list("iron" = 0.5, "blood" = 1.5)
/obj/item/stack/sheet/runed_metal/ratvar_act()
new /obj/item/stack/tile/brass(loc, amount)
@@ -385,6 +389,7 @@ GLOBAL_LIST_INIT(brass_recipes, list ( \
throw_range = 3
turf_type = /turf/open/floor/clockwork
novariants = FALSE
grind_results = list("iron" = 0.5, "teslium" = 1.5)
/obj/item/stack/tile/brass/narsie_act()
new /obj/item/stack/sheet/runed_metal(loc, amount)
@@ -435,6 +440,7 @@ GLOBAL_LIST_INIT(brass_recipes, list ( \
w_class = WEIGHT_CLASS_NORMAL
throw_speed = 1
throw_range = 3
grind_results = list("carbon" = 1)
GLOBAL_LIST_INIT(plastic_recipes, list(
new /datum/stack_recipe("plastic flaps", /obj/structure/plasticflaps, 5, one_per_turf = TRUE, on_floor = TRUE, time = 40), \
+11
View File
@@ -21,6 +21,17 @@
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.
//NOTE: When adding grind_results, the amounts should be for an INDIVIDUAL ITEM - these amounts will be multiplied by the stack size in on_grind()
/obj/item/stack/on_grind()
for(var/i in 1 to grind_results.len) //This should only call if it's ground, so no need to check if grind_results exists
grind_results[grind_results[i]] *= amount //Gets the key at position i, then the reagent amount of that key, then multiplies it by stack size
/obj/item/stack/grind_requirements()
if(is_cyborg)
to_chat(usr, "<span class='danger'>[src] is electronically synthesized in your chassis and can't be ground up!</span>")
return
return TRUE
/obj/item/stack/Initialize(mapload, new_amount=null , merge = TRUE)
. = ..()
+2
View File
@@ -66,6 +66,7 @@
name = "crushed can"
icon_state = "cola"
resistance_flags = NONE
grind_results = list("aluminum" = 10)
/obj/item/trash/attack(mob/M, mob/living/user)
return
@@ -75,6 +76,7 @@
icon = 'icons/obj/mining.dmi'
icon_state = "slag"
desc = "Someone's gotten on the naughty list."
grind_results = list("carbon" = 20)
/obj/item/trash/coal/burn()
visible_message("[src] fuses into a diamond! Someone wasn't so naughty after all...")