Monke Business - Ports monkey AI from TG (#31067)

* Monke Mode

* Punch

* Some comment stuff

* Linters, excess

* Linters

* Emote stuff

* Pause monkey AI during do afters

* Small improvements

* Oops

* Fixes monkeys trying to drink forever from a glass

* Knockdowns and stamcrit fixes

* Removes eating/drinking from Pun Pun

* Monkey controller improvement, bug fix

* Fixes monkey item giving

* Fixes brain swaps

* Fixes

* Update code/datums/ai/monkey/monkey_controller.dm

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>

* Addresses code review

* Oops

* Oops round 2

* Fixes monkeys staying in trip mode when evolved

---------

Signed-off-by: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
PollardTheDragon
2025-12-26 22:44:52 +00:00
committed by GitHub
co-authored by Burzah
parent 82d31ab8a5
commit a590870d00
24 changed files with 1115 additions and 33 deletions
+16
View File
@@ -32,6 +32,22 @@
/mob/proc/is_holding(obj/item/I)
return istype(I) && (I == r_hand || I == l_hand)
/// Returns a list of items being held
/mob/proc/held_items()
var/list/items = list()
items += get_item_by_slot(ITEM_SLOT_LEFT_HAND)
items += get_item_by_slot(ITEM_SLOT_RIGHT_HAND)
return items
/// Returns a number corresponding to an open hand, or null if no open hands.
/mob/proc/get_empty_held_indexes()
var/list/L
var/list/held = held_items()
for(var/i in 1 to length(held))
if(!held[i])
LAZYADD(L, i)
return L
//Checks if we're holding an item of type: typepath
/mob/proc/is_holding_item_of_type(typepath)
. = FALSE
@@ -130,6 +130,14 @@
muzzled_noises = list("bothered")
emote_type = EMOTE_AUDIBLE | EMOTE_MOUTH
/datum/emote/living/carbon/human/clear_throat
key = "clear"
key_third_person = "clears throat"
message = "clears their throat."
message_mime = "silently clears their throat!"
muzzled_noises = list("clears their throat.")
emote_type = EMOTE_AUDIBLE | EMOTE_MOUTH
/datum/emote/living/carbon/human/hug
key = "hug"
key_third_person = "hugs"
@@ -215,21 +215,27 @@
/mob/living/carbon/human/monkey/Initialize(mapload)
. = ..(mapload, /datum/species/monkey)
ai_controller = new /datum/ai_controller/monkey(src)
/mob/living/carbon/human/farwa/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/tajaran)
ai_controller = new /datum/ai_controller/monkey(src)
/mob/living/carbon/human/wolpin/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/vulpkanin)
ai_controller = new /datum/ai_controller/monkey(src)
/mob/living/carbon/human/neara/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/skrell)
ai_controller = new /datum/ai_controller/monkey(src)
/mob/living/carbon/human/stok/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/unathi)
ai_controller = new /datum/ai_controller/monkey(src)
/mob/living/carbon/human/nian_worme/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/nian_worme)
ai_controller = new /datum/ai_controller/monkey(src)
/mob/living/carbon/human/moth/Initialize(mapload)
. = ..(mapload, /datum/species/moth)
@@ -45,18 +45,6 @@
if(H.radiation > RAD_MOB_GORILLIZE && prob(RAD_MOB_GORILLIZE_PROB))
H.gorillize()
/datum/species/monkey/handle_npc(mob/living/carbon/human/H)
if(H.stat != CONSCIOUS)
return
if(prob(1))
H.emote(pick("scratch","jump","roll","tail"))
if(prob(33) && (H.mobility_flags & MOBILITY_MOVE) && isturf(H.loc) && !H.pulledby) //won't move if being pulled
var/dir_to_go = pick(GLOB.cardinal)
var/turf/to_go = get_step(H, dir_to_go)
if(islava(to_go) || ischasm(to_go))
return
step(H, dir_to_go)
/datum/species/monkey/get_random_name()
return "[lowertext(name)] ([rand(100,999)])"
@@ -65,8 +53,15 @@
H.real_name = get_random_name()
H.name = H.real_name
H.butcher_results = list(/obj/item/food/meat/monkey = 5)
H.ai_controller = new /datum/ai_controller/monkey(H)
H.dna.blood_type = pick(4;"O-", 36;"O+", 3;"A-", 28;"A+", 1;"B-", 20;"B+", 1;"AB-", 5;"AB+")
/datum/species/monkey/on_species_loss(mob/living/carbon/human/H)
. = ..()
if(H.ai_controller && istype(H.ai_controller, /datum/ai_controller/monkey))
var/datum/ai_controller/monkey/controller = H.ai_controller
controller.set_trip_mode(mode = FALSE)
/datum/species/monkey/handle_dna(mob/living/carbon/human/H, remove)
..()
if(!remove)
+8
View File
@@ -24,6 +24,14 @@
message_param = "bows to %t."
message_postfix = "to %t."
/datum/emote/living/sing_tune
key = "tunesing"
key_third_person = "sings a tune"
message = "sings a tune."
message_mime = "opens their mouth rather obnoxiously."
emote_type = EMOTE_AUDIBLE
muzzled_noises = list("melodic")
/datum/emote/living/burp
key = "burp"
key_third_person = "burps"