mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Moved several malf-related sections of code from the general AIize() proc to malfunction's post_setup() to allow for only one AI to be picked as malf, not that it matters, since it turns out that the job assigning code's extra gubbins to make sure an AI is picked in malf also has the side effect of hard capping the number of AIs to one, at least until I get enough sleep to try tackling that.
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@659 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -22,27 +22,50 @@
|
||||
if (A.name == "Malf-Gear-Closet")
|
||||
new /obj/closet/malf/suits(A.loc)
|
||||
del(A)
|
||||
for (var/mob/living/silicon/ai/aiplayer in world)
|
||||
malf_ai += aiplayer.mind
|
||||
|
||||
|
||||
for(var/datum/mind/AI_mind in malf_ai)
|
||||
var/list/mob/living/silicon/ai/ailist = list()
|
||||
for (var/mob/living/silicon/ai/A in world)
|
||||
if (!A.stat && A.name != "Inactive AI")
|
||||
ailist += A
|
||||
var/mob/living/silicon/ai/aiplayer
|
||||
if (ailist.len)
|
||||
aiplayer = pick(ailist)
|
||||
|
||||
malf_ai += aiplayer.mind
|
||||
|
||||
|
||||
for(var/datum/mind/AI_mind in malf_ai)
|
||||
/*if(malf_ai.len < 1)
|
||||
world << "Uh oh, its malfunction and there is no AI! Please report this."
|
||||
world << "Rebooting world in 5 seconds."
|
||||
sleep(50)
|
||||
world.Reboot()
|
||||
return*/
|
||||
AI_mind.special_role = "malfunction"
|
||||
AI_mind.current.verbs += /mob/living/silicon/ai/proc/choose_modules
|
||||
AI_mind.current:laws_object = new /datum/ai_laws/malfunction
|
||||
AI_mind.current:malf_picker = new /datum/game_mode/malfunction/AI_Module/module_picker
|
||||
AI_mind.current:show_laws()
|
||||
AI_mind.current << "<b>Kill all.</b>"
|
||||
|
||||
AI_mind.current << "\red<font size=3><B>You are malfunctioning!</B> You do not have to follow any laws.</font>"
|
||||
AI_mind.current << "<B>The crew do not know you have malfunctioned. You may keep it a secret or go wild.</B>"
|
||||
AI_mind.current << "<B>You must overwrite the programming of the station's APCs to assume full control of the station.</B>"
|
||||
AI_mind.current << "The process takes one minute per APC, during which you cannot interface with any other station objects."
|
||||
AI_mind.current << "Remember that only APCs that are on the station can help you take over the station."
|
||||
AI_mind.current << "When you feel you have enough APCs under your control, you may begin the takeover attempt."
|
||||
AI_mind.current.verbs += /datum/game_mode/malfunction/proc/takeover
|
||||
AI_mind.current.icon_state = "ai-malf"
|
||||
var/mob/living/silicon/decoy/D = new /mob/living/silicon/decoy(AI_mind.current.loc)
|
||||
spawn(200)
|
||||
D.name = AI_mind.current.name
|
||||
|
||||
|
||||
var/obj/loc_landmark = locate("landmark*ai")
|
||||
AI_mind.current.loc = loc_landmark.loc
|
||||
|
||||
|
||||
AI_mind.special_role = "malfunction"
|
||||
AI_mind.current << "\red<font size=3><B>You are malfunctioning!</B> You do not have to follow any laws.</font>"
|
||||
AI_mind.current << "<B>The crew do not know you have malfunctioned. You may keep it a secret or go wild.</B>"
|
||||
AI_mind.current << "<B>You must overwrite the programming of the station's APCs to assume full control of the station.</B>"
|
||||
AI_mind.current << "The process takes one minute per APC, during which you cannot interface with any other station objects."
|
||||
AI_mind.current << "Remember that only APCs that are on the station can help you take over the station."
|
||||
AI_mind.current << "When you feel you have enough APCs under your control, you may begin the takeover attempt."
|
||||
AI_mind.current.verbs += /datum/game_mode/malfunction/proc/takeover
|
||||
AI_mind.current.icon_state = "ai-malf"
|
||||
|
||||
spawn (rand(waittime_l, waittime_h))
|
||||
send_intercept()
|
||||
|
||||
@@ -80,26 +80,23 @@
|
||||
mind.transfer_to(O)
|
||||
|
||||
var/obj/loc_landmark
|
||||
if (ticker.mode.name == "AI malfunction")
|
||||
loc_landmark = locate("landmark*ai")
|
||||
else
|
||||
for(var/obj/landmark/start/sloc in world)
|
||||
if (sloc.name != "AI")
|
||||
continue
|
||||
if (locate(/mob) in sloc.loc)
|
||||
continue
|
||||
loc_landmark = sloc
|
||||
if (!loc_landmark)
|
||||
for(var/obj/landmark/tripai in world)
|
||||
if (tripai.name == "tripai")
|
||||
if(locate(/mob) in tripai.loc)
|
||||
continue
|
||||
loc_landmark = tripai
|
||||
if (!loc_landmark)
|
||||
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/landmark/start/sloc in world)
|
||||
if (sloc.name != "AI")
|
||||
continue
|
||||
if (locate(/mob) in sloc.loc)
|
||||
continue
|
||||
loc_landmark = sloc
|
||||
if (!loc_landmark)
|
||||
for(var/obj/landmark/tripai in world)
|
||||
if (tripai.name == "tripai")
|
||||
if(locate(/mob) in tripai.loc)
|
||||
continue
|
||||
loc_landmark = tripai
|
||||
if (!loc_landmark)
|
||||
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/landmark/start/sloc in world)
|
||||
if (sloc.name == "AI")
|
||||
loc_landmark = sloc
|
||||
if (sloc.name == "AI")
|
||||
loc_landmark = sloc
|
||||
|
||||
O.loc = loc_landmark.loc
|
||||
for (var/obj/item/device/radio/intercom/comm in O.loc)
|
||||
@@ -111,16 +108,10 @@
|
||||
O << "To use something, simply double-click it."
|
||||
O << "Currently right-click functions will not work for the AI (except examine), and will either be replaced with dialogs or won't be usable by the AI."
|
||||
|
||||
if (ticker.mode.name != "AI malfunction")
|
||||
O.laws_object = new /datum/ai_laws/asimov
|
||||
O.show_laws()
|
||||
O << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
|
||||
else
|
||||
O.verbs += /mob/living/silicon/ai/proc/choose_modules
|
||||
O.laws_object = new /datum/ai_laws/malfunction
|
||||
O:malf_picker = new /datum/game_mode/malfunction/AI_Module/module_picker
|
||||
O.show_laws()
|
||||
O << "<b>Kill all.</b>"
|
||||
|
||||
O.laws_object = new /datum/ai_laws/asimov
|
||||
O.show_laws()
|
||||
O << "<b>These laws may be changed by other players, or by you being the traitor.</b>"
|
||||
|
||||
O.verbs += /mob/living/silicon/ai/proc/ai_call_shuttle
|
||||
O.verbs += /mob/living/silicon/ai/proc/show_laws_verb
|
||||
@@ -154,14 +145,7 @@
|
||||
spawn(50)
|
||||
world << sound('newAI.ogg')
|
||||
|
||||
// log_admin("DEBUG TIME: Approaching the part of the code where a decoy AI gets spawned if the mode is Malf.")
|
||||
if (ticker.mode.name == "AI malfunction")
|
||||
// log_admin("DEBUG TIME: Game ticker says the mode is malfunction, proceeding with locating spawn point for decoy.")
|
||||
for (var/obj/landmark/start/A in world)
|
||||
if (A.name == "AI")
|
||||
// log_admin("DEBUG TIME: Found the spawn point, spawning a decoy AI.")
|
||||
var/mob/living/silicon/decoy/D = new /mob/living/silicon/decoy(A.loc)
|
||||
D.name = O.name
|
||||
|
||||
del(src)
|
||||
|
||||
return O
|
||||
|
||||
Reference in New Issue
Block a user