diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index ee5fd6c1bb6..09e781cd168 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -79,29 +79,36 @@ . += "This is your king. Long live his majesty!" else . += "This is a false king! Strike him down!" - else if(istype(user,/mob/living/simple_animal/hostile/regalrat)) + else if(user != src && istype(user,/mob/living/simple_animal/hostile/regalrat)) . += "Who is this foolish false king? This will not stand!" /mob/living/simple_animal/hostile/regalrat/AttackingTarget() . = ..() - if(health >= maxHealth) - to_chat(src, "You feel fine, no need to eat anything!") - return if(istype(target, /obj/item/food/cheesewedge)) - to_chat(src, "You eat [src], restoring some health.") - heal_bodypart_damage(MINOR_HEAL) + cheese_heal(target, MINOR_HEAL, "You eat [target], restoring some health.") + + else if(istype(target, /obj/item/food/cheesewheel)) + cheese_heal(target, MEDIUM_HEAL, "You eat [target], restoring some health.") + + else if(istype(target, /obj/item/food/royalcheese)) + cheese_heal(target, MAJOR_HEAL, "You eat [target], revitalizing your royal resolve completely.") + +/** + * Conditionally "eat" cheese object and heal, if injured. + * + * A private proc for sending a message to the mob's chat about them + * eating some sort of cheese, then healing them, then deleting the cheese. + * The "eating" is only conditional on the mob being injured in the first + * place. + */ +/mob/living/simple_animal/hostile/regalrat/proc/cheese_heal(obj/item/target, amount, message) + if(health < maxHealth) + to_chat(src, message) + heal_bodypart_damage(amount) qdel(target) - return - if(istype(target, /obj/item/food/cheesewheel)) - to_chat(src, "You eat [src], restoring some health.") - heal_bodypart_damage(MEDIUM_HEAL) - qdel(target) - return - if(istype(target, /obj/item/food/royalcheese)) - to_chat(src, "You eat [src], revitalizing your royal resolve completely.") - heal_bodypart_damage(MAJOR_HEAL) - qdel(target) - return + else + to_chat(src, "You feel fine, no need to eat anything!") + /mob/living/simple_animal/hostile/regalrat/controlled name = "regal rat"