Files
FalloutFalcon d2f34e33be moves abstract_type up to datum, spawners wont spawn them (#92909)
## About The Pull Request
moves all implementations (im aware of) for "Im a parent type dont spawn
me please" to the datum layer to standardized behavior
adds a standerized proc for filtering out "bad" items that we dont want
spawning. applies to it the subtype vendor, gifts, and a new spawner and
mystery box for a random gun (neither playerfacing)
"port" of https://github.com/shiptest-ss13/Shiptest/pull/4621



https://github.com/user-attachments/assets/22f6f0b2-b44e-411a-b3dc-6b97dc0287aa

small warning: I dont have EVERY abstract type defined right now but,
ive done a good enough job for now. Im tired of data entry rn
## Why It's Good For The Game
standardizing behavior. Might be a micro hit to performance however

having this lets us not rely on icon state to determine whether
something is a parent type and makes it much easier to tell something is
a parent type (could be applied further to things like admin spawning
menus and things like that).

need feedback on if this is actually good for the game.
## Changelog
🆑
add: Soda cans show up in the silver slime drink table.
add: Examine tag for items that are not mean to show up ingame.
refactor: Standardizes how gifts rule out abstract types.
fix: gifts no longer check if something has an inhand, massively
expanding the list of potential items.
/🆑
2025-09-13 00:36:15 +02:00

71 lines
2.6 KiB
Plaintext

/// Subtype with support for hoods
/// You no longer actually need to extend this and can just add the component yourself without a lot of this boilerplate code
/obj/item/clothing/suit/hooded
var/hoodtype = /obj/item/clothing/head/hooded/winterhood //so the chaplain hoodie or other hoodies can override this
/// Alternative mode for hiding the hood, instead of storing the hood in the suit it qdels it, useful for when you deal with hooded suit with storage.
var/alternative_mode = FALSE
/// What should be added to the end of the icon state when the hood is up? Set to "" for the suit sprite to not change at all
var/hood_up_affix = "_t"
/// Icon state added as a worn overlay while the hood is down, leave as "" for no overlay
var/hood_down_overlay_suffix = ""
/// Reference to hood object, if it exists
var/obj/item/clothing/head/hooded/hood
/obj/item/clothing/suit/hooded/Initialize(mapload)
. = ..()
if (!hoodtype)
return
AddComponent(\
/datum/component/toggle_attached_clothing,\
deployable_type = hoodtype,\
equipped_slot = ITEM_SLOT_HEAD,\
action_name = "Toggle Hood",\
destroy_on_removal = alternative_mode,\
parent_icon_state_suffix = hood_up_affix,\
down_overlay_state_suffix = hood_down_overlay_suffix, \
pre_creation_check = CALLBACK(src, PROC_REF(can_create_hood)),\
on_created = CALLBACK(src, PROC_REF(on_hood_created)),\
on_deployed = CALLBACK(src, PROC_REF(on_hood_up)),\
on_removed = CALLBACK(src, PROC_REF(on_hood_down)),\
)
/obj/item/clothing/suit/hooded/Destroy()
hood = null
return ..()
/// Override to only create the hood conditionally
/obj/item/clothing/suit/hooded/proc/can_create_hood()
return TRUE
/// Called when the hood is instantiated
/obj/item/clothing/suit/hooded/proc/on_hood_created(obj/item/clothing/head/hooded/hood)
SHOULD_CALL_PARENT(TRUE)
src.hood = hood
RegisterSignal(hood, COMSIG_QDELETING, PROC_REF(on_hood_deleted))
/// Called when hood is deleted
/obj/item/clothing/suit/hooded/proc/on_hood_deleted()
SIGNAL_HANDLER
SHOULD_CALL_PARENT(TRUE)
hood = null
/// Called when the hood is worn
/obj/item/clothing/suit/hooded/proc/on_hood_up(obj/item/clothing/head/hooded/hood)
return
/// Called when the hood is hidden
/obj/item/clothing/suit/hooded/proc/on_hood_down(obj/item/clothing/head/hooded/hood)
return
/obj/item/clothing/suit/toggle
abstract_type = /obj/item/clothing/suit/toggle
/// The noun that is displayed to the user on toggle. EX: "Toggles the suit's [buttons]".
var/toggle_noun = "buttons"
/obj/item/clothing/suit/toggle/Initialize(mapload)
. = ..()
AddComponent(/datum/component/toggle_icon, toggle_noun)
/obj/item/clothing/head/hooded
abstract_type = /obj/item/clothing/head/hooded