-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'human-ai' into human-ai
- Loading branch information
Showing
13 changed files
with
115 additions
and
34 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
7 changes: 7 additions & 0 deletions
7
code/modules/mob/living/carbon/human/ai/action_datums/approach_target_carefully.dm
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 @@ | ||
/datum/ongoing_action/approach_target/carefully | ||
name = "Approach Target Carefully" | ||
|
||
/datum/ongoing_action/approach_target/carefully/trigger_action() | ||
if(brain.current_target) | ||
return ONGOING_ACTION_COMPLETED | ||
. = ..() |
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
40 changes: 40 additions & 0 deletions
40
code/modules/mob/living/carbon/human/ai/action_datums/retreat_from_target.dm
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,40 @@ | ||
/datum/ongoing_action/retreat_from_target | ||
name = "Retreat From Target" | ||
var/atom/movable/target | ||
var/acceptable_distance | ||
var/do_target_dead | ||
|
||
/datum/ongoing_action/retreat_from_target/New(datum/human_ai_brain/brain, list/arguments) | ||
. = ..() | ||
target = arguments[2] | ||
acceptable_distance = arguments[3] | ||
do_target_dead = length(arguments) < 4 ? TRUE : arguments[4] | ||
|
||
/datum/ongoing_action/retreat_from_target/Destroy(force, ...) | ||
target = null | ||
return ..() | ||
|
||
/datum/ongoing_action/retreat_from_target/trigger_action() | ||
if(QDELETED(target)) | ||
return ONGOING_ACTION_COMPLETED | ||
|
||
if(ismob(target) && do_target_dead) | ||
var/mob/M = target | ||
if(M.is_dead()) | ||
return ONGOING_ACTION_COMPLETED | ||
|
||
if(get_dist(target, brain.tied_human) < acceptable_distance) | ||
var/relative_dir = Get_Compass_Dir(target, brain.tied_human) | ||
var/moved = FALSE | ||
for(var/D in list(relative_dir, turn(relative_dir, 90), turn(relative_dir, -90))) | ||
if(brain.move_to_next_turf(get_step(get_turf(brain.tied_human), D))) | ||
moved = TRUE | ||
break | ||
|
||
if(!moved) | ||
return ONGOING_ACTION_COMPLETED | ||
|
||
if(get_dist(target, brain.tied_human) < acceptable_distance) | ||
return ONGOING_ACTION_UNFINISHED | ||
|
||
return ONGOING_ACTION_COMPLETED |
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