mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-25 00:51:55 +00:00
Adds set_density() Fixes one instance of a duplicate density assignment on an object. Comments two hacky usages of density which will have to forgo using the setter for now. Lets us append code to the event of density changing. Pretty sure this is leading up to some multitile object thing -Lemon Co-authored-by: Rohesie <rohesie@gmail.com>
32 lines
974 B
Plaintext
32 lines
974 B
Plaintext
/// Tank holder item - Added to an object which can be added to a tank holder.
|
|
/datum/component/container_item/tank_holder
|
|
var/tank_holder_icon_state
|
|
var/make_density
|
|
|
|
/datum/component/container_item/tank_holder/Initialize(state, density = TRUE)
|
|
if(!isitem(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
tank_holder_icon_state = state
|
|
make_density = density
|
|
return ..()
|
|
|
|
/datum/component/container_item/tank_holder/try_attach(datum/source, obj/structure/tank_holder/container, mob/user)
|
|
if(!container || !istype(container))
|
|
return FALSE
|
|
var/obj/item/I = parent
|
|
if(container.contents.len)
|
|
if(user)
|
|
to_chat(user, span_warning("There's already something in [container]."))
|
|
return TRUE
|
|
if(user)
|
|
if(!user.transferItemToLoc(I, container))
|
|
return TRUE
|
|
to_chat(user, span_notice("You put [I] into [container]."))
|
|
else
|
|
I.forceMove(container)
|
|
container.tank = I
|
|
container.set_density(make_density)
|
|
container.icon_state = tank_holder_icon_state
|
|
return TRUE
|