mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-11 08:06:33 +01:00
7754938c72
## About The Pull Request Empy lists. There are a lot of 'em. <img width="981" height="512" alt="image" src="https://github.com/user-attachments/assets/b94b041a-2904-466b-ab89-54bd1de11b4e" /> Going through ways to reduce memory I found a few easy ones here. Wires, the edible component, the seethrough component. None of these are really a concern when it comes to needing lists in memory for performance reasons. Wires aren't going to be cut most of the time for each door. A lot of food does not have any junkiness. Seethrough component lies dormant most of the round. Etc. Making lists lazy in these cases should be a no brainer. Everything I tested still seems to work exactly the same. ## Why It's Good For The Game Frees memory that is just taking up space a lot of the time. ## Changelog Not player-facing, this is all under-the-hood stuff.
50 lines
2.1 KiB
Plaintext
50 lines
2.1 KiB
Plaintext
/// Generic reagent applicator type for pills and patches
|
|
/obj/item/reagent_containers/applicator
|
|
name = "generic reagent applicator"
|
|
desc = "Report this please."
|
|
abstract_type = /obj/item/reagent_containers/applicator
|
|
has_variable_transfer_amount = FALSE
|
|
/// Action string displayed in vis_message
|
|
var/apply_method = "swallow"
|
|
/// Does the item get its name changed as volume when its produced
|
|
var/rename_with_volume = FALSE
|
|
/// How long does it take to apply this item to someone else?
|
|
var/application_delay = 3 SECONDS
|
|
/// How long does it take to apply this item to self?
|
|
var/self_delay = 0
|
|
|
|
/obj/item/reagent_containers/applicator/Initialize(mapload)
|
|
. = ..()
|
|
if(reagents.total_volume && rename_with_volume)
|
|
name += " ([reagents.total_volume]u)"
|
|
|
|
/// Consumption effects, must be overriden by children
|
|
/obj/item/reagent_containers/applicator/proc/on_consumption(mob/consumer, mob/giver, list/modifiers)
|
|
return
|
|
|
|
/obj/item/reagent_containers/applicator/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
|
|
if (!ismob(interacting_with))
|
|
return NONE
|
|
|
|
var/mob/target_mob = interacting_with
|
|
if(!canconsume(target_mob, user))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
user.changeNext_move(CLICK_CD_MELEE)
|
|
if(target_mob == user)
|
|
target_mob.visible_message(span_notice("[user] attempts to [apply_method] [src]."))
|
|
if(self_delay)
|
|
if(!do_after(user, self_delay, target_mob))
|
|
return ITEM_INTERACT_BLOCKING
|
|
to_chat(target_mob, span_notice("You [apply_method] [src]."))
|
|
on_consumption(user, user, modifiers)
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
target_mob.visible_message(span_danger("[user] attempts to force [target_mob] to [apply_method] [src]."), span_userdanger("[user] attempts to force you to [apply_method] [src]."))
|
|
if(!do_after(user, CHEM_INTERACT_DELAY(application_delay, user), target_mob))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
target_mob.visible_message(span_danger("[user] forces [target_mob] to [apply_method] [src]."), span_userdanger("[user] forces you to [apply_method] [src]."))
|
|
on_consumption(target_mob, user, modifiers)
|
|
return ITEM_INTERACT_SUCCESS
|