Skip to content

Commit

Permalink
Attempt to solve mapping issues (#3)
Browse files Browse the repository at this point in the history
* Initial

* BAM
  • Loading branch information
morrowwolf committed Oct 12, 2023
1 parent 648733e commit 3ced91e
Show file tree
Hide file tree
Showing 57 changed files with 1,175 additions and 5,570 deletions.
136 changes: 0 additions & 136 deletions code/controllers/subsystem/xeno_ai.dm
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/datum/config_entry/number/eval_weight_marine
config_entry_value = 8

/datum/config_entry/number/eval_weight_xeno_t1
config_entry_value = -1

/datum/config_entry/number/eval_weight_xeno_t2
config_entry_value = -2

/datum/config_entry/number/eval_weight_xeno_t3
config_entry_value = -3

/datum/config_entry/number/eval_weight_xeno_queen
config_entry_value = -5

/datum/config_entry/number/eval_weight_offset
config_entry_value = 0

/*
/datum/config_entry/number/eval_distance_per_marine_from_hive
config_entry_value = 0.1
/datum/config_entry/number/eval_distance_per_xeno_from_hive
config_entry_value = -0.1
*/

SUBSYSTEM_DEF(xeno_ai)
name = "Xeno AI"
Expand Down Expand Up @@ -57,7 +32,6 @@ SUBSYSTEM_DEF(xeno_ai)
return

if(!resumed)
//calculate_eval()
src.current_run = ai_mobs.Copy()
// Cache for sanic speed (lists are references anyways)
var/list/current_run = src.current_run
Expand All @@ -72,35 +46,6 @@ SUBSYSTEM_DEF(xeno_ai)
if(MC_TICK_CHECK)
return


/datum/controller/subsystem/xeno_ai/proc/calculate_eval()
game_evaluation = CONFIG_GET(number/eval_weight_offset)

for(var/i in GLOB.alive_human_list)
var/mob/living/carbon/human/H = i
if(H.client && is_ground_level(H.z) && !H.is_mob_incapacitated())
game_evaluation += CONFIG_GET(number/eval_weight_marine)

for(var/i in GLOB.xeno_mob_list)
var/mob/living/carbon/xenomorph/X = i
if(X.stat)
return

switch(X.tier)
if(1)
game_evaluation += CONFIG_GET(number/eval_weight_xeno_t1)
if(2)
game_evaluation += CONFIG_GET(number/eval_weight_xeno_t1)
if(3)
game_evaluation += CONFIG_GET(number/eval_weight_xeno_t1)

if(isqueen(X))
game_evaluation += CONFIG_GET(number/eval_weight_xeno_queen)

for(var/i in GLOB.evaluation_landmarks)
var/obj/effect/landmark/eval/E = i
E.calculate_eval()

/datum/controller/subsystem/xeno_ai/proc/add_ai(mob/living/carbon/xenomorph/X)
if(X.mob_flags & AI_CONTROLLED)
return
Expand All @@ -110,84 +55,3 @@ SUBSYSTEM_DEF(xeno_ai)
/datum/controller/subsystem/xeno_ai/proc/remove_ai(mob/living/carbon/xenomorph/X)
X.mob_flags &= ~AI_CONTROLLED
ai_mobs -= X


// I'm not a good enough mapper to properly lay these out on the maps, so they'll stay like this
GLOBAL_LIST_EMPTY(evaluation_landmarks)

/area
var/list/eval_landmarks

/obj/effect/landmark/eval
name = "Evaluation Landmark"

/obj/effect/landmark/eval/Initialize(mapload, ...)
. = ..()
GLOB.evaluation_landmarks += src
var/area/A = get_area(src)
A.eval_landmarks += src

/obj/effect/landmark/eval/Destroy()
var/area/A = get_area(src)
A.eval_landmarks -= src
GLOB.evaluation_landmarks -= src
return ..()

/// Calculates the evaluation
/obj/effect/landmark/eval/proc/calculate_eval()
return 0

/obj/effect/landmark/eval/proc/calculate_eval_for_mob(mob/M)

/// A landmark that calculates evaluation depending on the marines in an area
/obj/effect/landmark/eval/marine
name = "Marine Eval Landmark"
var/eval_per_marine = 0

/obj/effect/landmark/eval/marine/calculate_eval_for_mob(mob/M)
if(ishuman(M) && M.client && !M.is_mob_incapacitated())
return eval_per_marine

/obj/effect/landmark/eval/marine/calculate_eval()
var/area/A = get_area(src)
var/eval_amount = 0
for(var/mob/living/carbon/human/H in A)
if(H.client && !H.is_mob_incapacitated())
eval_amount += eval_per_marine

return eval_amount

/obj/effect/landmark/eval/marine/bad
eval_per_marine = 0.5

/obj/effect/landmark/eval/marine/good
eval_per_marine = -0.5

/obj/effect/landmark/eval/marine/very_good
eval_per_marine = -1

/obj/effect/landmark/eval/xeno
name = "Xeno Eval Landmark"
var/eval_per_xeno

/obj/effect/landmark/eval/xeno/calculate_eval_for_mob(mob/M)
if(isxeno(M) && !M.stat)
return eval_per_xeno

/obj/effect/landmark/eval/xeno/calculate_eval()
var/area/A = get_area(src)
var/eval_amount = 0
for(var/mob/living/carbon/xenomorph/X in A)
if(!X.stat)
eval_amount += eval_per_xeno

return eval_amount

/obj/effect/landmark/eval/xeno/bad
eval_per_xeno = -0.5

/obj/effect/landmark/eval/xeno/good
eval_per_xeno = 0.5

/obj/effect/landmark/eval/xeno/very_good
eval_per_xeno = 1
Loading

0 comments on commit 3ced91e

Please sign in to comment.