Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Nov 2, 2023
1 parent 621c3fa commit f09a094
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 72 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define XENO_HITS_TO_DESTROY_WINDOW_FRAME 3
#define XENO_HITS_TO_DESTROY_R_WINDOW_FRAME 5
#define XENO_HITS_TO_DESTROY_BOLTED_DOOR 10
#define XENO_HITS_TO_DESTROY_DOOR 10
#define XENO_HITS_TO_DESTROY_WELDED_DOOR 15
#define XENO_HITS_TO_EXPOSE_WIRES_MIN 3
#define XENO_HITS_TO_EXPOSE_WIRES_MAX 4
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define DISTANCE_PENALTY 1
#define ASTAR_COST_FUNCTION(n) (abs(n.x - target.x)+abs(n.y - target.y))

#define OPEN_TURF_PENALTY 1
#define DOOR_PENALTY 3
#define OBJECT_PENALTY 20
#define HUMAN_PENALTY 4
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/living/carbon/xenomorph/ai/xeno_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ GLOBAL_LIST_INIT(ai_target_limbs, list(
// Called whenever an obstacle is encountered but xeno_ai_obstacle returned something else than infinite
// and now it is considered a valid path.
/atom/proc/xeno_ai_act(mob/living/carbon/xenomorph/X)
return
X.do_click(src, "", list())
return TRUE

/mob/living/carbon/xenomorph/proc/can_move_and_apply_move_delay()
// Unable to move, try next time.
Expand Down
44 changes: 20 additions & 24 deletions code/modules/mob/living/carbon/xenomorph/attack_alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -517,46 +517,42 @@
//Prying open doors
/obj/structure/machinery/door/airlock/attack_alien(mob/living/carbon/xenomorph/M)
var/turf/cur_loc = M.loc
if(isElectrified())
if(shock(M, 100))
return XENO_NO_DELAY_ACTION

. = XENO_NO_DELAY_ACTION

if(M.claw_type >= CLAW_TYPE_SHARP)
M.animation_attack_on(src)
playsound(src, 'sound/effects/metalhit.ogg', 25, 1)
take_damage(damage_cap / XENO_HITS_TO_DESTROY_DOOR)
. = XENO_ATTACK_ACTION

if(isElectrified() && shock(M, 100))
return

if(!density)
to_chat(M, SPAN_WARNING("[src] is already open!"))
return XENO_NO_DELAY_ACTION
return

if(heavy)
to_chat(M, SPAN_WARNING("[src] is too heavy to open."))
return XENO_NO_DELAY_ACTION
return

if(welded)
if(M.claw_type >= CLAW_TYPE_SHARP)
M.animation_attack_on(src)
playsound(src, 'sound/effects/metalhit.ogg', 25, 1)
take_damage(damage_cap / XENO_HITS_TO_DESTROY_WELDED_DOOR)
return XENO_ATTACK_ACTION
else
to_chat(M, SPAN_WARNING("[src] is welded shut."))
return XENO_NO_DELAY_ACTION
to_chat(M, SPAN_WARNING("[src] is welded shut."))
return

if(locked)
if(M.claw_type >= CLAW_TYPE_SHARP)
M.animation_attack_on(src)
playsound(src, 'sound/effects/metalhit.ogg', 25, 1)
take_damage(HEALTH_DOOR / XENO_HITS_TO_DESTROY_BOLTED_DOOR)
return XENO_ATTACK_ACTION
else
to_chat(M, SPAN_WARNING("[src] is bolted down tight."))
return XENO_NO_DELAY_ACTION
to_chat(M, SPAN_WARNING("[src] is bolted down tight."))
return

if(!istype(cur_loc))
return XENO_NO_DELAY_ACTION //Some basic logic here
return //Some basic logic here

if(M.action_busy)
return XENO_NO_DELAY_ACTION
return

if(M.lying)
return XENO_NO_DELAY_ACTION
return

var/delay

Expand Down
116 changes: 69 additions & 47 deletions code/modules/mob/living/carbon/xenomorph/xeno_ai_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,50 @@ At bare minimum, make sure the relevant checks from parent types gets copied in
*/// - Morrow

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

if(!density)
return 0

if(unslashable && !climbable)
return

return OBJECT_PENALTY

/obj/structure/xeno_ai_act(mob/living/carbon/xenomorph/X)
if(unslashable)
if(!X.action_busy)
do_climb(X)
return

return ..()

// MINERAL DOOR
/obj/structure/mineral_door/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
return DOOR_PENALTY

/obj/structure/mineral_door/xeno_ai_act(mob/living/carbon/xenomorph/X)
X.do_click(src, "", list())
return TRUE

/obj/structure/mineral_door/resin/xeno_ai_obstacle(mob/living/carbon/xenomorph/xeno, direction, turf/target)
if(xeno.hivenumber != hivenumber)
return ..()
return 0

/obj/structure/mineral_door/resin/xeno_ai_act(mob/living/carbon/xenomorph/acting_xeno)
acting_xeno.a_intent = INTENT_HELP
if(xeno.hivenumber == hivenumber)
acting_xeno.a_intent = INTENT_HELP
. = ..()

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

return DOOR_PENALTY

// Poddoors/shutters
/obj/structure/machinery/door/poddoor/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
Expand Down Expand Up @@ -61,60 +87,34 @@ At bare minimum, make sure the relevant checks from parent types gets copied in

return DOOR_PENALTY

/obj/structure/machinery/door/xeno_ai_act(mob/living/carbon/xenomorph/X)
X.do_click(src, "", list())
return TRUE

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

if(!density)
return 0

if(unslashable && !climbable)
return

return OBJECT_PENALTY

/obj/structure/xeno_ai_act(mob/living/carbon/xenomorph/X)
if(unslashable)
if(!X.action_busy)
do_climb(X)
return
X.do_click(src, "", list())
return TRUE


// HUMANS
/mob/living/carbon/human/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
if(status_flags & GODMODE)
return ..()

return HUMAN_PENALTY

/mob/living/carbon/human/xeno_ai_act(mob/living/carbon/xenomorph/X)
if(status_flags & GODMODE)
return ..()
X.do_click(src, "", list())
return TRUE
return

. = ..()

// VEHICLES
/obj/vehicle/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
return VEHICLE_PENALTY
. = ..()
if(!.)
return

/obj/vehicle/xeno_ai_act(mob/living/carbon/xenomorph/X)
X.do_click(src, "", list())
return TRUE
return VEHICLE_PENALTY

// SENTRY
/obj/structure/machinery/defenses/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
return VEHICLE_PENALTY
. = ..()
if(!.)
return

/obj/structure/machinery/defenses/xeno_ai_act(mob/living/carbon/xenomorph/X)
X.do_click(src, "", list())
return TRUE
return VEHICLE_PENALTY

// WINDOW FRAME
/obj/structure/window_frame/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
Expand All @@ -127,8 +127,19 @@ At bare minimum, make sure the relevant checks from parent types gets copied in
if(!X.action_busy)
do_climb(X)

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

return DOOR_PENALTY

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

return BARRICADE_PENALTY

// FIRE
Expand All @@ -138,7 +149,18 @@ At bare minimum, make sure the relevant checks from parent types gets copied in

return FIRE_PENALTY

// HOLES
/obj/effect/acid_hole/xeno_ai_act(mob/living/carbon/xenomorph/X)
X.do_click(src, "", list())
return TRUE
/// Open turfs, sometimes open turfs are passed back as obstacles due to platforms and such, generally it's fast so very slight penalty mainly for handling subtypes properly
/turf/open/xeno_ai_obstacle(mob/living/carbon/xenomorph/X, direction, turf/target)
. = ..()
if(!.)
return

return OPEN_TURF_PENALTY

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

return INFINITY

0 comments on commit f09a094

Please sign in to comment.