mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 20:45:28 +01:00
[MIRROR] Saves 2 seconds off init by inlining the bumpclick element [MDB IGNORE] (#17339)
* Saves 2 seconds off init by inlining the bumpclick element (#71008) ## About The Pull Request It was also a tad yorked so I fixed that bit bump_click did very little in this case, and while the modularity is nice, the hotness of minerals made this totally untenable * Saves 2 seconds off init by inlining the bumpclick element Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
///Click with any item?
|
||||
var/allow_any = TRUE
|
||||
|
||||
/datum/element/bump_click/Attach(datum/target, list/tool_behaviours, list/tool_items, allow_unarmed = FALSE, allow_combat = FALSE, allow_any = FALSE)
|
||||
/datum/element/bump_click/Attach(datum/target, list/tool_behaviours, list/tool_types, allow_unarmed = FALSE, allow_combat = FALSE, allow_any = FALSE)
|
||||
. = ..()
|
||||
|
||||
if(!isatom(target) || isarea(target))
|
||||
|
||||
@@ -37,8 +37,18 @@
|
||||
M.Translate(-4, -4)
|
||||
transform = M
|
||||
icon = smooth_icon
|
||||
var/static/list/behaviors = list(TOOL_MINING)
|
||||
AddElement(/datum/element/bump_click, tool_behaviours = behaviors, allow_unarmed = TRUE)
|
||||
|
||||
// Inlined version of the bump click element. way faster this way, the element's nice but it's too much overhead
|
||||
/turf/closed/mineral/Bumped(atom/movable/bumped_atom)
|
||||
. = ..()
|
||||
if(!isliving(bumped_atom))
|
||||
return
|
||||
|
||||
var/mob/living/bumping = bumped_atom
|
||||
var/obj/item/held_item = bumping.get_active_held_item()
|
||||
// !held_item exists to be nice to snow. the other bit is for pickaxes obviously
|
||||
if(!held_item || held_item.tool_behaviour == TOOL_MINING)
|
||||
INVOKE_ASYNC(bumping, /mob.proc/ClickOn, src)
|
||||
|
||||
/turf/closed/mineral/proc/Spread_Vein()
|
||||
var/spreadChance = initial(mineralType.spreadChance)
|
||||
|
||||
Reference in New Issue
Block a user