forked from Fluffy-Frontier/FluffySTG
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Basic Mob Gorillas [MDB IGNORE] (#24284)
* Basic Mob Gorillas (#78918) Now we can make basic mobs with hands easily so I did, they don't actually use their hands for anything with AI. In the future we can come back and share the monkey AI where they pick up items to hit people with, but frankly few weapons are more deadly than a gorilla's fists. IIRC I didn't really change their behaviour much, this is mostly just a straight conversion. Main difference is that they will prioritise eating nearby bananas and fruit salads over punching people. When I make these conversions nowadays I need to decide between "does this attack at the speed that it did as an NPC mob or the speed it did as a player?" I am arbitrarily deciding that gorillas are usually not players and electing for the former, but tell me if you disagree. I also made "show basic inhand sprites" into a component shared by Gorillas, Drones, and Dextrous Guardians (all also now available to become basic, once I get around to it), And I added an AI behaviour to run a basic emote. This is similar but different to "random speech", which kind of sucks and needs rewriting anyway. Gorillas don't speak, only ooga. https://www.youtube.com/watch?v=npuuTBlEb1U 🆑 refactor: Gorillas now use the basic mob framework. Please report any unusual side effects. /🆑 * Basic Mob Gorillas * Modular paths --------- Co-authored-by: Jacquerel <[email protected]> Co-authored-by: Giz <[email protected]>
- Loading branch information
Showing
40 changed files
with
399 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/// Intermittently run an emote | ||
/datum/ai_planning_subtree/run_emote | ||
var/emote_key = BB_EMOTE_KEY | ||
var/emote_chance_key = BB_EMOTE_CHANCE | ||
|
||
/datum/ai_planning_subtree/run_emote/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) | ||
var/emote_chance = controller.blackboard[emote_chance_key] || 0 | ||
if (!SPT_PROB(emote_chance, seconds_per_tick)) | ||
return | ||
controller.queue_behavior(/datum/ai_behavior/run_emote, emote_key) | ||
|
||
/// Emote from a blackboard key | ||
/datum/ai_behavior/run_emote | ||
|
||
/datum/ai_behavior/run_emote/perform(seconds_per_tick, datum/ai_controller/controller, emote_key) | ||
var/mob/living/living_pawn = controller.pawn | ||
if (!isliving(living_pawn)) | ||
finish_action(controller, FALSE) | ||
return | ||
|
||
var/list/emote_list = controller.blackboard[emote_key] | ||
var/emote | ||
if (islist(emote_list)) | ||
emote = length(emote_list) ? pick(emote_list) : null | ||
else | ||
emote = emote_list | ||
|
||
if(isnull(emote)) | ||
finish_action(controller, FALSE) | ||
return | ||
|
||
living_pawn.emote(emote) | ||
finish_action(controller, TRUE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Basic handling for showing held items in a mob's hands | ||
*/ | ||
/datum/component/basic_inhands | ||
/// Layer index we show our inhands upon | ||
var/display_layer | ||
/// Y offset to apply to inhands | ||
var/y_offset | ||
/// X offset to apply to inhands, is inverted for the left hand | ||
var/x_offset | ||
/// What overlays are we currently showing? | ||
var/list/cached_overlays | ||
|
||
/datum/component/basic_inhands/Initialize(display_layer = 1, y_offset = 0, x_offset = 0) | ||
. = ..() | ||
if (!isliving(parent)) | ||
return COMPONENT_INCOMPATIBLE | ||
src.display_layer = display_layer | ||
src.y_offset = y_offset | ||
src.x_offset = x_offset | ||
cached_overlays = list() | ||
|
||
/datum/component/basic_inhands/RegisterWithParent() | ||
. = ..() | ||
RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, PROC_REF(on_updated_overlays)) | ||
RegisterSignal(parent, COMSIG_MOB_UPDATE_HELD_ITEMS, PROC_REF(on_updated_held_items)) | ||
|
||
/datum/component/basic_inhands/UnregisterFromParent() | ||
. = ..() | ||
UnregisterSignal(parent, list(COMSIG_ATOM_UPDATE_OVERLAYS, COMSIG_MOB_UPDATE_HELD_ITEMS)) | ||
|
||
/// When your overlays update, add your held overlays | ||
/datum/component/basic_inhands/proc/on_updated_overlays(atom/parent_atom, list/overlays) | ||
SIGNAL_HANDLER | ||
overlays += cached_overlays | ||
|
||
/// When your number of held items changes, regenerate held icons | ||
/datum/component/basic_inhands/proc/on_updated_held_items(mob/living/holding_mob) | ||
SIGNAL_HANDLER | ||
var/list/held_overlays = list() | ||
for(var/obj/item/held in holding_mob.held_items) | ||
var/is_right = holding_mob.get_held_index_of_item(held) % 2 == 0 | ||
var/icon_file = is_right ? held.righthand_file : held.lefthand_file | ||
var/mutable_appearance/held_overlay = held.build_worn_icon(default_layer = HANDS_LAYER, default_icon_file = icon_file, isinhands = TRUE) | ||
held_overlay.pixel_y += y_offset | ||
held_overlay.pixel_x += x_offset * (is_right ? 1 : -1) | ||
held_overlays += held_overlay | ||
|
||
cached_overlays = held_overlays | ||
holding_mob.update_appearance(UPDATE_OVERLAYS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.