mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 19:44:58 +01:00
Basic Wumborian Fugu & Fugu Gland (#73415)
## About The Pull Request Fixes #72677 and also converted the "Wumborian Fugu" mob to a basic mob rather than a simple one. I will be totally honest: I didn't need to do that in order to fix the bug. I just didn't like looking at the rest of the code in that file. Also I have some kind of sickness which makes me do this. This ended up being one of those "see something related and fix it as well" ones so there's a couple of only tangentially related changes in here. If you want me to split it up I will but I think this one is _probably_ fine because the wide-ranging changes are pretty simple ones? So what this PR does is: - Refactors simple mob into basic mob. - Cleans up its really ugly ability to work in a hopefully nicer way. - A one line fix to the linked issue above. - Modifies the default cooldown on `basic_melee_attack` and `attack_obstructions` to be a widely used cooldown rather than a random value used by no mob that we have. - Renamed behaviour "try_mob_ability" to "targeted_mob_ability" and added a new AI behaviour called "use_mob_ability", the difference between the two being that the former requires a target and the latter does not. I... don't actually use this because I realised after adding it that I still want a target for this mob, but someone will need it eventually. - Change everywhere that is passing references to abilities to actions to pass weak references instead. - Adds an element to handle "spawn this stuff when a related mob dies". - Found a few places where people were setting `environment_smash ` as if it did anything (including me) and replaced them with the proper ai_controller implementation instead, updated the comment to make it clearer although that won't prevent copy/paste errors. - Registered to the "movement speed updated" signal to ensure that basic mobs actually notice that you have applied a movement speed modifier. ## Why It's Good For The Game Fixes a linked issue. Refactors some code which made me sad whenever I saw it. Restores some mob behaviour which nobody noticed was missing, but was. Fixes some apparently unreliable code I added in a recent PR reliant on basic mobs using movespeed modifiers. Adds element we will definitely need again in the future. ## Changelog 🆑 fix: The Fugu Gland can once more be used on Ian, Carp, Giant Spiders, or other basic mobs. fix: Syndicate mobs will once again attack windows to try to reach you, and space ruin spiders won't. fix: Netherworld-themed mobs will correctly adjust their speed as they take damage. refactor: Made the Wumborian Fugu into a basic mob, which should act largely the same way but may have slightly different speed and reaction times. /🆑
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
/// Something is in our way, get it outta here
|
||||
/datum/ai_behavior/attack_obstructions
|
||||
action_cooldown = 1 SECONDS
|
||||
action_cooldown = 2 SECONDS
|
||||
/// If we should attack walls, be prepared for complaints about breaches
|
||||
var/can_attack_turfs = FALSE
|
||||
/// Tries to bump open airlocks with an attack
|
||||
|
||||
+6
-7
@@ -1,13 +1,13 @@
|
||||
/// Attempts to use a mob ability on a target
|
||||
/datum/ai_planning_subtree/targetted_mob_ability
|
||||
/datum/ai_planning_subtree/targeted_mob_ability
|
||||
/// Blackboard key for the ability
|
||||
var/ability_key
|
||||
/// Blackboard key for where the target ref is stored
|
||||
var/target_key = BB_BASIC_MOB_CURRENT_TARGET
|
||||
/// Behaviour to perform using ability
|
||||
var/use_ability_behaviour = /datum/ai_behavior/try_mob_ability
|
||||
var/use_ability_behaviour = /datum/ai_behavior/targeted_mob_ability
|
||||
|
||||
/datum/ai_planning_subtree/targetted_mob_ability/SelectBehaviors(datum/ai_controller/controller, delta_time)
|
||||
/datum/ai_planning_subtree/targeted_mob_ability/SelectBehaviors(datum/ai_controller/controller, delta_time)
|
||||
if (!ability_key)
|
||||
CRASH("You forgot to tell this mob where to find its ability")
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
if (QDELETED(target))
|
||||
return
|
||||
|
||||
var/datum/action/cooldown/using_action = controller.blackboard[ability_key]
|
||||
if (QDELETED(using_action))
|
||||
return
|
||||
if (!using_action.IsAvailable())
|
||||
var/datum/weakref/weak_ability = controller.blackboard[ability_key]
|
||||
var/datum/action/cooldown/using_action = weak_ability?.resolve()
|
||||
if (!using_action || !using_action.IsAvailable())
|
||||
return
|
||||
|
||||
controller.queue_behavior(use_ability_behaviour, ability_key, target_key)
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Simple behaviours which simply try to use an ability whenever it is available.
|
||||
* For something which wants a target try `targetted_mob_ability`.
|
||||
*/
|
||||
/datum/ai_planning_subtree/use_mob_ability
|
||||
/// Blackboard key for the ability
|
||||
var/ability_key
|
||||
/// Behaviour to perform using ability
|
||||
var/use_ability_behaviour = /datum/ai_behavior/use_mob_ability
|
||||
/// If true we terminate planning after trying to use the ability.
|
||||
var/finish_planning = FALSE
|
||||
|
||||
/datum/ai_planning_subtree/use_mob_ability/SelectBehaviors(datum/ai_controller/controller, delta_time)
|
||||
if (!ability_key)
|
||||
CRASH("You forgot to tell this mob where to find its ability")
|
||||
|
||||
var/datum/weakref/weak_ability = controller.blackboard[ability_key]
|
||||
var/datum/action/cooldown/using_action = weak_ability?.resolve()
|
||||
if (!using_action || !using_action.IsAvailable())
|
||||
return
|
||||
|
||||
controller.queue_behavior(use_ability_behaviour, ability_key)
|
||||
if (finish_planning)
|
||||
return SUBTREE_RETURN_FINISH_PLANNING
|
||||
|
||||
/datum/ai_behavior/use_mob_ability
|
||||
|
||||
/datum/ai_behavior/use_mob_ability/perform(delta_time, datum/ai_controller/controller, ability_key)
|
||||
var/datum/weakref/weak_ability = controller.blackboard[ability_key]
|
||||
var/datum/action/cooldown/using_action = weak_ability?.resolve()
|
||||
if (!using_action)
|
||||
finish_action(controller, FALSE, ability_key)
|
||||
return
|
||||
var/result = using_action.Trigger()
|
||||
finish_action(controller, result, ability_key)
|
||||
Reference in New Issue
Block a user