mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 02:54:41 +01:00
Migrates /obj/item/stack to the new attack chain (#31709)
* e * stuff not in the stack folder * A * Update gift_wrappaper.dm * golg * dancing around SHOULD_NOT_SLEEP and storage still being legacy * Update asteroid_floors.dm * Update medical_packs.dm * Update medical_packs.dm
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
/obj/item/stack
|
||||
origin_tech = "materials=1"
|
||||
new_attack_chain = TRUE
|
||||
/// Whether this stack is a `/cyborg` subtype or not.
|
||||
var/is_cyborg = FALSE
|
||||
/// The storage datum that will be used with this stack. Used only with `/cyborg` type stacks.
|
||||
@@ -36,6 +37,24 @@
|
||||
/// Whether this stack can't stack with subtypes.
|
||||
var/parent_stack = FALSE
|
||||
|
||||
/obj/item/stack/examine(mob/user)
|
||||
. = ..()
|
||||
if(!in_range(user, src))
|
||||
return
|
||||
|
||||
if(is_cyborg)
|
||||
if(singular_name)
|
||||
. += "There is enough energy for [get_amount()] [singular_name]\s."
|
||||
else
|
||||
. += "There is enough energy for [get_amount()]."
|
||||
return
|
||||
|
||||
if(singular_name)
|
||||
. += "There are [amount] [singular_name]\s in the stack."
|
||||
else
|
||||
. += "There are [amount] [name]\s in the stack."
|
||||
. +=SPAN_NOTICE("Alt-click to take a custom amount.")
|
||||
|
||||
/obj/item/stack/Initialize(mapload, new_amount, merge = TRUE)
|
||||
if(dynamic_icon_state && isnull(inhand_icon_state)) //If we have a dynamic icon state, we don't want inhand icon states to follow the same pattern.
|
||||
inhand_icon_state = initial(icon_state)
|
||||
@@ -67,6 +86,21 @@
|
||||
AddElement(/datum/element/connect_loc, loc_connections)
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
|
||||
/obj/item/stack/activate_self(mob/user)
|
||||
if(..())
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
ui_interact(user)
|
||||
return ITEM_INTERACT_COMPLETE
|
||||
|
||||
/obj/item/stack/item_interaction(mob/living/user, obj/item/used, list/modifiers)
|
||||
if(!can_merge(used, TRUE))
|
||||
return ..()
|
||||
|
||||
var/obj/item/stack/material = used
|
||||
if(merge(material))
|
||||
to_chat(user, SPAN_NOTICE("Your [material.name] stack now contains [material.get_amount()] [material.singular_name]\s."))
|
||||
|
||||
/obj/item/stack/update_icon_state()
|
||||
. = ..()
|
||||
if(!dynamic_icon_state)
|
||||
@@ -97,24 +131,6 @@
|
||||
merge(hitting)
|
||||
. = ..()
|
||||
|
||||
/obj/item/stack/examine(mob/user)
|
||||
. = ..()
|
||||
if(!in_range(user, src))
|
||||
return
|
||||
|
||||
if(is_cyborg)
|
||||
if(singular_name)
|
||||
. += "There is enough energy for [get_amount()] [singular_name]\s."
|
||||
else
|
||||
. += "There is enough energy for [get_amount()]."
|
||||
return
|
||||
|
||||
if(singular_name)
|
||||
. += "There are [amount] [singular_name]\s in the stack."
|
||||
else
|
||||
. += "There are [amount] [name]\s in the stack."
|
||||
. +=SPAN_NOTICE("Alt-click to take a custom amount.")
|
||||
|
||||
/obj/item/stack/proc/add(newamount)
|
||||
if(is_cyborg)
|
||||
source.add_charge(newamount * cost)
|
||||
@@ -140,8 +156,22 @@
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/stack/attack_self__legacy__attackchain(mob/user)
|
||||
ui_interact(user)
|
||||
/obj/item/stack/use(used, check = TRUE)
|
||||
if(check && is_zero_amount(TRUE))
|
||||
return FALSE
|
||||
|
||||
if(is_cyborg)
|
||||
return source.use_charge(used * cost)
|
||||
|
||||
if(amount < used)
|
||||
return FALSE
|
||||
|
||||
amount -= used
|
||||
if(check && is_zero_amount(TRUE))
|
||||
return TRUE
|
||||
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/stack/attack_self_tk(mob/user)
|
||||
ui_interact(user)
|
||||
@@ -169,31 +199,6 @@
|
||||
if(src && user.machine == src)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/stack/attackby__legacy__attackchain(obj/item/thing, mob/user, params)
|
||||
if(!can_merge(thing, TRUE))
|
||||
return ..()
|
||||
|
||||
var/obj/item/stack/material = thing
|
||||
if(merge(material))
|
||||
to_chat(user, SPAN_NOTICE("Your [material.name] stack now contains [material.get_amount()] [material.singular_name]\s."))
|
||||
|
||||
/obj/item/stack/use(used, check = TRUE)
|
||||
if(check && is_zero_amount(TRUE))
|
||||
return FALSE
|
||||
|
||||
if(is_cyborg)
|
||||
return source.use_charge(used * cost)
|
||||
|
||||
if(amount < used)
|
||||
return FALSE
|
||||
|
||||
amount -= used
|
||||
if(check && is_zero_amount(TRUE))
|
||||
return TRUE
|
||||
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/stack/AltClick(mob/living/user)
|
||||
if(!istype(user) || user.incapacitated())
|
||||
to_chat(user, SPAN_WARNING("You can't do that right now!"))
|
||||
|
||||
Reference in New Issue
Block a user