mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
* Experiment with replacing weakrefs in AI blackboard with deleting signals, ideally making it easier to work with and harder to cause hard deletes (#74791) ## About The Pull Request Replaces weakref usage in AI blackboards with deleting signals All blackboard var setting must go through setters rather than directly ## Why It's Good For The Game This both makes it a ton easier to develop AI for, and also makes it harder for hard deletes to sneak in, as has been seen with recent 515 prs showing hard deletes in AI blackboards (To quantify "making it easier to develop AI", I found multiple bugs in existing AI code due to the usage of weakrefs.) I'm looking for `@ Jacquerel` `@ tralezab` 's opinions on the matter, also maybe `@ LemonInTheDark` if they're interested ## Changelog 🆑 Melbert refactor: Mob ai refactored once again /🆑 * Experiment with replacing weakrefs in AI blackboard with deleting signals, ideally making it easier to work with and harder to cause hard deletes --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
17 lines
647 B
Plaintext
17 lines
647 B
Plaintext
///The bat is broken!
|
|
/datum/ai_planning_subtree/bane_hunting/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick)
|
|
var/mob/living/batman = controller.blackboard[BB_BANE_BATMAN]
|
|
if(QDELETED(batman))
|
|
for(var/mob/living/possibly_the_dark_knight in oview(7, controller.pawn))
|
|
if(IS_DEAD_OR_INCAP(possibly_the_dark_knight)) //I HAVE BROKEN THE BAT
|
|
continue
|
|
controller.set_blackboard_key(BB_BANE_BATMAN, possibly_the_dark_knight)
|
|
batman = possibly_the_dark_knight
|
|
break
|
|
|
|
if(isnull(batman))
|
|
return
|
|
|
|
controller.queue_behavior(/datum/ai_behavior/break_spine/bane, BB_BANE_BATMAN)
|
|
return SUBTREE_RETURN_FINISH_PLANNING
|