Skip to content

Commit

Permalink
Merge branch 'BurgerLUA:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
IjNebula authored Oct 6, 2024
2 parents 4ee951e + f0aae47 commit 8656c73
Show file tree
Hide file tree
Showing 131 changed files with 1,161 additions and 786 deletions.
12 changes: 5 additions & 7 deletions burgerstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@
#include "code\_core\datum\ai\advanced\space_soldier.dm"
#include "code\_core\datum\ai\advanced\stand.dm"
#include "code\_core\datum\ai\advanced\syndicate.dm"
#include "code\_core\datum\ai\advanced\taxman.dm"
#include "code\_core\datum\ai\advanced\zombie.dm"
#include "code\_core\datum\ai\boss\_boss.dm"
#include "code\_core\datum\ai\boss\ai_core.dm"
Expand Down Expand Up @@ -519,7 +518,6 @@
#include "code\_core\datum\dialogue\npc\mech_fabricator.dm"
#include "code\_core\datum\dialogue\npc\merchant_goblin.dm"
#include "code\_core\datum\dialogue\npc\nanotrasen_soldier.dm"
#include "code\_core\datum\dialogue\npc\taxman.dm"
#include "code\_core\datum\dialogue\npc\wizard_ambassador.dm"
#include "code\_core\datum\dialogue\npc\job_providers\chief_engineer.dm"
#include "code\_core\datum\dialogue\npc\job_providers\chief_medical_officer.dm"
Expand Down Expand Up @@ -623,8 +621,6 @@
#include "code\_core\datum\loadout\runic.dm"
#include "code\_core\datum\loadout\shaft_miner.dm"
#include "code\_core\datum\loadout\skeleton_miner.dm"
#include "code\_core\datum\loadout\tax.dm"
#include "code\_core\datum\loadout\taxman.dm"
#include "code\_core\datum\loadout\that_guy.dm"
#include "code\_core\datum\loadout\virtual_reality.dm"
#include "code\_core\datum\loadout\witch_hunter.dm"
Expand Down Expand Up @@ -656,12 +652,14 @@
#include "code\_core\datum\loadout\syndicate\_syndicate.dm"
#include "code\_core\datum\loadout\syndicate\antagonist.dm"
#include "code\_core\datum\loadout\wizard\_wizard.dm"
#include "code\_core\datum\loadout\wizard\raging_mage.dm"
#include "code\_core\datum\loadout\zombie\_zombie.dm"
#include "code\_core\datum\loadout\zombie\zombie_armored.dm"
#include "code\_core\datum\loadout\zombie\zombie_bloated.dm"
#include "code\_core\datum\loadout\zombie\zombie_civilian.dm"
#include "code\_core\datum\loadout\zombie\zombie_clown.dm"
#include "code\_core\datum\loadout\zombie\zombie_firefighter.dm"
#include "code\_core\datum\loadout\zombie\zombie_mummy.dm"
#include "code\_core\datum\loadout\zombie\zombie_roided.dm"
#include "code\_core\datum\loadout\zombie\zombie_security.dm"
#include "code\_core\datum\loadout\zombie\zombie_worker.dm"
Expand Down Expand Up @@ -921,13 +919,12 @@
#include "code\_core\mob\living\advanced\human\npc\hostage.dm"
#include "code\_core\mob\living\advanced\human\npc\monkey.dm"
#include "code\_core\mob\living\advanced\human\npc\nanotrasen.dm"
#include "code\_core\mob\living\advanced\human\npc\raging_mage.dm"
#include "code\_core\mob\living\advanced\human\npc\rev.dm"
#include "code\_core\mob\living\advanced\human\npc\robot_assistant.dm"
#include "code\_core\mob\living\advanced\human\npc\skeleton_miner.dm"
#include "code\_core\mob\living\advanced\human\npc\space_soldier.dm"
#include "code\_core\mob\living\advanced\human\npc\syndicate.dm"
#include "code\_core\mob\living\advanced\human\npc\tax_man.dm"
#include "code\_core\mob\living\advanced\human\npc\wizard.dm"
#include "code\_core\mob\living\advanced\human\npc\wizard_federation_guard.dm"
#include "code\_core\mob\living\advanced\human\npc\unique\_unique.dm"
#include "code\_core\mob\living\advanced\human\npc\unique\burger_challenge.dm"
Expand Down Expand Up @@ -956,6 +953,7 @@
#include "code\_core\mob\living\advanced\human\npc\zombie\zombie_armored.dm"
#include "code\_core\mob\living\advanced\human\npc\zombie\zombie_bloated.dm"
#include "code\_core\mob\living\advanced\human\npc\zombie\zombie_clown.dm"
#include "code\_core\mob\living\advanced\human\npc\zombie\zombie_mummy.dm"
#include "code\_core\mob\living\advanced\human\npc\zombie\zombie_normal.dm"
#include "code\_core\mob\living\advanced\human\npc\zombie\zombie_roided.dm"
#include "code\_core\mob\living\advanced\human\npc\zombie\zombie_security.dm"
Expand Down Expand Up @@ -1485,6 +1483,7 @@
#include "code\_core\obj\item\clothing\overwear\armor\lizard_shaman.dm"
#include "code\_core\obj\item\clothing\overwear\armor\medium.dm"
#include "code\_core\obj\item\clothing\overwear\armor\molded.dm"
#include "code\_core\obj\item\clothing\overwear\armor\mummy_suit.dm"
#include "code\_core\obj\item\clothing\overwear\armor\nanotrasen.dm"
#include "code\_core\obj\item\clothing\overwear\armor\old.dm"
#include "code\_core\obj\item\clothing\overwear\armor\reinforced_vest.dm"
Expand Down Expand Up @@ -2404,7 +2403,6 @@
#include "code\_core\world\subsystems\squad.dm"
#include "code\_core\world\subsystems\status.dm"
#include "code\_core\world\subsystems\sunlight.dm"
#include "code\_core\world\subsystems\tax.dm"
#include "code\_core\world\subsystems\text.dm"
#include "code\_core\world\subsystems\thinking.dm"
#include "code\_core\world\subsystems\tracks.dm"
Expand Down
2 changes: 1 addition & 1 deletion code/__defines/_range.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define AI_DETECTION_RANGE (1 + VIEW_RANGE * 0.5)
#define AI_DETECTION_RANGE_NOISE (1 + VIEW_RANGE * 0.75)
#define AI_DETECTION_RANGE_CAUTION (1 + VIEW_RANGE)
#define AI_DETECTION_RANGE_COMBAT (1 + VIEW_RANGE + ZOOM_RANGE*0.25)
#define AI_DETECTION_RANGE_COMBAT (1 + VIEW_RANGE*2)

