diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm
index be58f42860..2d6119016a 100644
--- a/code/game/gamemodes/malfunction/malfunction.dm
+++ b/code/game/gamemodes/malfunction/malfunction.dm
@@ -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 << "Kill all."
- AI_mind.current << "\redYou are malfunctioning! You do not have to follow any laws."
- AI_mind.current << "The crew do not know you have malfunctioned. You may keep it a secret or go wild."
- AI_mind.current << "You must overwrite the programming of the station's APCs to assume full control of the station."
- 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 << "\redYou are malfunctioning! You do not have to follow any laws."
+ AI_mind.current << "The crew do not know you have malfunctioned. You may keep it a secret or go wild."
+ AI_mind.current << "You must overwrite the programming of the station's APCs to assume full control of the station."
+ 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()
diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm
index 19da58a176..9fbb4d56ec 100644
--- a/code/modules/mob/transform_procs.dm
+++ b/code/modules/mob/transform_procs.dm
@@ -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 << "These laws may be changed by other players, or by you being the traitor."
- 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 << "Kill all."
+
+ O.laws_object = new /datum/ai_laws/asimov
+ O.show_laws()
+ O << "These laws may be changed by other players, or by you being the traitor."
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