Merge pull request #5453 from mwerezak/embed-fix

Fixes #5446
This commit is contained in:
Chinsky
2014-07-02 01:27:47 +04:00
2 changed files with 19 additions and 4 deletions

View File

@@ -300,8 +300,14 @@ This function restores all organs.
//Embedded object code.
if(!organ) return
if(istype(used_weapon,/obj/item))
var/obj/item/W = used_weapon //Sharp objects will always embed if they do enough damage.
if((damage > (10*W.w_class)) || ((sharp && !ismob(W.loc)) || prob(damage/W.w_class)))
organ.embed(W)
var/obj/item/W = used_weapon
if (!W.is_robot_module())
//blunt objects should really not be embedding in things unless a huge amount of force is involved
var/embed_chance = sharp? damage/W.w_class : damage/(W.w_class*3)
var/embed_threshold = sharp? 5*W.w_class : 15*W.w_class
//Sharp objects will always embed if they do enough damage.
if((sharp && damage > (10*W.w_class)) || (sharp && !ismob(W.loc)) || (damage > embed_threshold && prob(embed_chance)))
organ.embed(W)
return 1

View File

@@ -351,4 +351,13 @@
var/obj/item/device/lightreplacer/LR = locate() in src.modules
LR.Charge(R)
return
return
//checks whether this item is a module of the robot it is located in.
/obj/item/proc/is_robot_module()
if (!istype(src.loc, /mob/living/silicon/robot))
return 0
var/mob/living/silicon/robot/R = src.loc
return (src in R.module.modules)