#define BOSS_RANGE (VIEW_RANGE + ZOOM_RANGE*2) //If you're out of this range, you're out of the boss fight.

Expand Down
2 changes: 1 addition & 1 deletion code/_core/client/_client.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

mouse_pointer_icon = 'icons/pointers/help.dmi'

var/current_music_track //Id of music track that last played.
var/track/current_music_track //Id of music track that last played.
var/next_music_track = 0 //When the next music track should be triggered.

var/current_ambient_sound
Expand Down
3 changes: 2 additions & 1 deletion code/_core/client/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@
U.loaded_data = U.load_json_data_from_id(file_num)
U.loaded_data["id"] = file_num
to_chat(span("notice","Successfully loaded character [U.loaded_data["name"]]."))
stop_music_track(src)

var/turf/T = length(world_spawnpoints) ? pick(world_spawnpoints) : FALLBACK_TURF

var/mob/living/advanced/player/P = new(T,src)
INITIALIZE(P)
FINALIZE(P)

stop_music_track(src)

return P
49 changes: 48 additions & 1 deletion code/_core/client/verbs/debug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ var/global/static/list/debug_verbs = list(
/client/verb/destroy_everything,
/client/verb/subsystem_debug,
/client/verb/debug_lighting,
/client/verb/complete_all_objectives
/client/verb/complete_all_objectives,
/client/verb/get_far_viewers,
/client/verb/get_active_ais_not_in_player_range
)


