Done, tested, too many options.

This commit is contained in:
Ghommie
2020-05-02 19:05:41 +02:00
parent 122067c5f4
commit c38c1755cd
3 changed files with 120 additions and 62 deletions
+37 -37
View File
@@ -6,6 +6,7 @@
name = "pile of junk"
desc = "Lots of junk lying around. They say one man's trash is another man's treasure."
icon = 'icons/obj/loot_piles.dmi'
icon_state = "randompile"
density = FALSE
anchored = TRUE
var/loot_amount = 5
@@ -14,43 +15,20 @@
var/scavenge_time = 12 SECONDS
var/allowed_tools = list(TOOL_SHOVEL = 0.6) //list of tool_behaviours with associated speed multipliers (lower is better)
var/icon_states_to_use = list("junk_pile1", "junk_pile2", "junk_pile3", "junk_pile4", "junk_pile5")
var/list/loot = list(
SCAVENGING_FOUND_NOTHING = 50,
SCAVENGING_SPAWN_MOUSE = 10,
SCAVENGING_SPAWN_MICE = 5,
SCAVENGING_SPAWN_TOM = 1,
/obj/item/flashlight/flare = 10,
/obj/item/flashlight/glowstick = 10,
/obj/item/flashlight/glowstick/blue = 10,
/obj/item/flashlight/glowstick/orange = 10,
/obj/item/flashlight/glowstick/red = 10,
/obj/item/flashlight/glowstick/yellow = 10,
/obj/item/clothing/mask/gas = 5,
/obj/item/clothing/mask/breath = 10,
/obj/item/storage/box = 10,
/obj/item/clothing/shoes/galoshes = 2,
/obj/item/clothing/shoes/sneakers/black = 10,
/obj/item/clothing/gloves/color/fyellow = 5,
/obj/item/clothing/gloves/color/yellow = 2,
/obj/item/clothing/glasses/sunglasses = 3,
/obj/item/clothing/glasses/meson = 3,
/obj/item/clothing/glasses/welding = 3,
/obj/item/clothing/head/hardhat = 10,
/obj/item/clothing/head/ushanka = 10,
/obj/item/clothing/head/welding = 5,
/obj/item/clothing/suit/hazardvest = 10,
/obj/item/clothing/under/syndicate/tacticool = 5,
/obj/item/clothing/under/pants/camo = 10,
/obj/item/stack/spacecash/c10 = 20,
/obj/item/stack/spacecash/c20 = 20,
/obj/item/stack/spacecash/c50 = 20,
/obj/item/radio/headset = 10)
var/list/loot
/*
* Associated values in this list are not weights but numbers of times the kery can be rolled
* before being removed from ALL piles with same kind. This is why I wanted 'scavenging' to be an element and not a component.
*/
var/list/unique_loot = list(/obj/item/clothing/gloves/color/yellow = 2, SCAVENGING_SPAWN_TOM = 1)
var/list/unique_loot
/*
* used for restrictions such as "one per mind", "one per ckey". Depending on the setting, these can be either limited to
* the current pile or shared throughout all atoms attached to this element.
*/
var/loot_restriction = NO_LOOT_RESTRICTION
var/maximum_loot_per_player = 1
/obj/structure/loot_pile/Initialize()
. = ..()
@@ -58,9 +36,31 @@
/obj/structure/loot_pile/ComponentInitialize()
. = ..()
AddElement(/datum/element/scavenging, loot_amount, loot, unique_loot, scavenge_time, can_use_hands, allowed_tools, null, delete_on_depletion)
if(loot)
AddElement(/datum/element/scavenging, loot_amount, loot, unique_loot, scavenge_time, can_use_hands, allowed_tools, null, delete_on_depletion, loot_restriction, maximum_loot_per_player)
/obj/structure/loot_pile/infinite
name = "endless pile of junk."
desc = "Lots of awful code lying around. They don't say one coder's trash is another coder's treasure though..."
loot_amount = INFINITY
//uses the maintenance_loot global list, mostly boring stuff and mices.
/obj/structure/loot_pile/maint
name = "trash pile"
desc = "A heap of garbage, but maybe there's something interesting inside?"
density = TRUE
layer = TABLE_LAYER
climbable = TRUE
pass_flags = LETPASSTHROW
loot = list(
SCAVENGING_FOUND_NOTHING = 50,
SCAVENGING_SPAWN_MOUSE = 10,
SCAVENGING_SPAWN_MICE = 5,
SCAVENGING_SPAWN_TOM = 1,
/obj/item/clothing/gloves/color/yellow = 0.5)
unique_loot = list(/obj/item/clothing/gloves/color/yellow = 5, SCAVENGING_SPAWN_TOM = 1)
/obj/structure/loot_pile/maint/ComponentInitialize()
var/static/safe_maint_items
if(!safe_maint_items)
safe_maint_items = list()
for(var/A in GLOB.maintenance_loot)
if(ispath(A, /obj/item))
safe_maint_items[A] = GLOB.maintenance_loot[A]
loot += safe_maint_items
return ..()