mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 03:27:05 +01:00
Moves AI movement to their own procs, and cleans up their creation
This commit is contained in:
@@ -37,4 +37,42 @@ var/global/list/empty_playable_ai_cores = list()
|
||||
var/datum/game_mode/traitor/autotraitor/current_mode = ticker.mode
|
||||
current_mode.possible_traitors.Remove(src)
|
||||
|
||||
qdel(src)
|
||||
qdel(src)
|
||||
|
||||
// TODO: Move away from the insane name-based landmark system
|
||||
/mob/living/silicon/ai/proc/moveToAILandmark()
|
||||
var/obj/loc_landmark
|
||||
for(var/obj/effect/landmark/start/sloc in landmarks_list)
|
||||
if(sloc.name != "AI")
|
||||
continue
|
||||
if(locate(/mob/living) in sloc.loc)
|
||||
continue
|
||||
loc_landmark = sloc
|
||||
if(!loc_landmark)
|
||||
for(var/obj/effect/landmark/tripai in landmarks_list)
|
||||
if(tripai.name == "tripai")
|
||||
if(locate(/mob/living) in tripai.loc)
|
||||
continue
|
||||
loc_landmark = tripai
|
||||
if(!loc_landmark)
|
||||
to_chat(src, "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone.")
|
||||
for(var/obj/effect/landmark/start/sloc in landmarks_list)
|
||||
if(sloc.name == "AI")
|
||||
loc_landmark = sloc
|
||||
|
||||
forceMove(loc_landmark.loc)
|
||||
|
||||
// Before calling this, make sure an empty core exists, or this will no-op
|
||||
/mob/living/silicon/ai/proc/moveToEmptyCore()
|
||||
if(!empty_playable_ai_cores.len)
|
||||
log_debug("moveToEmptyCore called without any available cores")
|
||||
return
|
||||
|
||||
// IsJobAvailable for AI checks that there is an empty core available in this list
|
||||
var/obj/structure/AIcore/deactivated/C = empty_playable_ai_cores[1]
|
||||
empty_playable_ai_cores -= C
|
||||
|
||||
forceMove(C.loc)
|
||||
|
||||
|
||||
qdel(C)
|
||||
|
||||
@@ -296,18 +296,13 @@
|
||||
// AIs don't need a spawnpoint, they must spawn at an empty core
|
||||
if(character.mind.assigned_role == "AI")
|
||||
|
||||
character = character.AIize(move=0) // AIize the character, but don't move them yet
|
||||
var/mob/living/silicon/ai/ai_character = character.AIize() // AIize the character, but don't move them yet
|
||||
|
||||
// IsJobAvailable for AI checks that there is an empty core available in this list
|
||||
var/obj/structure/AIcore/deactivated/C = empty_playable_ai_cores[1]
|
||||
empty_playable_ai_cores -= C
|
||||
ai_character.moveToEmptyCore()
|
||||
AnnounceCyborg(ai_character, rank, "has been downloaded to the empty core in \the [get_area(ai_character)]")
|
||||
|
||||
character.loc = C.loc
|
||||
|
||||
AnnounceCyborg(character, rank, "has been downloaded to the empty core in \the [get_area(character)]")
|
||||
ticker.mode.latespawn(character)
|
||||
|
||||
qdel(C)
|
||||
ticker.mode.latespawn(ai_character)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
@@ -7,14 +7,6 @@
|
||||
spawning = 1
|
||||
return ..()
|
||||
|
||||
/mob/living/carbon/human/AIize(move=1) // 'move' argument needs defining here too because BYOND is dumb
|
||||
if(notransform)
|
||||
return
|
||||
for(var/t in organs)
|
||||
qdel(t)
|
||||
|
||||
return ..(move)
|
||||
|
||||
/mob/living/carbon/AIize()
|
||||
if(notransform)
|
||||
return
|
||||
@@ -40,34 +32,12 @@
|
||||
else
|
||||
O.key = key
|
||||
|
||||
var/obj/loc_landmark
|
||||
for(var/obj/effect/landmark/start/sloc in landmarks_list)
|
||||
if(sloc.name != "AI")
|
||||
continue
|
||||
if(locate(/mob/living) in sloc.loc)
|
||||
continue
|
||||
loc_landmark = sloc
|
||||
if(!loc_landmark)
|
||||
for(var/obj/effect/landmark/tripai in landmarks_list)
|
||||
if(tripai.name == "tripai")
|
||||
if(locate(/mob/living) in tripai.loc)
|
||||
continue
|
||||
loc_landmark = tripai
|
||||
if(!loc_landmark)
|
||||
to_chat(O, "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone.")
|
||||
for(var/obj/effect/landmark/start/sloc in landmarks_list)
|
||||
if(sloc.name == "AI")
|
||||
loc_landmark = sloc
|
||||
|
||||
O.loc = loc_landmark.loc
|
||||
|
||||
O.on_mob_init()
|
||||
|
||||
O.add_ai_verbs()
|
||||
|
||||
O.rename_self("AI",1)
|
||||
spawn
|
||||
qdel(src)
|
||||
qdel(src)
|
||||
return O
|
||||
|
||||
/mob/living/carbon/human/make_into_mask(var/should_gib = 0)
|
||||
|
||||
Reference in New Issue
Block a user