Expand Down Expand Up @@ -747,3 +749,48 @@ var/global/static/list/destroy_everything_whitelist = list(
O.update(FALSE)

G.next_objective_update = world.time + 50

/client/verb/get_far_viewers()
set name = "Get Far Viewers"
set category = "Debug"

var/list/ai_data = list()

for(var/k in subtypesof(/ai/))
var/ai/A = k
var/view_range = max(initial(A.radius_find_enemy_noise),initial(A.radius_find_enemy_caution),initial(A.radius_find_enemy_combat))
if(view_range > AI_DETECTION_RANGE_COMBAT)
ai_data["[A]"] = view_range

sort_tim(ai_data,/proc/cmp_numeric_dsc,associative=TRUE)

src << browse("<head><style>[STYLESHEET]</style></head><body>[english_list(ai_data, and_text = "<br>", comma_text = "<br>", final_comma_text = "<br>")]</body>","window=garbage")


/client/verb/get_active_ais_not_in_player_range()
set name = "Get Active AIs Not In Player Range"
set category = "Debug"

var/final_text = ""

var/bad_ais = 0

for(var/z_level in SSai.active_ai_by_z)
for(var/k in SSai.active_ai_by_z[z_level])
var/ai/AI = k
var/good_ai = FALSE
for(var/mob/living/L in SSliving.all_mobs_with_clients)
var/turf/T = get_turf(L)
if(T.z != z_level)
continue
if(get_dist(T,AI.owner) <= VIEW_RANGE*4)
good_ai = TRUE
break
if(!good_ai)
final_text += "[AI.type], belonging to [AI.owner.type]<br>"
bad_ais++


final_text = "<h1>Found [bad_ais] AIs away from players.</h1>[final_text]"

src << browse("<head><style>[STYLESHEET]</style></head><body>[final_text ? final_text : "No Bad AIs found. Yay!"]</body>","window=garbage")
1 change: 0 additions & 1 deletion code/_core/client/verbs/gamemaster.dm
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@
"Pirates" = /mob/living/advanced/npc/pirate_crew/ranged,
"Revs" = /mob/living/advanced/npc/rev,
"Space Soldiers" = /mob/living/advanced/npc/space_soldier,
"Tax Collectors" = /mob/living/advanced/npc/tax_collector,
"Zombies" = /mob/living/advanced/npc/zombie/normal,
"Custom..." = "Custom...",
"Cancel" = "Cancel"
Expand Down
4 changes: 0 additions & 4 deletions code/_core/datum/ai/_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@

var/delete_on_no_path = FALSE

var/idle_time = 0

var/ignore_hazard_turfs = FALSE

var/boss = FALSE
Expand All @@ -154,8 +152,6 @@
var/move_from_ally_dir = 0x0
var/move_from_ally = 0

var/sleep_on_idle = TRUE

var/last_movement_proc = "none"

var/ai/master_ai
Expand Down
2 changes: 0 additions & 2 deletions code/_core/datum/ai/advanced/guarding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
aggression = 3
assistance = 1

sleep_on_idle = FALSE

guard = TRUE

resist_grabs = 2
Expand Down
4 changes: 2 additions & 2 deletions code/_core/datum/ai/ai_combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

/ai/proc/is_enemy(var/atom/A,var/safety_check=TRUE,var/aggression_check=TRUE)

if(A.qdeleting || !A.finalized)
if(!A || A.qdeleting || !A.finalized)
return FALSE
/*
if(istype(A,/mob/living/vehicle/))
Expand Down Expand Up @@ -180,7 +180,7 @@
if(should_attack_mob(attacker,FALSE))
if(!attackers[attacker])
attackers[attacker] = TRUE
if(!objective_attack || (get_dist(owner,objective_attack) >= get_dist(owner,attacker)*1.25))
if(!objective_attack || (get_dist(owner,objective_attack) >= get_dist(owner,attacker)*2))
set_objective(attacker)
else if(alert_level != ALERT_LEVEL_COMBAT)
set_alert_level(ALERT_LEVEL_COMBAT,attacker)
Expand Down
106 changes: 68 additions & 38 deletions code/_core/datum/ai/ai_life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,51 @@

return TRUE

/ai/proc/is_near_player()
var/turf/T = get_turf(owner)
if(!T)
return FALSE

var/chunk/C = CHUNK(T)

if(length(C.players))
return TRUE

for(var/k in C.adjacent_chunks)
var/chunk/C2 = k
if(length(C2.players))
return TRUE

return FALSE

/ai/proc/is_idle()

if(!active)
return TRUE

if(queue_find_new_objectives)
return FALSE

if(master_ai)
return FALSE

if(objective_move)
return FALSE

if(alert_level >= ALERT_LEVEL_NOISE)
return FALSE

if(objective_attack || CALLBACK_EXISTS("set_new_objective_\ref[src]"))
return FALSE

if(length(astar_path_current) || length(node_path_current))
return FALSE

if(is_near_player())
return FALSE

return TRUE

/ai/proc/on_life(var/tick_rate=1)

//Safeties.
Expand All @@ -35,50 +80,33 @@

if(resist_grabs && owner.grabbing_hand && owner.next_resist <= world.time && (resist_grabs > 1 || is_enemy(owner.grabbing_hand.owner,FALSE)))
owner.resist()
return TRUE
return FALSE

if(aggression > 0 && can_attack)
if(!master_ai) //Find objectives only if you don't belong to a master.
objective_ticks += tick_rate
var/actual_objective_delay = get_objective_delay()
if(objective_ticks >= actual_objective_delay && !CALLBACK_EXISTS("set_new_objective_\ref[src]"))
objective_ticks = 0
if(objective_attack && frustration_attack < frustration_attack_threshold)
if(handle_current_objectives(actual_objective_delay) && !is_living(objective_attack))
if(is_idle())
set_active(FALSE)
return FALSE

if(aggression > 0 && can_attack && !master_ai)
objective_ticks += tick_rate
var/actual_objective_delay = get_objective_delay()
if(objective_ticks >= actual_objective_delay)
objective_ticks = 0
if(!CALLBACK_EXISTS("set_new_objective_\ref[src]"))
if(objective_attack)
if(frustration_attack >= frustration_attack_threshold) //We're frustrated. Try to find a new objective!
queue_find_new_objectives = TRUE
frustration_attack = 0
else if(handle_current_objectives(actual_objective_delay) && !is_living(objective_attack)) //If we're attacking something, and it isn't living, find new targets possibly.
queue_find_new_objectives = TRUE
else
queue_find_new_objectives = TRUE
frustration_attack = 0
if(queue_find_new_objectives)
find_new_objectives()
queue_find_new_objectives = FALSE

if(objective_attack && (owner.attack_next <= world.time))
if(objective_attack && owner.attack_next <= world.time)
handle_attacking()

if(queue_find_new_objectives)
find_new_objectives()
queue_find_new_objectives = FALSE

// Idle handler for when the AI is being useless.
if(sleep_on_idle)
if(length(node_path_current) || objective_attack || objective_move || alert_level >= ALERT_LEVEL_NOISE)
idle_time = 0 //Reset idle.
else
if(idle_time <= 0)
idle_time = world.time + SECONDS_TO_DECISECONDS(180) //Idle for more than 3 minutes means you're just wasting processing power.
else if(idle_time <= world.time)
var/found_player = FALSE
for(var/k in SSliving.all_players)
var/mob/living/advanced/player/P = k
if(P.z != owner.z)
continue
if(get_dist(P,owner) <= VIEW_RANGE)
found_player = TRUE
break
if(found_player)
idle_time = world.time + SECONDS_TO_DECISECONDS(180) //Try again later.
else
set_active(FALSE) //Deactivate if idle for more than 3 minutes.


if(alert_level >= ALERT_LEVEL_NOISE)
var/time_mod = 1
switch(alert_level)
Expand All @@ -98,7 +126,9 @@
var/turf/current_turf
var/should_remove_frustration = TRUE

if(owner.next_move <= 0) //We will move.
if(owner.grabbing_hand)
owner.move_dir = 0x0 //Don't move.
else if(owner.next_move <= 0) //We will move.
current_turf = get_turf(owner)

if(!master_ai) //No frustration handling if you belong to a master.
Expand Down
Loading

0 comments on commit 8656c73

Please sign in to comment.