Ports Baystation's handling of monkey/human NPCs. (#7892)

Human NPCs and monkeys now have some more interactions. Monkeys can now take items and throw them. Or shoot guns. Or activate things.
This commit is contained in:
Matt Atlas
2020-01-06 20:23:05 +01:00
committed by GitHub
parent b50b0093e9
commit 328021a8dc
9 changed files with 143 additions and 3 deletions
+1 -1
View File
@@ -317,7 +317,7 @@ var/list/slot_equipment_priority = list( \
/mob/living/carbon/throw_item(atom/target)
src.throw_mode_off()
if(usr.stat || !target)
if(stat || !target)
return
if(target.type == /obj/screen) return
@@ -41,4 +41,51 @@
zombie_type = "Zombie"
base_color = "#25032"
character_color_presets = list("Dark" = "#000000", "Warm" = "#250302", "Cold" = "#1e1e29")
character_color_presets = list("Dark" = "#000000", "Warm" = "#250302", "Cold" = "#1e1e29")
/datum/species/human/handle_npc(var/mob/living/carbon/human/H)
if(H.stat != CONSCIOUS)
return
if(H.get_shock() && H.shock_stage < 40 && prob(3))
H.emote(pick("moan","groan"))
if(H.shock_stage > 10 && prob(3))
H.emote(pick("cry","whimper"))
if(H.shock_stage >= 40 && prob(3))
H.emote("scream")
if(!H.restrained() && H.lying && H.shock_stage >= 60 && prob(3))
H.custom_emote("thrashes in agony")
if(!H.restrained() && H.shock_stage < 40 && prob(3))
var/maxdam = 0
var/obj/item/organ/external/damaged_organ = null
for(var/obj/item/organ/external/E in H.organs)
if(!E.can_feel_pain())
continue
var/dam = E.get_damage()
// make the choice of the organ depend on damage,
// but also sometimes use one of the less damaged ones
if(dam > maxdam && (maxdam == 0 || prob(50)) )
damaged_organ = E
maxdam = dam
var/datum/gender/T = gender_datums[H.get_gender()]
if(damaged_organ)
if(damaged_organ.status & ORGAN_BLEEDING)
H.custom_emote("clutches [T.his] [damaged_organ.name], trying to stop the blood.")
else if(damaged_organ.status & ORGAN_BROKEN)
H.custom_emote("holds [T.his] [damaged_organ.name] carefully.")
else if(damaged_organ.burn_dam > damaged_organ.brute_dam && damaged_organ.organ_tag != BP_HEAD)
H.custom_emote("blows on [T.his] [damaged_organ.name] carefully.")
else
H.custom_emote("rubs [T.his] [damaged_organ.name] carefully.")
for(var/obj/item/organ/I in H.internal_organs)
if((I.status & ORGAN_DEAD) || BP_IS_ROBOTIC(I))
continue
if(I.damage > 2)
if(prob(2))
var/obj/item/organ/external/parent = H.get_organ(I.parent_organ)
H.custom_emote("clutches [T.his] [parent.name]!")
@@ -48,14 +48,49 @@
pass_flags = PASSTABLE
holder_type = /obj/item/holder/monkey
var/static/list/no_touchie = list(/obj/item/mirror)
/datum/species/monkey/handle_npc(var/mob/living/carbon/human/H)
if(H.stat != CONSCIOUS)
return
if(prob(33) && H.canmove && isturf(H.loc) && !H.pulledby) //won't move if being pulled
if(prob(33) && isturf(H.loc) && !H.pulledby) //won't move if being pulled
step(H, pick(cardinal))
var/obj/held = H.get_active_hand()
if(held && prob(1))
var/turf/T = get_random_turf_in_range(H, 7, 2)
if(T)
if(istype(held, /obj/item/gun) && prob(80))
var/obj/item/gun/G = held
G.Fire(T, H)
else
H.throw_item(T)
else
H.drop_item()
if(!held && !H.restrained() && prob(5))
var/list/touchables = list()
for(var/obj/O in range(1,get_turf(H)))
if(O.simulated && O.Adjacent(H) && !is_type_in_list(O, no_touchie))
touchables += O
if(touchables.len)
var/obj/touchy = pick(touchables)
touchy.attack_hand(H)
if(prob(1))
H.emote(pick("scratch","jump","roll","tail"))
if(H.get_shock() && H.shock_stage < 40 && prob(3))
H.custom_emote("chimpers pitifully")
if(H.shock_stage > 10 && prob(3))
H.emote(pick("cry","whimper"))
if(H.shock_stage >= 40 && prob(3))
H.emote("scream")
if(!H.restrained() && H.lying && H.shock_stage >= 60 && prob(3))
H.custom_emote("thrashes in agony")
/datum/species/monkey/get_random_name()
return "[lowertext(name)] ([rand(100,999)])"