Merge with master.

This commit is contained in:
Zuhayr
2014-07-02 06:59:11 +09:30
5 changed files with 165 additions and 131 deletions
@@ -299,9 +299,15 @@ This function restores all organs.
//Embedded object code.
if(!organ) return
if(istype(used_weapon,/obj/item) && !istype(used_weapon.loc,/mob/living/silicon/robot))
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)
if(istype(used_weapon,/obj/item))
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
@@ -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)