Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI tweaks and fixes #164

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/__DEFINES/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

#define OPEN_TURF_PENALTY 1
#define DOOR_PENALTY 3
#define OBJECT_PENALTY 20
#define HUMAN_PENALTY 4
#define XENO_PENALTY 20
#define VEHICLE_PENALTY 25
#define OBJECT_PENALTY 20
#define FIRE_PENALTY 25
#define SENTRY_PENALTY 25
#define VEHICLE_PENALTY 25
#define WINDOW_FRAME_PENALTY 25
#define BARRICADE_PENALTY 50
#define WALL_PENALTY 50
#define FIRE_PENALTY 25

/*
PROBABILITY CALCULATIONS ARE HERE
Expand Down Expand Up @@ -90,7 +90,7 @@ PROBABILITY CALCULATIONS ARE HERE


/// Special blockers for pathfinding or obstacle handling
#define XENO_AI_SPECIAL_BLOCKERS list(/obj/flamer_fire, /obj/vehicle/multitile, /turf/open/space)
#define XENO_AI_SPECIAL_BLOCKERS list(/obj/flamer_fire, /obj/vehicle/multitile, /turf/open/space, /turf/open/gm/river)

// Friend-or-foe universal check
#define IS_SAME_HIVENUMBER(A,B) (A.hivenumber == B.hivenumber)
7 changes: 4 additions & 3 deletions code/controllers/subsystem/pathfinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ SUBSYSTEM_DEF(xeno_pathfinding)
/datum/controller/subsystem/xeno_pathfinding/proc/check_special_blockers(mob/living/carbon/xenomorph/xeno, turf/checking_turf)
var/list/pass_back = list()

pass_back += (checking_turf.type in XENO_AI_SPECIAL_BLOCKERS) ? checking_turf : list()
for(var/spec_blocker in XENO_AI_SPECIAL_BLOCKERS)
pass_back += istype(checking_turf, spec_blocker) ? checking_turf : list()

for(var/atom/checked_atom as anything in checking_turf)
pass_back += (checked_atom.type in XENO_AI_SPECIAL_BLOCKERS) ? checked_atom : list()
for(var/atom/checked_atom as anything in checking_turf)
pass_back += istype(checked_atom, spec_blocker) ? checked_atom : list()

return pass_back

Expand Down
6 changes: 0 additions & 6 deletions code/game/machinery/doors/poddoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
var/base_icon_state = "pdoor"
id = 1
dir = NORTH
unslashable = TRUE
health = 0
layer = PODDOOR_CLOSED_LAYER
open_layer = PODDOOR_OPEN_LAYER
Expand Down Expand Up @@ -253,13 +252,11 @@
name = ""
icon = null
icon_state = ""
unslashable = TRUE
unacidable = TRUE

/obj/structure/machinery/door/poddoor/two_tile/four_tile/secure
icon = 'icons/obj/structures/doors/1x4blast_hor_secure.dmi'
openspeed = 17
unslashable = TRUE
unacidable = TRUE

/obj/structure/machinery/door/poddoor/two_tile/four_tile/secure/opened
Expand All @@ -268,7 +265,6 @@
/obj/structure/machinery/door/poddoor/two_tile/four_tile/vertical/secure
icon = 'icons/obj/structures/doors/1x4blast_vert_secure.dmi'
openspeed = 17
unslashable = TRUE
unacidable = TRUE

/obj/structure/machinery/door/poddoor/two_tile/four_tile/vertical/secure/open
Expand All @@ -286,7 +282,6 @@
/obj/structure/machinery/door/poddoor/two_tile/secure
icon = 'icons/obj/structures/doors/1x2blast_hor.dmi'
openspeed = 17
unslashable = TRUE
unacidable = TRUE

/obj/structure/machinery/door/poddoor/two_tile/vertical/secure
Expand Down Expand Up @@ -325,7 +320,6 @@
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, relativewall_neighbours)), 10)

/obj/structure/machinery/door/poddoor/almayer/locked
unslashable = TRUE
unacidable = TRUE

/obj/structure/machinery/door/poddoor/almayer/locked/attackby(obj/item/C as obj, mob/user as mob)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

if(idle_xeno.move_to_next_turf(home_turf, home_locate_range))
if(get_dist(home_turf, idle_xeno) <= 0)
idle_xeno.set_resting(TRUE, FALSE, TRUE)
idle_xeno.set_resting(TRUE, FALSE)
else
home_turf = null

Expand Down
48 changes: 40 additions & 8 deletions code/modules/mob/living/carbon/xenomorph/xeno_ai_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ At bare minimum, make sure the relevant checks from parent types gets copied in

return


/////////////////////////////
// MOBS //
/////////////////////////////
Expand Down Expand Up @@ -218,7 +219,7 @@ At bare minimum, make sure the relevant checks from parent types gets copied in
if(!.)
return

return VEHICLE_PENALTY
return SENTRY_PENALTY


/////////////////////////////
Expand All @@ -229,13 +230,6 @@ At bare minimum, make sure the relevant checks from parent types gets copied in
return ..()
return WINDOW_FRAME_PENALTY

/obj/structure/barricade/handrail/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!.)
return

return DOOR_PENALTY


/////////////////////////////
// BARRICADES //
Expand All @@ -247,6 +241,13 @@ At bare minimum, make sure the relevant checks from parent types gets copied in

return BARRICADE_PENALTY

/obj/structure/barricade/handrail/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!.)
return

return DOOR_PENALTY


/////////////////////////////
// FIRE //
Expand All @@ -258,6 +259,17 @@ At bare minimum, make sure the relevant checks from parent types gets copied in
return FIRE_PENALTY


/////////////////////////////
// WALLS //
/////////////////////////////
/turf/closed/wall/resin/xeno_ai_obstacle(mob/living/carbon/xenomorph/xeno, direction, turf/target)
. = ..()
if(!.)
return

return WALL_PENALTY


/////////////////////////////
// FLOOR //
/////////////////////////////
Expand All @@ -272,10 +284,30 @@ At bare minimum, make sure the relevant checks from parent types gets copied in

return OPEN_TURF_PENALTY

/// For now there is no attack_alien() proc overrides on any child of /turf/open
/// Also, we don't want xenos swiping all around - forbit the clicking!
/turf/open/xeno_ai_act(mob/living/carbon/xenomorph/X)
return FALSE

/// Space, do NOT path into space.
/turf/open/space/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!.)
return

return INFINITY


/////////////////////////////
// RIVER //
/////////////////////////////
/turf/open/gm/river/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!. && !covered)
. *= base_river_slowdown
morrowwolf marked this conversation as resolved.
Show resolved Hide resolved

/turf/open/gm/river/desert/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
if(toxic && !covered)
return FIRE_PENALTY

return ..()
Loading