Merge pull request #9205 from mwerezak/masks

Snacks, drinks, and pills now check mouth coverage
This commit is contained in:
Zuhayr
2015-05-12 18:11:48 +09:30
5 changed files with 68 additions and 29 deletions

View File

@@ -138,6 +138,14 @@ emp_act
return 1
return 0
//Used to check if they can be fed food/drinks/pills
/mob/living/carbon/human/proc/check_mouth_coverage()
var/list/protective_gear = list(head, wear_mask, wear_suit, w_uniform)
for(var/obj/item/gear in protective_gear)
if(istype(gear) && (gear.body_parts_covered & FACE) && (gear.flags & (MASKCOVERSMOUTH|HEADCOVERSMOUTH)))
return gear
return null
/mob/living/carbon/human/proc/check_shields(var/damage = 0, var/attack_text = "the attack")
if(l_hand && istype(l_hand, /obj/item/weapon))//Current base is the prob(50-d/3)
var/obj/item/weapon/I = l_hand

View File

@@ -23,7 +23,7 @@
var/fillevel = gulp_size
if(!R.total_volume || !R)
user << "\red The [src.name] is empty!"
user << "<span class='danger'>The [src.name] is empty!"
return 0
if(M == user)
@@ -31,10 +31,15 @@
if(istype(M,/mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.species.flags & IS_SYNTHETIC)
H << "\red You have a monitor for a head, where do you think you're going to put that?"
H << "<span class='danger'>You have a monitor for a head, where do you think you're going to put that?</span>"
return
var/obj/item/blocked = H.check_mouth_coverage()
if(blocked)
user << "<span class='warning'>\The [blocked] is in the way!</span>"
return
M << "\blue You swallow a gulp from \the [src]."
M << "<span class='notice'>You swallow a gulp from \the [src].</span>"
if(reagents.total_volume)
reagents.trans_to_ingest(M, gulp_size)
@@ -44,14 +49,17 @@
var/mob/living/carbon/human/H = M
if(H.species.flags & IS_SYNTHETIC)
H << "\red They have a monitor for a head, where do you think you're going to put that?"
user << "<span class='danger'>They have a monitor for a head, where do you think you're going to put that?</span>"
return
var/obj/item/blocked = H.check_mouth_coverage()
if(blocked)
user << "<span class='warning'>\The [blocked] is in the way!</span>"
return
for(var/mob/O in viewers(world.view, user))
O.show_message("\red [user] attempts to feed [M] [src].", 1)
user.visible_message("<span class='danger'>[user] attempts to feed [M] [src].</span>")
if(!do_mob(user, M)) return
for(var/mob/O in viewers(world.view, user))
O.show_message("\red [user] feeds [M] [src].", 1)
user.visible_message("<span class='danger'>[user] feeds [M] [src].</span>")
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been fed [src.name] by [user.name] ([user.ckey]) Reagents: [reagentlist(src)]</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Fed [M.name] by [M.name] ([M.ckey]) Reagents: [reagentlist(src)]</font>")

View File

@@ -47,35 +47,44 @@
if(istype(M,/mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.species.flags & IS_SYNTHETIC)
H << "\red You have a monitor for a head, where do you think you're going to put that?"
H << "<span class='danger'>You have a monitor for a head, where do you think you're going to put that?</span>"
return
var/obj/item/blocked = H.check_mouth_coverage()
if(blocked)
user << "<span class='warning'>\The [blocked] is in the way!</span>"
return
if (fullness <= 50)
M << "\red You hungrily chew out a piece of [src] and gobble it!"
M << "<span class='danger'>You hungrily chew out a piece of [src] and gobble it!</span>"
if (fullness > 50 && fullness <= 150)
M << "\blue You hungrily begin to eat [src]."
M << "<span class='notice'>You hungrily begin to eat [src].</span>"
if (fullness > 150 && fullness <= 350)
M << "\blue You take a bite of [src]."
M << "<span class='notice'>You take a bite of [src].</span>"
if (fullness > 350 && fullness <= 550)
M << "\blue You unwillingly chew a bit of [src]."
M << "<span class='notice'>You unwillingly chew a bit of [src].</span>"
if (fullness > (550 * (1 + M.overeatduration / 2000))) // The more you eat - the more you can eat
M << "\red You cannot force any more of [src] to go down your throat."
M << "<span class='danger'>You cannot force any more of [src] to go down your throat.</span>"
return 0
else
if(istype(M,/mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.species.flags & IS_SYNTHETIC)
H << "\red They have a monitor for a head, where do you think you're going to put that?"
user << "<span class='danger'>They have a monitor for a head, where do you think you're going to put that?</span>"
return
var/obj/item/blocked = H.check_mouth_coverage()
if(blocked)
user << "<span class='warning'>\The [blocked] is in the way!</span>"
return
if(!istype(M, /mob/living/carbon/slime)) //If you're feeding it to someone else.
if (fullness <= (550 * (1 + M.overeatduration / 1000)))
for(var/mob/O in viewers(world.view, user))
O.show_message("\red [user] attempts to feed [M] [src].", 1)
user.visible_message("<span class='danger'>[user] attempts to feed [M] [src].</span>")
else
for(var/mob/O in viewers(world.view, user))
O.show_message("\red [user] cannot force anymore of [src] down [M]'s throat.", 1)
return 0
user.visible_message("<span class='danger'>[user] cannot force anymore of [src] down [M]'s throat.</span>")
return 0
if(!do_mob(user, M)) return
@@ -83,8 +92,7 @@
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Fed [src.name] by [M.name] ([M.ckey]) Reagents: [reagentlist(src)]</font>")
msg_admin_attack("[key_name(user)] fed [key_name(M)] with [src.name] Reagents: [reagentlist(src)] (INTENT: [uppertext(user.a_intent)])")
for(var/mob/O in viewers(world.view, user))
O.show_message("\red [user] feeds [M] [src].", 1)
user.visible_message("<span class='danger'>[user] feeds [M] [src].</span>")
else
user << "This creature does not seem to have a mouth!"

View File

@@ -24,10 +24,15 @@
if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if(H.species.flags & IS_SYNTHETIC)
H << "\red You have a monitor for a head, where do you think you're going to put that?"
H << "<span class='danger'>You have a monitor for a head, where do you think you're going to put that?</span>"
return
var/obj/item/blocked = H.check_mouth_coverage()
if(blocked)
user << "<span class='warning'>\The [blocked] is in the way!</span>"
return
M << "\blue You swallow [src]."
M << "<span class='notice'>You swallow [src].</span>"
M.drop_from_inventory(src) //icon update
if(reagents.total_volume)
reagents.trans_to_ingest(M, reagents.total_volume)
@@ -40,17 +45,20 @@
var/mob/living/carbon/human/H = M
if(H.species.flags & IS_SYNTHETIC)
H << "\red They have a monitor for a head, where do you think you're going to put that?"
user << "<span class='danger'>They have a monitor for a head, where do you think you're going to put that?</span>"
return
var/obj/item/blocked = H.check_mouth_coverage()
if(blocked)
user << "<span class='warning'>\The [blocked] is in the way!</span>"
return
for(var/mob/O in viewers(world.view, user))
O.show_message("\red [user] attempts to force [M] to swallow [src].", 1)
user.visible_message("<span class='danger'>[user] attempts to force [M] to swallow [src].</span>")
if(!do_mob(user, M)) return
user.drop_from_inventory(src) //icon update
for(var/mob/O in viewers(world.view, user))
O.show_message("\red [user] forces [M] to swallow [src].", 1)
user.visible_message("<span class='danger'>[user] forces [M] to swallow [src].</span>")
M.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been fed [src.name] by [user.name] ([user.ckey]) Reagents: [reagentlist(src)]</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Fed [M.name] by [M.name] ([M.ckey]) Reagents: [reagentlist(src)]</font>")