-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaking up AI files to integrate bot behaviors.
- Loading branch information
1 parent
0000458
commit 779bb4c
Showing
34 changed files
with
406 additions
and
623 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Enemy tracking - used on /aggressive | ||
/datum/mob_controller/proc/get_enemies() | ||
return _enemies | ||
|
||
/datum/mob_controller/proc/add_enemy(mob/enemy) | ||
if(istype(enemy)) | ||
LAZYDISTINCTADD(_enemies, weakref(enemy)) | ||
|
||
/datum/mob_controller/proc/add_enemies(list/enemies) | ||
for(var/thing in enemies) | ||
if(ismob(thing)) | ||
add_friend(thing) | ||
else if(istype(thing, /weakref)) | ||
LAZYDISTINCTADD(_enemies, thing) | ||
|
||
/datum/mob_controller/proc/remove_enemy(mob/enemy) | ||
LAZYREMOVE(_enemies, weakref(enemy)) | ||
|
||
/datum/mob_controller/proc/set_enemies(list/new_enemies) | ||
_enemies = new_enemies | ||
|
||
/datum/mob_controller/proc/is_enemy(mob/enemy) | ||
. = istype(enemy) && LAZYLEN(_enemies) && (weakref(enemy) in _enemies) | ||
|
||
/datum/mob_controller/proc/clear_enemies() | ||
LAZYCLEARLIST(_enemies) | ||
|
||
/datum/mob_controller/proc/retaliate(atom/source) | ||
SHOULD_CALL_PARENT(TRUE) | ||
if(!istype(body) || body.stat == DEAD) | ||
return FALSE | ||
startle() | ||
if(isliving(source)) | ||
remove_friend(source) | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/datum/mob_controller/proc/pacify(mob/user) | ||
lose_target() | ||
add_friend(user) | ||
|
||
// Friend tracking - used on /aggressive. | ||
/datum/mob_controller/proc/get_friends() | ||
return _friends | ||
|
||
/datum/mob_controller/proc/add_friend(mob/friend) | ||
if(istype(friend)) | ||
LAZYDISTINCTADD(_friends, weakref(friend)) | ||
return TRUE | ||
return FALSE | ||
|
||
/datum/mob_controller/proc/remove_friend(mob/friend) | ||
LAZYREMOVE(_friends, weakref(friend)) | ||
|
||
/datum/mob_controller/proc/set_friends(list/new_friends) | ||
_friends = new_friends | ||
|
||
/datum/mob_controller/proc/is_friend(mob/friend) | ||
. = istype(friend) && LAZYLEN(_friends) && (weakref(friend) in _friends) | ||
|
||
/datum/mob_controller/proc/clear_friends() | ||
LAZYCLEARLIST(_friends) |
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,7 @@ | ||
// General-purpose memorise proc, used by /commanded | ||
/datum/mob_controller/proc/memorise(mob/speaker, message) | ||
return | ||
|
||
// General-purpose memory checking proc, used by /faithful_hound | ||
/datum/mob_controller/proc/check_memory(mob/speaker, message) | ||
return FALSE |
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,27 @@ | ||
/datum/mob_controller/proc/can_do_automated_move(variant_move_delay) | ||
return body && !body.client | ||
|
||
/datum/mob_controller/proc/clear_paths() | ||
clear_path() | ||
|
||
/datum/mob_controller/proc/clear_path() | ||
executing_path = null | ||
body?.stop_automove() | ||
|
||
/datum/mob_controller/proc/get_automove_target(datum/automove_metadata/metadata) | ||
var/turf/move_target = (islist(executing_path) && length(executing_path)) ? executing_path : null | ||
if(istype(move_target) && QDELETED(move_target)) | ||
clear_path() | ||
|
||
/datum/mob_controller/proc/handle_post_automoved(atom/old_loc) | ||
if(!islist(executing_path) || length(executing_path) <= 0) | ||
return | ||
var/turf/body_turf = get_turf(body) | ||
if(!istype(body_turf)) | ||
return | ||
if(executing_path[1] != body_turf) | ||
return | ||
if(length(executing_path) > 1) | ||
executing_path.Cut(1, 2) | ||
else | ||
clear_path() |
Oops, something went wrong.