mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
[MIRROR] Fixes an embed runtime (#373)
* embed runtime (#52912) * Fixes an embed runtime Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
+19
-11
@@ -951,11 +951,13 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
|
||||
if(embedding)
|
||||
return !isnull(embedding["pain_mult"]) && !isnull(embedding["jostle_pain_mult"]) && embedding["pain_mult"] == 0 && embedding["jostle_pain_mult"] == 0
|
||||
|
||||
///In case we want to do something special (like self delete) upon failing to embed in something, return true
|
||||
///In case we want to do something special (like self delete) upon failing to embed in something. Returns a bitflag.
|
||||
/obj/item/proc/failedEmbed()
|
||||
if(item_flags & DROPDEL)
|
||||
QDEL_NULL(src)
|
||||
return TRUE
|
||||
qdel(src)
|
||||
return COMPONENT_PROJECTILE_SELF_ON_HIT_SELF_DELETE
|
||||
return NONE
|
||||
|
||||
|
||||
///Called by the carbon throw_item() proc. Returns null if the item negates the throw, or a reference to the thing to suffer the throw else.
|
||||
/obj/item/proc/on_thrown(mob/living/carbon/user, atom/target)
|
||||
@@ -972,19 +974,22 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
|
||||
*
|
||||
* Really, this is used mostly with projectiles with shrapnel payloads, from [/datum/element/embed/proc/checkEmbedProjectile], and called on said shrapnel. Mostly acts as an intermediate between different embed elements.
|
||||
*
|
||||
* Returns bitflags informing whether the item was able to embed itself, deleted itself in the process, or nothing happened.
|
||||
*
|
||||
* Arguments:
|
||||
* * target- Either a body part or a carbon. What are we hitting?
|
||||
* * forced- Do we want this to go through 100%?
|
||||
*/
|
||||
/obj/item/proc/tryEmbed(atom/target, forced=FALSE, silent=FALSE)
|
||||
if(!isbodypart(target) && !iscarbon(target))
|
||||
return
|
||||
return NONE
|
||||
if(!forced && !LAZYLEN(embedding))
|
||||
return
|
||||
return NONE
|
||||
|
||||
if(SEND_SIGNAL(src, COMSIG_EMBED_TRY_FORCE, target, forced, silent))
|
||||
return TRUE
|
||||
failedEmbed()
|
||||
return COMPONENT_PROJECTILE_SELF_ON_HIT_EMBED_SUCCESS
|
||||
return failedEmbed()
|
||||
|
||||
|
||||
///For when you want to disable an item's embedding capabilities (like transforming weapons and such), this proc will detach any active embed elements from it.
|
||||
/obj/item/proc/disableEmbedding()
|
||||
@@ -1043,10 +1048,13 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
|
||||
|
||||
M.apply_damage(max(15, force), BRUTE, BODY_ZONE_HEAD, wound_bonus = 10, sharpness = TRUE)
|
||||
M.losebreath += 2
|
||||
if(tryEmbed(M.get_bodypart(BODY_ZONE_CHEST), TRUE, TRUE)) //and if it embeds in their chest, cause a lot of pain
|
||||
M.apply_damage(max(25, force*1.5), BRUTE, BODY_ZONE_CHEST, wound_bonus = 7, sharpness = TRUE)
|
||||
M.losebreath += 6
|
||||
discover_after = FALSE
|
||||
switch(tryEmbed(M.get_bodypart(BODY_ZONE_CHEST), TRUE, TRUE)) //and if it embeds in their chest, cause a lot of pain
|
||||
if(COMPONENT_PROJECTILE_SELF_ON_HIT_SELF_DELETE)
|
||||
return
|
||||
if(COMPONENT_PROJECTILE_SELF_ON_HIT_EMBED_SUCCESS)
|
||||
M.apply_damage(max(25, force*1.5), BRUTE, BODY_ZONE_CHEST, wound_bonus = 7, sharpness = TRUE)
|
||||
M.losebreath += 6
|
||||
discover_after = FALSE
|
||||
|
||||
if(S?.tastes?.len) //is that blood in my mouth?
|
||||
S.tastes += "iron"
|
||||
|
||||
Reference in New Issue
Block a user