From 95f750d6f22e8eabf90fb6766e26e894c8b6521f Mon Sep 17 00:00:00 2001 From: Markolie Date: Thu, 9 Feb 2017 18:54:26 +0100 Subject: [PATCH] Add faction support to pAI's --- _maps/map_files/MetaStation/z2.dmm | 2 +- _maps/map_files/cyberiad/z2.dmm | 2 +- code/game/objects/items/devices/paicard.dm | 40 +++++---- code/modules/mob/living/silicon/pai/pai.dm | 95 +++++++++++----------- 4 files changed, 72 insertions(+), 67 deletions(-) diff --git a/_maps/map_files/MetaStation/z2.dmm b/_maps/map_files/MetaStation/z2.dmm index 69f2d4a567c..ad26c7fb2ec 100644 --- a/_maps/map_files/MetaStation/z2.dmm +++ b/_maps/map_files/MetaStation/z2.dmm @@ -437,7 +437,7 @@ "iu" = (/obj/machinery/door/airlock/centcom{name = "Centcom Security"; opacity = 1; req_access_txt = "0"},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/evac) "iv" = (/turf/unsimulated/wall/fakeglass{icon_state = "fakewindows"; dir = 8},/area/centcom/evac) "iw" = (/obj/item/weapon/soap/syndie,/obj/structure/mopbucket,/obj/machinery/light{dir = 1},/turf/unsimulated/floor{icon_state = "freezerfloor"; dir = 2},/area/syndicate_mothership) -"ix" = (/obj/structure/table/woodentable,/obj/item/pizzabox,/obj/item/device/paicard,/turf/unsimulated/floor{icon_state = "bar"; dir = 2},/area/syndicate_mothership) +"ix" = (/obj/structure/table/woodentable,/obj/item/pizzabox,/obj/item/device/paicard/syndicate,/turf/unsimulated/floor{icon_state = "bar"; dir = 2},/area/syndicate_mothership) "iy" = (/obj/structure/table/woodentable,/obj/item/toy/nuke,/turf/unsimulated/floor{dir = 2; icon_state = "wood"},/area/syndicate_mothership) "iz" = (/obj/effect/landmark{name = "Commando"},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/ferry) "iA" = (/obj/structure/stool/bed/chair/office/dark,/obj/effect/landmark{name = "Response Team"},/turf/unsimulated/floor{icon_state = "dark"},/area/centcom/ferry) diff --git a/_maps/map_files/cyberiad/z2.dmm b/_maps/map_files/cyberiad/z2.dmm index b832fff59f3..bbe4923497e 100644 --- a/_maps/map_files/cyberiad/z2.dmm +++ b/_maps/map_files/cyberiad/z2.dmm @@ -505,7 +505,7 @@ "jK" = (/obj/effect/decal/warning_stripes/north,/obj/machinery/light,/turf/simulated/floor/plating/airless,/area/syndicate_mothership) "jL" = (/obj/docking_port/stationary/transit{dwidth = 3; height = 7; id = "steel_rain_transit"; name = "steel_rain in transit"; width = 7},/turf/space/transit/horizontal,/area/space) "jM" = (/obj/item/weapon/soap/syndie,/obj/structure/mopbucket,/obj/machinery/light{dir = 1},/turf/unsimulated/floor{icon_state = "freezerfloor"; dir = 2},/area/syndicate_mothership) -"jN" = (/obj/structure/table/woodentable,/obj/item/pizzabox,/obj/item/device/paicard,/turf/unsimulated/floor{icon_state = "bar"; dir = 2},/area/syndicate_mothership) +"jN" = (/obj/structure/table/woodentable,/obj/item/pizzabox,/obj/item/device/paicard/syndicate,/turf/unsimulated/floor{icon_state = "bar"; dir = 2},/area/syndicate_mothership) "jO" = (/obj/structure/table/woodentable,/obj/item/toy/nuke,/turf/unsimulated/floor{dir = 2; icon_state = "wood"},/area/syndicate_mothership) "jP" = (/turf/unsimulated/wall/abductor{icon_state = "alien21"},/area/abductor_ship) "jQ" = (/turf/unsimulated/wall/abductor{icon_state = "alien20"},/area/abductor_ship) diff --git a/code/game/objects/items/devices/paicard.dm b/code/game/objects/items/devices/paicard.dm index 68b0b8d2dca..a753b7230c6 100644 --- a/code/game/objects/items/devices/paicard.dm +++ b/code/game/objects/items/devices/paicard.dm @@ -11,11 +11,15 @@ var/obj/item/device/radio/radio var/looking_for_personality = 0 var/mob/living/silicon/pai/pai + var/list/faction = list("neutral") // The factions the pAI will inherit from the card + +/obj/item/device/paicard/syndicate + faction = list("syndicate") /obj/item/device/paicard/relaymove(var/mob/user, var/direction) if(user.stat || user.stunned) return - var/obj/item/weapon/rig/rig = src.get_rig() + var/obj/item/weapon/rig/rig = get_rig() if(istype(rig)) rig.forced_move(direction, user) @@ -260,7 +264,7 @@ to_chat(usr, "\red The request system is currently offline. Please wait another [cooldown_time] seconds.") return last_request = world.time / 10 - src.looking_for_personality = 1 + looking_for_personality = 1 paiController.findPAI(src, usr) if(href_list["wipe"]) var/confirm = input("Are you CERTAIN you wish to delete the current personality? This action cannot be undone.", "Personality Wipe") in list("Yes", "No") @@ -297,33 +301,33 @@ // WIRE_TRANSMIT = 4 /obj/item/device/paicard/proc/setPersonality(mob/living/silicon/pai/personality) - src.pai = personality - src.overlays += "pai-happy" + pai = personality + overlays += "pai-happy" /obj/item/device/paicard/proc/removePersonality() - src.pai = null - src.overlays.Cut() - src.overlays += "pai-off" + pai = null + overlays.Cut() + overlays += "pai-off" /obj/item/device/paicard var/current_emotion = 1 /obj/item/device/paicard/proc/setEmotion(var/emotion) if(pai) - src.overlays.Cut() + overlays.Cut() switch(emotion) - if(1) src.overlays += "pai-happy" - if(2) src.overlays += "pai-cat" - if(3) src.overlays += "pai-extremely-happy" - if(4) src.overlays += "pai-face" - if(5) src.overlays += "pai-laugh" - if(6) src.overlays += "pai-off" - if(7) src.overlays += "pai-sad" - if(8) src.overlays += "pai-angry" - if(9) src.overlays += "pai-what" + if(1) overlays += "pai-happy" + if(2) overlays += "pai-cat" + if(3) overlays += "pai-extremely-happy" + if(4) overlays += "pai-face" + if(5) overlays += "pai-laugh" + if(6) overlays += "pai-off" + if(7) overlays += "pai-sad" + if(8) overlays += "pai-angry" + if(9) overlays += "pai-what" current_emotion = emotion /obj/item/device/paicard/proc/alertUpdate() - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf_or_move(loc) for(var/mob/M in viewers(T)) M.show_message("\blue [src] flashes a message across its screen, \"Additional personalities available for download.\"", 3, "\blue [src] bleeps electronically.", 2) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index a81dae5234a..3eeb5a2e9d3 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -83,12 +83,13 @@ var/current_pda_messaging = null /mob/living/silicon/pai/New(var/obj/item/device/paicard) - src.loc = paicard + loc = paicard card = paicard + faction = card.faction.Copy() sradio = new(src) if(card) if(!card.radio) - card.radio = new /obj/item/device/radio(src.card) + card.radio = new /obj/item/device/radio(card) radio = card.radio //Default languages without universal translator software @@ -122,7 +123,7 @@ // this function shows the information about being silenced as a pAI in the Status panel /mob/living/silicon/pai/proc/show_silenced() - if(src.silence_time) + if(silence_time) var/timeleft = round((silence_time - world.timeofday)/10 ,1) stat(null, "Communications system reboot in -[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]") @@ -130,7 +131,7 @@ /mob/living/silicon/pai/Stat() ..() statpanel("Status") - if(src.client.statpanel == "Status") + if(client.statpanel == "Status") show_silenced() if(proc_holder_list.len)//Generic list for proc_holder objects. @@ -138,20 +139,20 @@ statpanel("[P.panel]","",P) /mob/living/silicon/pai/check_eye(var/mob/user as mob) - if(!src.current) + if(!current) return null - user.reset_perspective(src.current) + user.reset_perspective(current) return 1 /mob/living/silicon/pai/blob_act() - if(src.stat != 2) - src.adjustBruteLoss(60) - src.updatehealth() + if(stat != 2) + adjustBruteLoss(60) + updatehealth() return 1 return 0 /mob/living/silicon/pai/restrained() - if(istype(src.loc,/obj/item/device/paicard)) + if(istype(loc,/obj/item/device/paicard)) return 0 ..() @@ -165,18 +166,18 @@ // 33% chance to change prime directive (based on severity) // 33% chance of no additional effect - src.silence_time = world.timeofday + 120 * 10 // Silence for 2 minutes + silence_time = world.timeofday + 120 * 10 // Silence for 2 minutes to_chat(src, "Communication circuit overload. Shutting down and reloading communication circuits - speech and messaging functionality will be unavailable until the reboot is complete.") if(prob(20)) - var/turf/T = get_turf_or_move(src.loc) + var/turf/T = get_turf_or_move(loc) for(var/mob/M in viewers(T)) M.show_message("\red A shower of sparks spray from [src]'s inner workings.", 3, "\red You hear and smell the ozone hiss of electrical sparks being expelled violently.", 2) - return src.death(0) + return death(0) switch(pick(1,2,3)) if(1) - src.master = null - src.master_dna = null + master = null + master_dna = null to_chat(src, "You feel unbound.") if(2) var/command @@ -184,7 +185,7 @@ command = pick("Serve", "Love", "Fool", "Entice", "Observe", "Judge", "Respect", "Educate", "Amuse", "Entertain", "Glorify", "Memorialize", "Analyze") else command = pick("Serve", "Kill", "Love", "Hate", "Disobey", "Devour", "Fool", "Enrage", "Entice", "Observe", "Judge", "Respect", "Disrespect", "Consume", "Educate", "Destroy", "Disgrace", "Amuse", "Entertain", "Ignite", "Glorify", "Memorialize", "Analyze") - src.pai_law0 = "[command] your master." + pai_law0 = "[command] your master." to_chat(src, "Pr1m3 d1r3c71v3 uPd473D.") if(3) to_chat(src, "You feel an electric surge run through your circuitry and become acutely aware at how lucky you are that you can still feel at all.") @@ -194,15 +195,15 @@ switch(severity) if(1.0) - if(src.stat != 2) + if(stat != 2) adjustBruteLoss(100) adjustFireLoss(100) if(2.0) - if(src.stat != 2) + if(stat != 2) adjustBruteLoss(60) adjustFireLoss(60) if(3.0) - if(src.stat != 2) + if(stat != 2) adjustBruteLoss(30) return @@ -219,8 +220,8 @@ playsound(loc, M.attack_sound, 50, 1, 1) for(var/mob/O in viewers(src, null)) O.show_message("[M] [M.attacktext] [src]!", 1) - M.create_attack_log("attacked [src.name] ([src.ckey])") - src.create_attack_log("was attacked by [M.name] ([M.ckey])") + M.create_attack_log("attacked [name] ([ckey])") + create_attack_log("was attacked by [M.name] ([M.ckey])") var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) adjustBruteLoss(damage) updatehealth() @@ -230,7 +231,7 @@ to_chat(M, "You cannot attack people before the game has started.") return - if(istype(src.loc, /turf) && istype(src.loc.loc, /area/start)) + if(istype(loc, /turf) && istype(loc.loc, /area/start)) to_chat(M, "You cannot attack someone in the spawn area.") return @@ -245,16 +246,16 @@ M.do_attack_animation(src) var/damage = rand(10, 20) if(prob(90)) - playsound(src.loc, 'sound/weapons/slash.ogg', 25, 1, -1) + playsound(loc, 'sound/weapons/slash.ogg', 25, 1, -1) for(var/mob/O in viewers(src, null)) if((O.client && !( O.blinded ))) O.show_message(text("[] has slashed at []!", M, src), 1) if(prob(8)) flash_eyes(affect_silicon = 1) - src.adjustBruteLoss(damage) - src.updatehealth() + adjustBruteLoss(damage) + updatehealth() else - playsound(src.loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) + playsound(loc, 'sound/weapons/slashmiss.ogg', 25, 1, -1) for(var/mob/O in viewers(src, null)) if((O.client && !( O.blinded ))) O.show_message(text("[] took a swipe at []!", M, src), 1) @@ -263,16 +264,16 @@ /mob/living/silicon/pai/proc/switchCamera(var/obj/machinery/camera/C) usr:cameraFollow = null if(!C) - src.unset_machine() - src.reset_perspective(null) + unset_machine() + reset_perspective(null) return 0 - if(stat == 2 || !C.status || !(src.network in C.network)) return 0 + if(stat == 2 || !C.status || !(network in C.network)) return 0 // ok, we're alive, camera is good and in our network... - src.set_machine(src) + set_machine(src) src:current = C - src.reset_perspective(C) + reset_perspective(C) return 1 /mob/living/silicon/pai/verb/reset_record_view() @@ -291,8 +292,8 @@ /mob/living/silicon/pai/cancel_camera() set category = "pAI Commands" set name = "Cancel Camera View" - src.reset_perspective(null) - src.unset_machine() + reset_perspective(null) + unset_machine() src:cameraFollow = null //Addition by Mord_Sith to define AI's network change ability @@ -300,8 +301,8 @@ /mob/living/silicon/pai/proc/pai_network_change() set category = "pAI Commands" set name = "Change Camera Network" - src.reset_perspective(null) - src.unset_machine() + reset_perspective(null) + unset_machine() src:cameraFollow = null var/cameralist[0] @@ -316,8 +317,8 @@ if(C.network != "CREED" && C.network != "thunder" && C.network != "RD" && C.network != "toxins" && C.network != "Prison") COMPILE ERROR! This will have to be updated as camera.network is no longer a string, but a list instead cameralist[C.network] = C.network - src.network = input(usr, "Which network would you like to view?") as null|anything in cameralist - to_chat(src, "\blue Switched to [src.network] camera network.") + network = input(usr, "Which network would you like to view?") as null|anything in cameralist + to_chat(src, "\blue Switched to [network] camera network.") //End of code by Mord_Sith */ @@ -327,7 +328,7 @@ /mob/verb/makePAI(var/turf/t in view()) var/obj/item/device/paicard/card = new(t) var/mob/living/silicon/pai/pai = new(card) - pai.key = src.key + pai.key = key card.setPersonality(pai) */ @@ -394,7 +395,7 @@ var/choice var/finalized = "No" - while(finalized == "No" && src.client) + while(finalized == "No" && client) choice = input(usr,"What would you like to use for your mobile chassis icon? This decision can only be made once.") as null|anything in possible_chassis if(!choice) return @@ -425,9 +426,9 @@ set category = "IC" // Pass lying down or getting up to our pet human, if we're in a rig. - if(stat == CONSCIOUS && istype(src.loc,/obj/item/device/paicard)) + if(stat == CONSCIOUS && istype(loc,/obj/item/device/paicard)) resting = 0 - var/obj/item/weapon/rig/rig = src.get_rig() + var/obj/item/weapon/rig/rig = get_rig() if(istype(rig)) rig.force_rest(src) else @@ -449,15 +450,15 @@ updatehealth() N.use(1) user.visible_message("[user.name] applied some [W] at [src]'s damaged areas.",\ - "You apply some [W] at [src.name]'s damaged areas.") + "You apply some [W] at [name]'s damaged areas.") else - to_chat(user, "All [src.name]'s systems are nominal.") + to_chat(user, "All [name]'s systems are nominal.") return else if(W.force) visible_message("[user.name] attacks [src] with [W]!") - src.adjustBruteLoss(W.force) - src.updatehealth() + adjustBruteLoss(W.force) + updatehealth() else visible_message("[user.name] bonks [src] harmlessly with [W].") spawn(1) @@ -529,9 +530,9 @@ var/msg = "" - switch(src.stat) + switch(stat) if(CONSCIOUS) - if(!src.client) msg += "\nIt appears to be in stand-by mode." //afk + if(!client) msg += "\nIt appears to be in stand-by mode." //afk if(UNCONSCIOUS) msg += "\nIt doesn't seem to be responding." if(DEAD) msg += "\nIt looks completely unsalvageable."