embed
Vars | |
embed_chance | whether we can skip assigning all the vars (since these are bespoke elements, we don't have to reset the vars every time we attach to something, we already know what we are!) |
---|---|
Procs | |
checkEmbed | Checking to see if we're gonna embed into a human |
checkEmbedProjectile | checkEmbedProjectile() is what we get when a projectile with a defined shrapnel_type impacts a target. |
detachFromWeapon | If we don't want to be embeddable anymore (deactivating an e-dagger for instance) |
examined | Someone inspected our embeddable item |
severancePackage | A different embed element has been attached, so we'll detach and let them handle things |
tryForceEmbed | tryForceEmbed() is called here when we fire COMSIG_EMBED_TRY_FORCE from /obj/item/proc/tryEmbed. Mostly, this means we're a piece of shrapnel from a projectile that just impacted something, and we're trying to embed in it. |
Var Details
embed_chance
whether we can skip assigning all the vars (since these are bespoke elements, we don't have to reset the vars every time we attach to something, we already know what we are!)
Proc Details
checkEmbed
Checking to see if we're gonna embed into a human
checkEmbedProjectile
checkEmbedProjectile() is what we get when a projectile with a defined shrapnel_type impacts a target.
If we hit a valid target, we create the shrapnel_type object and immediately call tryEmbed() on it, targeting what we impacted. That will lead it to call tryForceEmbed() on its own embed element (it's out of our hands here, our projectile is done), where it will run through all the checks it needs to.
detachFromWeapon
If we don't want to be embeddable anymore (deactivating an e-dagger for instance)
examined
Someone inspected our embeddable item
severancePackage
A different embed element has been attached, so we'll detach and let them handle things
tryForceEmbed
tryForceEmbed() is called here when we fire COMSIG_EMBED_TRY_FORCE from /obj/item/proc/tryEmbed. Mostly, this means we're a piece of shrapnel from a projectile that just impacted something, and we're trying to embed in it.
The reason for this extra mucking about is avoiding having to do an extra hitby(), and annoying the target by impacting them once with the projectile, then again with the shrapnel, and possibly AGAIN if we actually embed. This way, we save on at least one message.
Arguments:
- I- the item we're trying to insert into the target
- target- what we're trying to shish-kabob, either a bodypart or a carbon
- hit_zone- if our target is a carbon, try to hit them in this zone, if we don't have one, pick a random one. If our target is a bodypart, we already know where we're hitting.
- forced- if we want this to succeed 100%