Merge pull request #5418 from Fox-McCloud/malf-ai-rework

Malf AI Rework
This commit is contained in:
TheDZD
2016-08-12 18:30:41 -04:00
committed by GitHub
38 changed files with 342 additions and 634 deletions
-4
View File
@@ -739,10 +739,6 @@ var/global/nologevent = 0
if(ticker.mode.config_tag == "cult")
return 2
return 1
if(M.mind in ticker.mode.malf_ai)
if(ticker.mode.config_tag == "malfunction")
return 2
return 1
if(M.mind in ticker.mode.syndicates)
if(ticker.mode.config_tag == "nuclear")
return 2
+3 -7
View File
@@ -48,22 +48,18 @@
if(!src.makeCult())
to_chat(usr, "\red Unfortunately there weren't enough candidates available.")
if("5")
log_admin("[key_name(usr)] has spawned a malf AI.")
if(!src.makeMalfAImode())
to_chat(usr, "\red Unfortunately there weren't enough candidates available.")
if("6")
log_admin("[key_name(usr)] has spawned a wizard.")
if(!src.makeWizard())
to_chat(usr, "\red Unfortunately there weren't enough candidates available.")
if("7")
if("6")
log_admin("[key_name(usr)] has spawned vampires.")
if(!src.makeVampires())
to_chat(usr, "\red Unfortunately there weren't enough candidates available.")
if("8")
if("7")
log_admin("[key_name(usr)] has spawned vox raiders.")
if(!src.makeVoxRaiders())
to_chat(usr, "\red Unfortunately there weren't enough candidates available.")
if("9")
if("8")
log_admin("[key_name(usr)] has spawned an abductor team.")
if(!src.makeAbductorTeam())
to_chat(usr, "\red Unfortunately there weren't enough candidates available.")
+4 -26
View File
@@ -17,37 +17,15 @@ client/proc/one_click_antag()
<a href='?src=\ref[src];makeAntag=2'>Make Changelings</a><br>
<a href='?src=\ref[src];makeAntag=3'>Make Revolutionaries</a><br>
<a href='?src=\ref[src];makeAntag=4'>Make Cult</a><br>
<a href='?src=\ref[src];makeAntag=5'>Make Malf AI</a><br>
<a href='?src=\ref[src];makeAntag=6'>Make Wizard (Requires Ghosts)</a><br>
<a href='?src=\ref[src];makeAntag=7'>Make Vampires</a><br>
<a href='?src=\ref[src];makeAntag=8'>Make Vox Raiders (Requires Ghosts)</a><br>
<a href='?src=\ref[src];makeAntag=9'>Make Abductor Team (Requires Ghosts)</a><br>
<a href='?src=\ref[src];makeAntag=5'>Make Wizard (Requires Ghosts)</a><br>
<a href='?src=\ref[src];makeAntag=6'>Make Vampires</a><br>
<a href='?src=\ref[src];makeAntag=7'>Make Vox Raiders (Requires Ghosts)</a><br>
<a href='?src=\ref[src];makeAntag=8'>Make Abductor Team (Requires Ghosts)</a><br>
"}
usr << browse(dat, "window=oneclickantag;size=400x400")
return
/datum/admins/proc/makeMalfAImode()
var/list/mob/living/silicon/AIs = list()
var/mob/living/silicon/malfAI = null
var/datum/mind/themind = null
for(var/mob/living/silicon/ai/ai in player_list)
if(ai.client && (ROLE_MALF in ai.client.prefs.be_special))
AIs += ai
if(AIs.len)
malfAI = pick(AIs)
if(malfAI)
themind = malfAI.mind
themind.make_AI_Malf()
return 1
return 0
/datum/admins/proc/makeTraitors()
var/datum/game_mode/traitor/temp = new
@@ -24,7 +24,6 @@ var/global/list/special_role_times = list( //minimum age (in days) for accounts
ROLE_BORER = 21,
ROLE_NINJA = 21,
ROLE_MUTINEER = 21,
ROLE_MALF = 30,
ROLE_ABDUCTOR = 30,
)
@@ -226,13 +226,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
statpanel("Status")
if(client.statpanel == "Status")
show_stat_station_time()
if(ticker)
if(ticker.mode)
// to_chat(world, "DEBUG: ticker not null")
if(ticker.mode.name == "AI malfunction")
// to_chat(world, "DEBUG: malf mode ticker test")
if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
show_stat_emergency_shuttle_eta()
/mob/dead/observer/verb/reenter_corpse()
@@ -249,10 +249,6 @@
show_stat_station_time()
if(ticker && ticker.mode && ticker.mode.name == "AI malfunction")
if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
show_stat_emergency_shuttle_eta()
if(client.statpanel == "Status")
+41 -21
View File
@@ -60,9 +60,10 @@ var/list/ai_verbs_default = list(
//MALFUNCTION
var/datum/module_picker/malf_picker
var/processing_time = 100
var/list/datum/AI_Module/current_modules = list()
var/can_dominate_mechs = 0
var/shunted = 0 //1 if the AI is currently shunted. Used to differentiate between shunted and ghosted/braindead
var/control_disabled = 0 // Set to 1 to stop AI from interacting via Click() -- TLE
var/malfhacking = 0 // More or less a copy of the above var, so that malf AIs can hack and still get new cyborgs -- NeoFite
var/malf_cooldown = 0 //Cooldown var for malf modules
@@ -70,7 +71,6 @@ var/list/ai_verbs_default = list(
var/obj/machinery/power/apc/malfhack = null
var/explosive = 0 //does the AI explode when it dies?
var/mob/living/silicon/ai/parent = null
var/camera_light_on = 0
var/list/obj/machinery/camera/lit_cameras = list()
@@ -84,6 +84,8 @@ var/list/ai_verbs_default = list(
var/mob/living/simple_animal/bot/Bot
var/turf/waypoint //Holds the turf of the currently selected waypoint.
var/waypoint_mode = 0 //Waypoint mode is for selecting a turf via clicking.
var/nuking = 0
var/obj/machinery/doomsday_device/doomsday_device
var/obj/machinery/hologram/holopad/holo = null
var/mob/camera/aiEye/eyeobj = new()
@@ -219,9 +221,8 @@ var/list/ai_verbs_default = list(
to_chat(src, radio_text)
if(!(ticker && ticker.mode && (mind in ticker.mode.malf_ai)))
show_laws()
to_chat(src, "<b>These laws may be changed by other players, or by you being the traitor.</b>")
show_laws()
to_chat(src, "<b>These laws may be changed by other players, or by you being the traitor.</b>")
job = "AI"
@@ -246,6 +247,7 @@ var/list/ai_verbs_default = list(
shuttle_caller_list -= src
shuttle_master.autoEvac()
qdel(eyeobj) // No AI, no Eye
malfhack = null
return ..()
@@ -336,16 +338,6 @@ var/list/ai_verbs_default = list(
// to_chat(usr, "You can only change your display once!")
//return
// displays the malf_ai information if the AI is the malf
/mob/living/silicon/ai/show_malf_ai()
if(ticker.mode.name == "AI malfunction")
var/datum/game_mode/malfunction/malf = ticker.mode
for(var/datum/mind/malfai in malf.malf_ai)
if(mind == malfai) // are we the evil one?
if(malf.apcs >= 3)
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
// this verb lets the ai see the stations manifest
/mob/living/silicon/ai/proc/ai_roster()
set name = "Show Crew Manifest"
@@ -957,6 +949,10 @@ var/list/ai_verbs_default = list(
to_chat(src, "Camera lights activated.")
/mob/living/silicon/ai/proc/set_syndie_radio()
if(aiRadio)
aiRadio.make_syndie()
/mob/living/silicon/ai/proc/sensor_mode()
set name = "Set Sensor Augmentation"
set desc = "Augment visual feed with internal sensor overlays."
@@ -1102,11 +1098,6 @@ var/list/ai_verbs_default = list(
if(interaction == AI_TRANS_TO_CARD)//The only possible interaction. Upload AI mob to a card.
if(!mind)
to_chat(user, "<span class='warning'>No intelligence patterns detected.</span>")//No more magical carding of empty cores, AI RETURN TO BODY!!!11
return
if(mind.special_role == SPECIAL_ROLE_MALF) //AI MALF!!
to_chat(user, "<span class='boldannounce'>ERROR</span>: Remote transfer interface disabled.")//Do ho ho ho~
return
new /obj/structure/AIcore/deactivated(loc)//Spawns a deactivated terminal at AI location.
aiRestorePowerRoutine = 0//So the AI initially has power.
@@ -1147,4 +1138,33 @@ var/list/ai_verbs_default = list(
rendered = "<i><span class='game say'>Relayed Speech: <span class='name'>[name_used]</span> [speaking.format_message(text, verb)]</span></i>"
else
rendered = "<i><span class='game say'>Relayed Speech: <span class='name'>[name_used]</span> [verb], <span class='message'>\"[text]\"</span></span></i>"
show_message(rendered, 2)
show_message(rendered, 2)
/mob/living/silicon/ai/proc/malfhacked(obj/machinery/power/apc/apc)
malfhack = null
malfhacking = 0
clear_alert("hackingapc")
if(!istype(apc) || qdeleted(apc) || apc.stat & BROKEN)
to_chat(src, "<span class='danger'>Hack aborted. The designated APC no longer exists on the power network.</span>")
playsound(get_turf(src), 'sound/machines/buzz-two.ogg', 50, 1)
else if(apc.aidisabled)
to_chat(src, "<span class='danger'>Hack aborted. [apc] is no longer responding to our systems.</span>")
playsound(get_turf(src), 'sound/machines/buzz-sigh.ogg', 50, 1)
else
malf_picker.processing_time += 10
apc.malfai = parent || src
apc.malfhack = TRUE
apc.locked = TRUE
playsound(get_turf(src), 'sound/machines/ding.ogg', 50, 1)
to_chat(src, "Hack complete. [apc] is now under your exclusive control.")
apc.update_icon()
/mob/living/silicon/ai/proc/add_malf_picker()
to_chat(src, "In the top right corner of the screen you will find the Malfunctions tab, where you can purchase various abilities, from upgraded surveillance to station ending doomsday devices.")
to_chat(src, "You are also capable of hacking APCs, which grants you more points to spend on your Malfunction powers. The drawback is that a hacked APC will give you away if spotted by the crew. Hacking an APC takes 60 seconds.")
view_core() //A BYOND bug requires you to be viewing your core before your verbs update
verbs += /mob/living/silicon/ai/proc/choose_modules
malf_picker = new /datum/module_picker
@@ -14,6 +14,21 @@
shuttle_caller_list -= src
shuttle_master.autoEvac()
if(nuking)
set_security_level("red")
nuking = 0
for(var/obj/item/weapon/pinpointer/point in pinpointer_list)
point.the_disk = null //Point back to the disk.
if(doomsday_device)
doomsday_device.timing = 0
shuttle_master.emergencyNoEscape = 0
if(shuttle_master.emergency.mode == SHUTTLE_STRANDED)
shuttle_master.emergency.mode = SHUTTLE_DOCKED
shuttle_master.emergency.timer = world.time
priority_announcement.Announce("Hostile environment resolved. You have 3 minutes to board the Emergency Shuttle.", "Priority Announcement", 'sound/AI/shuttledock.ogg')
qdel(doomsday_device)
if(explosive)
spawn(10)
explosion(src.loc, 3, 6, 12, 15)
@@ -19,9 +19,10 @@
msg += "It looks slightly charred.\n"
else
msg += "<B>Its casing is melted and heat-warped!</B>\n"
if(src.stat == UNCONSCIOUS)
msg += "It is non-responsive and displaying the text: \"RUNTIME: Sensory Overload, stack 26/3\".\n"
if(!shunted && !client)
msg += "[src]Core.exe has stopped responding! NTOS is searching for a solution to the problem...\n"
msg += "</span>"
msg += "*---------*</span>"
@@ -15,10 +15,6 @@ var/global/list/empty_playable_ai_cores = list()
set category = "OOC"
set desc = "Wipe your core. This is functionally equivalent to cryo or robotic storage, freeing up your job slot."
if(ticker && ticker.mode && ticker.mode.name == "AI malfunction")
to_chat(usr, "<span class='danger'>You cannot use this verb in malfunction. If you need to leave, please adminhelp.</span>")
return
// Guard against misclicks, this isn't the sort of thing we want happening accidentally
if(alert("WARNING: This will immediately wipe your core and ghost you, removing your character from the round permanently (similar to cryo and robotic storage). Are you entirely sure you want to do this?",
"Wipe Core", "No", "No", "Yes") != "Yes")
@@ -507,20 +507,6 @@ var/list/robot_verbs_default = list(
return 1
return 0
// this function shows information about the malf_ai gameplay type in the status screen
/mob/living/silicon/robot/show_malf_ai()
..()
if(ticker && ticker.mode.name == "AI malfunction")
var/datum/game_mode/malfunction/malf = ticker.mode
for(var/datum/mind/malfai in malf.malf_ai)
if(connected_ai)
if(connected_ai.mind == malfai)
if(malf.apcs >= 3)
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
else if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
return 0
// this function displays the cyborgs current cell charge in the stat panel
/mob/living/silicon/robot/proc/show_cell_power()
if(cell)
@@ -143,18 +143,12 @@
stat(null, text("Systems nonfunctional"))
// This is a pure virtual function, it should be overwritten by all subclasses
/mob/living/silicon/proc/show_malf_ai()
return 0
// This adds the basic clock, shuttle recall timer, and malf_ai info to all silicon lifeforms
/mob/living/silicon/Stat()
if(statpanel("Status"))
show_stat_station_time()
show_stat_emergency_shuttle_eta()
show_system_integrity()
show_malf_ai()
..()
//Silicon mob language procs
-1
View File
@@ -56,7 +56,6 @@ proc/isNonCrewAntag(A)
SPECIAL_ROLE_CHANGELING,
SPECIAL_ROLE_ERT,
SPECIAL_ROLE_HEAD_REV,
SPECIAL_ROLE_MALF,
SPECIAL_ROLE_REV,
SPECIAL_ROLE_SHADOWLING,
SPECIAL_ROLE_SHADOWLING_THRALL,
+59 -77
View File
@@ -169,9 +169,7 @@
/obj/machinery/power/apc/Destroy()
apcs -= src
if(malfai && operating)
if(ticker.mode.config_tag == "malfunction")
if(is_station_level(src.z))
ticker.mode:apcs--
malfai.malf_picker.processing_time = Clamp(malfai.malf_picker.processing_time - 10,0,1000)
area.power_light = 0
area.power_equip = 0
area.power_environ = 0
@@ -762,12 +760,12 @@
return ui_interact(user)
/obj/machinery/power/apc/proc/get_malf_status(mob/user)
if(ticker && ticker.mode && (user.mind in ticker.mode.malf_ai) && istype(user, /mob/living/silicon/ai))
if(src.malfai == (user:parent ? user:parent : user))
if(src.occupier == user)
/obj/machinery/power/apc/proc/get_malf_status(mob/living/silicon/ai/malf)
if(istype(malf) && malf.malf_picker)
if(malfai == (malf.parent || malf))
if(occupier == malf)
return 3 // 3 = User is shunted in this APC
else if(istype(user.loc, /obj/machinery/power/apc))
else if(istype(malf.loc, /obj/machinery/power/apc))
return 4 // 4 = User is shunted in another APC
else
return 2 // 2 = APC hacked by user, and user is in its core.
@@ -980,29 +978,8 @@
overload_lighting()
else if(href_list["malfhack"])
var/mob/living/silicon/ai/malfai = usr
if(get_malf_status(malfai)==1)
if(malfai.malfhacking)
to_chat(malfai, "You are already hacking an APC.")
return 0
to_chat(malfai, "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process.")
malfai.malfhack = src
malfai.malfhacking = 1
sleep(600)
if(src)
if(!src.aidisabled)
malfai.malfhack = null
malfai.malfhacking = 0
locked = 1
if(ticker.mode.config_tag == "malfunction")
if(is_station_level(src.z)) //if(is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs++
if(usr:parent)
src.malfai = usr:parent
else
src.malfai = usr
to_chat(malfai, "Hack complete. The APC is now under your exclusive control.")
update_icon()
if(get_malf_status(usr))
malfhack(usr)
else if(href_list["occupyapc"])
if(get_malf_status(usr))
@@ -1024,70 +1001,77 @@
/obj/machinery/power/apc/proc/toggle_breaker()
operating = !operating
if(malfai)
if(ticker.mode.config_tag == "malfunction")
if(is_station_level(src.z)) //if(is_type_in_list(get_area(src), the_station_areas))
operating ? ticker.mode:apcs++ : ticker.mode:apcs--
src.update()
update()
update_icon()
/obj/machinery/power/apc/proc/malfoccupy(var/mob/living/silicon/ai/malf)
/obj/machinery/power/apc/proc/malfhack(mob/living/silicon/ai/malf)
if(!istype(malf))
return
if(get_malf_status(malf) != 1)
return
if(malf.malfhacking)
to_chat(malf, "You are already hacking an APC.")
return
to_chat(malf, "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process.")
malf.malfhack = src
malf.malfhacking = addtimer(malf, "malfhacked", 600, FALSE, src)
var/obj/screen/alert/hackingapc/A
A = malf.throw_alert("hackingapc", /obj/screen/alert/hackingapc)
A.target = src
/obj/machinery/power/apc/proc/malfoccupy(mob/living/silicon/ai/malf)
if(!istype(malf))
return
if(istype(malf.loc, /obj/machinery/power/apc)) // Already in an APC
to_chat(malf, "<span class='warning'>You must evacuate your current apc first.</span>")
to_chat(malf, "<span class='warning'>You must evacuate your current APC first!</span>")
return
if(!malf.can_shunt)
to_chat(malf, "<span class='warning'>You cannot shunt.</span>")
to_chat(malf, "<span class='warning'>You cannot shunt!</span>")
return
if(!is_station_level(src.z))
return
src.occupier = new /mob/living/silicon/ai(src,malf.laws,null,1)
src.occupier.adjustOxyLoss(malf.getOxyLoss())
if(!findtext(src.occupier.name,"APC Copy"))
src.occupier.name = "[malf.name] APC Copy"
occupier = new /mob/living/silicon/ai(src,malf.laws,null,1)
occupier.adjustOxyLoss(malf.getOxyLoss())
if(!findtext(occupier.name, "APC Copy"))
occupier.name = "[malf.name] APC Copy"
if(malf.parent)
src.occupier.parent = malf.parent
occupier.parent = malf.parent
else
src.occupier.parent = malf
malf.mind.transfer_to(src.occupier)
src.occupier.eyeobj.name = "[src.occupier.name] (AI Eye)"
occupier.parent = malf
malf.shunted = 1
malf.mind.transfer_to(occupier)
occupier.eyeobj.name = "[occupier.name] (AI Eye)"
if(malf.parent)
qdel(malf)
src.occupier.verbs += /mob/living/silicon/ai/proc/corereturn
src.occupier.verbs += /datum/game_mode/malfunction/proc/takeover
src.occupier.cancel_camera()
if(seclevel2num(get_security_level()) == SEC_LEVEL_DELTA)
for(var/obj/item/weapon/pinpointer/point in world)
occupier.verbs += /mob/living/silicon/ai/proc/corereturn
occupier.cancel_camera()
if((seclevel2num(get_security_level()) == SEC_LEVEL_DELTA) && malf.nuking)
for(var/obj/item/weapon/pinpointer/point in pinpointer_list)
point.the_disk = src //the pinpointer will detect the shunted AI
/obj/machinery/power/apc/proc/malfvacate(var/forced)
if(!src.occupier)
/obj/machinery/power/apc/proc/malfvacate(forced)
if(!occupier)
return
if(src.occupier.parent && src.occupier.parent.stat != 2)
src.occupier.mind.transfer_to(src.occupier.parent)
src.occupier.parent.adjustOxyLoss(src.occupier.getOxyLoss())
src.occupier.parent.cancel_camera()
qdel(src.occupier) // qdel
if(occupier.parent && occupier.parent.stat != DEAD)
occupier.mind.transfer_to(occupier.parent)
occupier.parent.shunted = 0
occupier.parent.adjustOxyLoss(occupier.getOxyLoss())
occupier.parent.cancel_camera()
qdel(occupier)
if(seclevel2num(get_security_level()) == SEC_LEVEL_DELTA)
for(var/obj/item/weapon/pinpointer/point in world)
for(var/datum/mind/AI_mind in ticker.mode.malf_ai)
var/mob/living/silicon/ai/A = AI_mind.current // the current mob the mind owns
if(A.stat != DEAD)
for(var/obj/item/weapon/pinpointer/point in pinpointer_list)
for(var/mob/living/silicon/ai/A in ai_list)
if((A.stat != DEAD) && A.nuking)
point.the_disk = A //The pinpointer tracks the AI back into its core.
else
to_chat(src.occupier, "<span class='danger'>Primary core damaged, unable to return core processes.</span>")
to_chat(occupier, "<span class='danger'>Primary core damaged, unable to return core processes.</span>")
if(forced)
src.occupier.loc = src.loc
src.occupier.death()
src.occupier.gib()
for(var/obj/item/weapon/pinpointer/point in world)
point.the_disk = null //the pinpointer will go back to pointing at the nuke disc.
occupier.loc = loc
occupier.death()
occupier.gib()
for(var/obj/item/weapon/pinpointer/point in pinpointer_list)
point.the_disk = null //Pinpointers go back to tracking the nuke disk
/obj/machinery/power/apc/proc/ion_act()
//intended to be exactly the same as an AI malf attack
@@ -1365,9 +1349,7 @@
/obj/machinery/power/apc/proc/set_broken()
if(malfai && operating)
if(ticker.mode.config_tag == "malfunction")
if(is_station_level(src.z)) //if(is_type_in_list(get_area(src), the_station_areas))
ticker.mode:apcs--
malfai.malf_picker.processing_time = Clamp(malfai.malf_picker.processing_time - 10,0,1000)
stat |= BROKEN
operating = 0
if(occupier)