Files
CHOMPStation2/code/game/objects/structures/loot_piles.dm
CHOMPStation2StaffMirrorBot 1b8f394a14 [MIRROR] Makes uses of do_after sane (#11582)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
2025-09-07 23:02:27 -04:00

255 lines
10 KiB
Plaintext

/*
Basically, each player key gets one chance per loot pile to get them phat lewt.
When they click the pile, after a delay, they 'roll' if they get anything, using chance_nothing. If they're unlucky, they get nothing.
Otherwise, they roll up to two times, first a roll for rare things, using chance_rare. If they succeed, they get something quite good.
If that roll fails, they do one final roll, using chance_uncommon. If they succeed, they get something fairly useful.
If that fails again, they walk away with some common junk.
The same player cannot roll again, however other players can. This has two benefits. The first benefit is that someone raiding all of
maintenance will not deprive other people from a shot at loot, and that for the surface variants, it quietly encourages bringing along
buddies, to get more chances at getting cool things instead of someone going solo to hoard all the stuff.
Loot piles can be depleted, if loot_depleted is turned on. Note that players who searched the pile already won't deplete the loot furthers when searching again.
*/
/obj/structure/loot_pile
name = "base loot pile"
desc = "If you can read me, this is bugged"
description_info = "This can be searched by clicking on it and waiting a few seconds. You might find valuable treasures or worthless junk. \
These can only searched each once per player."
icon = 'icons/obj/loot_piles.dmi'
icon_state = "randompile"
density = FALSE
anchored = TRUE
unacidable = TRUE
var/list/icon_states_to_use = list() // List of icon states the pile can choose from on initialization. If empty or null, it will stay the initial icon_state.
var/list/searchedby = list() // Keys that have searched this loot pile, with values of searched time.
var/busy = FALSE // Used so you can't spamclick to loot.
var/loot_element_path = null
/obj/structure/loot_pile/attack_ai(var/mob/user)
if(isrobot(user) && Adjacent(user))
return attack_hand(user)
/obj/structure/loot_pile/attack_hand(mob/user)
//Human mob
if(isliving(user))
var/mob/living/L = user
if(busy)
to_chat(L, span_warning("\The [src] is already being searched."))
return
L.visible_message("[user] searches through \the [src].",span_notice("You search through \the [src]."))
//Do the searching
busy = TRUE
if(do_after(user, rand(4 SECONDS,6 SECONDS), target = src))
SEND_SIGNAL(src,COMSIG_LOOT_REWARD,L,searchedby)
busy = FALSE
else
return ..()
/obj/structure/loot_pile/Initialize(mapload)
if(icon_states_to_use && icon_states_to_use.len)
icon_state = pick(icon_states_to_use)
. = ..()
if(loot_element_path)
AddElement(loot_element_path)
// Maintenance junk piles with common to fun loot
/obj/structure/loot_pile/maint/junk
name = "pile of junk"
desc = "Lots of junk lying around. They say one man's trash is another man's treasure."
icon_states_to_use = list("junk_pile1", "junk_pile2", "junk_pile3", "junk_pile4", "junk_pile5")
loot_element_path = /datum/element/lootable/maint/junk
/obj/structure/loot_pile/maint/trash
name = "pile of trash"
desc = "Lots of garbage in one place. Might be able to find something if you're in the mood for dumpster diving."
icon_states_to_use = list("trash_pile1", "trash_pile2")
loot_element_path = /datum/element/lootable/maint/trash
/obj/structure/loot_pile/maint/boxfort
name = "pile of boxes"
desc = "A large pile of boxes sits here."
density = TRUE
icon_states_to_use = list("boxfort")
loot_element_path = /datum/element/lootable/boxes
/obj/structure/loot_pile/maint/technical
name = "broken machine"
desc = "A destroyed machine with unknown purpose, and doesn't look like it can be fixed. It might still have some functional components?"
density = TRUE
icon_states_to_use = list("technical_pile1", "technical_pile2", "technical_pile3")
loot_element_path = /datum/element/lootable/maint/technical
// Surface piles for POIs, most have rarer loot
/obj/structure/loot_pile/surface/alien
name = "alien pod"
desc = "A pod which looks bigger on the inside. Something quite shiny might be inside?"
icon_state = "alien_pile1"
loot_element_path = /datum/element/lootable/surface/alien
/obj/structure/loot_pile/surface/alien/engineering
loot_element_path = /datum/element/lootable/surface/alien/engineering
/obj/structure/loot_pile/surface/alien/medical
loot_element_path = /datum/element/lootable/surface/alien/medical
/obj/structure/loot_pile/surface/alien/security
loot_element_path = /datum/element/lootable/surface/alien/security
/obj/structure/loot_pile/surface/alien/end
loot_element_path = /datum/element/lootable/surface/alien/end
/obj/structure/loot_pile/surface/bones
name = "bone pile"
desc = "A pile of various dusty bones. Your graverobbing instincts tell you there might be valuables here."
icon = 'icons/obj/bones.dmi'
icon_state = "bonepile"
loot_element_path = /datum/element/lootable/surface/bones
/obj/structure/loot_pile/surface/drone
name = "drone wreckage"
desc = "The ruins of some unfortunate drone. Perhaps something is salvageable."
icon = 'icons/mob/animal.dmi'
icon_state = "drone_dead"
loot_element_path = /datum/element/lootable/surface/drone
/obj/structure/loot_pile/surface/drone/large
//icon = 'icons/mob/animal_vr64x64.dmi' //This file doesn't exist anymore.
icon_state = "drone"
// Mechaparts loot piles
/obj/structure/loot_pile/mecha
name = "pod wreckage"
desc = "The ruins of some unfortunate pod. Perhaps something is salvageable."
icon = 'icons/mecha/mecha.dmi'
icon_state = "engineering_pod-broken"
loot_element_path = /datum/element/lootable/mecha
density = TRUE
anchored = FALSE // In case a dead mecha-mob dies in a bad spot.
/obj/structure/loot_pile/mecha/ripley
name = "ripley wreckage"
desc = "The ruins of some unfortunate ripley. Perhaps something is salvageable."
icon_state = "ripley-broken"
loot_element_path = /datum/element/lootable/mecha/ripley
/obj/structure/loot_pile/mecha/ripley/firefighter
icon_state = "firefighter-broken"
/obj/structure/loot_pile/mecha/ripley/random_sprite
icon_states_to_use = list("ripley-broken", "firefighter-broken", "ripley-broken-old")
/obj/structure/loot_pile/mecha/deathripley
name = "strange ripley wreckage"
icon_state = "deathripley-broken"
loot_element_path = /datum/element/lootable/mecha/deathripley
/obj/structure/loot_pile/mecha/odysseus
name = "odysseus wreckage"
desc = "The ruins of some unfortunate odysseus. Perhaps something is salvageable."
icon_state = "odysseus-broken"
loot_element_path = /datum/element/lootable/mecha/odysseus
/obj/structure/loot_pile/mecha/odysseus/murdysseus
icon_state = "murdysseus-broken"
/obj/structure/loot_pile/mecha/hoverpod
name = "hoverpod wreckage"
desc = "The ruins of some unfortunate hoverpod. Perhaps something is salvageable."
icon_state = "engineering_pod"
/obj/structure/loot_pile/mecha/gygax
name = "gygax wreckage"
desc = "The ruins of some unfortunate gygax. Perhaps something is salvageable."
icon_state = "gygax-broken"
loot_element_path = /datum/element/lootable/mecha/gygax
/obj/structure/loot_pile/mecha/gygax/dark
icon_state = "darkgygax-broken"
/obj/structure/loot_pile/mecha/gygax/dark/adv
icon_state = "darkgygax_adv-broken"
icon_scale_x = 1.5
icon_scale_y = 1.5
pixel_y = 8
/obj/structure/loot_pile/mecha/gygax/medgax
icon_state = "medgax-broken"
/obj/structure/loot_pile/mecha/durand
name = "durand wreckage"
desc = "The ruins of some unfortunate durand. Perhaps something is salvageable."
icon_state = "durand-broken"
loot_element_path = /datum/element/lootable/mecha/durand
/obj/structure/loot_pile/mecha/marauder // Todo: Better loot.
name = "marauder wreckage"
desc = "The ruins of some unfortunate marauder. Perhaps something is salvagable."
icon_state = "marauder-broken"
/obj/structure/loot_pile/mecha/marauder/seraph
name = "seraph wreckage"
desc = "The ruins of some unfortunate seraph. Perhaps something is salvagable."
icon_state = "seraph-broken"
/obj/structure/loot_pile/mecha/marauder/mauler
name = "mauler wreckage"
desc = "The ruins of some unfortunate mauler. Perhaps something is salvagable."
icon_state = "mauler-broken"
/obj/structure/loot_pile/mecha/phazon
name = "phazon wreckage"
desc = "The ruins of some unfortunate phazon. Perhaps something is salvageable."
icon_state = "phazon-broken"
loot_element_path = /datum/element/lootable/mecha/phazon
/obj/structure/loot_pile/surface/medicine_cabinet
name = "abandoned medicine cabinet"
desc = "An old cabinet, it might still have something of use inside."
icon_state = "medicine_cabinet"
density = FALSE
loot_element_path = /datum/element/lootable/expired_medicine
/obj/structure/loot_pile/surface/medicine_cabinet/fresh
name = "medicine cabinet"
desc = "A cabinet designed to hold medicine, it might still have something of use inside."
icon_state = "medicine_cabinet"
density = FALSE
loot_element_path = /datum/element/lootable/fresh_medicine
//Micro mecha loot.
/obj/structure/loot_pile/mecha/mouse_tank
name = "\improper Whisker wreckage"
desc = "The ruins of a small tank. Perhaps some child's toy?"
icon = 'icons/mob/mouse_army.dmi'
icon_state = "whisker-broken"
density = TRUE
anchored = FALSE // In case a dead mecha-mob dies in a bad spot.
loot_element_path = /datum/element/lootable/mecha/mouse_tank
/obj/structure/loot_pile/mecha/mouse_tank/livewire
name = "\improper Livewire wreckage"
desc = "The smoldering ruins of a small tank. Perhaps some child's toy?"
icon_state = "livewire-broken"
density = TRUE
anchored = FALSE // In case a dead mecha-mob dies in a bad spot.
loot_element_path = /datum/element/lootable/mecha/mouse_tank/livewire
/obj/structure/loot_pile/mecha/mouse_tank/eraticator
name = "\improper Eraticator wreckage"
desc = "The blasted ruins of a small tank. Perhaps some child's toy?"
icon_state = "eraticator-broken"
density = TRUE
anchored = FALSE // In case a dead mecha-mob dies in a b
loot_element_path = /datum/element/lootable/mecha/mouse_tank/eraticator
/obj/structure/loot_pile/mecha/ripley/pirate
icon = 'icons/mob/pirates.dmi'
icon_state = "pirate-broken"
/obj/structure/loot_pile/maint/technical
density = FALSE
/obj/structure/loot_pile/maint/boxfort
density = FALSE