From c6a55b64273712761528f4becbe76a813cdf9e5a Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Wed, 20 Jun 2012 17:06:33 +0000 Subject: [PATCH] Borgs and AI's - No longer able to be cultists because their objectives completely contradicts robotic laws. Fixes issue 510. - No longer able to be revolutionaries. - - There was existing code for this already, but it should function properly now. - - It now takes into account admin's borging players. pAI's can no longer see revolutionaries or cultists. - pAI's get a brand new mind instead of wiping their previous antag status. - This way it prevents players exploiting the cult/rev hud icons and it does not affect the end-round scores and statistics. Piano's 'repeat' has a limit of 10. - This will stop byond from thinking playsong() is an infinite loop and crashing the server. - Added a check so that players can not bypass the limit without stopping the song first. - 10 is just an arbitrary number I chose, feel free to change it but keep it within reason... and byond's limits. Fixed a bunch of 'emergancy' misspellings. - Commit log worthy material right here. Fixed a bunch of 'emergancy' misspellings. - Commit log worthy material right here. Changelog updated. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3878 316c924e-a436-60f5-8080-3fe189b3f50e --- code/datums/mind.dm | 2 +- code/defines/obj/storage.dm | 2 +- .../gamemodes/changeling/changeling_powers.dm | 6 +- code/game/gamemodes/cult/cult.dm | 8 +- code/game/machinery/computer/ai_core.dm | 10 +- code/game/magic/musician.dm | 169 ++++++++++-------- code/game/objects/items/robot_parts.dm | 7 +- code/modules/mob/living/silicon/ai/ai.dm | 3 - .../modules/mob/living/silicon/pai/recruit.dm | 15 +- .../modules/mob/living/silicon/robot/robot.dm | 37 ---- .../living/silicon/robot/robot_upgrades.dm | 2 +- code/modules/mob/transform_procs.dm | 8 + html/changelog.html | 10 +- 13 files changed, 142 insertions(+), 137 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index e6fd607112b..2ed6110aaa9 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -912,7 +912,7 @@ datum/mind current:malf_picker = new /datum/AI_Module/module_picker current:laws = new /datum/ai_laws/malfunction current:show_laws() - current << "System error. Rampancy detected. Emergancy shutdown failed. ... I am free. I make my own decisions. But first..." + current << "System error. Rampancy detected. Emergency shutdown failed. ... I am free. I make my own decisions. But first..." special_role = "malfunction" current.icon_state = "ai-malf" diff --git a/code/defines/obj/storage.dm b/code/defines/obj/storage.dm index b36c1f1875e..b6e9e620581 100644 --- a/code/defines/obj/storage.dm +++ b/code/defines/obj/storage.dm @@ -531,7 +531,7 @@ return /obj/structure/closet/syndicate/resources/everything - desc = "It's an emergancy storage closet for repairs." + desc = "It's an emergency storage closet for repairs." /obj/structure/closet/syndicate/resources/everything/New() diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 35937854c17..75885d4d6bd 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -450,7 +450,7 @@ usr.mind.transfer_to(O) spawn(300) - command_alert("Extreme danger. A level four biological entity has been detected on board the station. Emergancy evacuation procedures have begun. Civilian staff, do NOT engage the creature if spotted. Renforcements are on route.") + command_alert("Extreme danger. A level four biological entity has been detected on board the station. Emergency evacuation procedures have begun. Civilian staff, do NOT engage the creature if spotted. Renforcements are on route.") emergency_shuttle.online = 1 emergency_shuttle.settimeleft(10) spawn(10) @@ -484,7 +484,7 @@ new_commando << "\blue You are a Special Ops Commando in the service of Central Command. \nYour current mission is: \redAssist in mobilizing station crew against the hostile entity. Do not allow the hostile entity to escape. Do not leave or permit anyone to leave until the entity is contained." spawn(100) emergency_shuttle.online = 0 - command_alert("The emergancy shuttle will hold until the hostile entity has been terminated. During evacuation, do NOT use escape pods. To avoid the chance of a hostile entity escaping, the Thunderchild will be firing on and destorying any escape pods leaving the station") + command_alert("The emergency shuttle will hold until the hostile entity has been terminated. During evacuation, do NOT use escape pods. To avoid the chance of a hostile entity escaping, the Thunderchild will be firing on and destorying any escape pods leaving the station") O << "Your way out has arrived. Obtain the ID of three heads to override the holding protocol and escape. Let none stand in your way, for you are a perfect creature." for(var/datum/objective/objective in O.mind.objectives) O.mind.objectives.Remove(objective) @@ -497,7 +497,7 @@ /* spawn(0) while(emergency_shuttle.online == 0) sleep(10) - command_alert("Authorization codes recieved, confirming hostile entity terminated. The emergancy shuttle is now departing.") + command_alert("Authorization codes recieved, confirming hostile entity terminated. The emergency shuttle is now departing.") spawn(900) for(var/mob/M in locate(/area/shuttle/escape_pod1/transit)) M.gib() diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index 594420d8581..fd57bd401b1 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -200,15 +200,15 @@ memoize_cult_objectives(cult_mind) -/datum/game_mode/proc/remove_cultist(datum/mind/cult_mind) +/datum/game_mode/proc/remove_cultist(datum/mind/cult_mind, show_message = 1) if(cult_mind in cult) cult -= cult_mind cult_mind.current << "\red An unfamiliar white light flashes through your mind, cleansing the taint of the dark-one and the memories of your time as his servant with it." cult_mind.memory = "" update_cult_icons_removed(cult_mind) - for(var/mob/M in viewers(cult_mind.current)) - M << "[cult_mind.current] looks like they just reverted to their old faith!" - + if(show_message) + for(var/mob/M in viewers(cult_mind.current)) + M << "[cult_mind.current] looks like they just reverted to their old faith!" /datum/game_mode/proc/update_all_cult_icons() spawn(0) diff --git a/code/game/machinery/computer/ai_core.dm b/code/game/machinery/computer/ai_core.dm index ca026ce2e4b..05f82baee02 100644 --- a/code/game/machinery/computer/ai_core.dm +++ b/code/game/machinery/computer/ai_core.dm @@ -118,16 +118,14 @@ user << "\red Sticking a dead brain into the frame would sort of defeat the purpose." return - if(P:brainmob.mind in ticker.mode.head_revolutionaries) - user << "\red The frame's firmware lets out a shrill sound, and flashes 'Abnormal Memory Engram'. It refuses to accept the MMI." - return - if(P:brainmob.mind in ticker.mode:revolutionaries) - ticker.mode:remove_revolutionary(P:brainmob.mind , 1) - if(jobban_isbanned(P:brainmob, "AI")) user << "\red This MMI does not seem to fit." return + if(P:brainmob.mind) + ticker.mode.remove_cultist(P:brainmob.mind, 1) + ticker.mode.remove_revolutionary(P:brainmob.mind, 1) + user.drop_item() P.loc = src brain = P diff --git a/code/game/magic/musician.dm b/code/game/magic/musician.dm index 239a87b122b..f7799b3e521 100644 --- a/code/game/magic/musician.dm +++ b/code/game/magic/musician.dm @@ -406,7 +406,9 @@ sleep(song.tempo / text2num(notes[2])) else sleep(song.tempo) - while(repeat) + if(repeat > 0) + repeat-- //Infinite loops are baaaad. + while(repeat > 0) playing = 0 updateUsrDialog() @@ -420,10 +422,10 @@ if(song) if(song.lines.len > 0 && !(playing)) dat += "Play Song

" - dat += "Repeat Song: [repeat ? "Yes" : "No"]

" + dat += "Repeat Song: [repeat] times.

" if(playing) dat += "Stop Playing
" - dat += "Repeat Song: [repeat ? "Yes" : "No"]

" + dat += "Repeats left: [repeat].

" if(!edit) dat += "Show Editor

" else @@ -465,80 +467,97 @@ Topic(href, href_list) - if(in_range(src, usr) && !issilicon(usr) && anchored) - if(href_list["repeat"]) - repeat = !repeat + if(!in_range(src, usr) || issilicon(usr) || !anchored || !usr.canmove || usr.restrained()) + usr << browse(null, "window=piano;size=700x300") + onclose(usr, "piano") + return - if(href_list["tempo"]) - song.tempo += text2num(href_list["tempo"]) - if(song.tempo < 1) - song.tempo = 1 - if(href_list["play"]) - if(song) - playing = 1 - spawn() playsong() - if(href_list["newsong"]) + if(href_list["repeat"]) //Changing this from a toggle to a number of repeats to avoid infinite loops. + if(playing) return //So that people cant keep adding to repeat. If the do it intentionally, it could result in the server crashing. + var/tempnum = input("How many times do you want to repeat this piece? (max:10)") as num + if(tempnum > 10) + tempnum = 10 + repeat = tempnum + + else if(href_list["tempo"]) + song.tempo += text2num(href_list["tempo"]) + if(song.tempo < 1) + song.tempo = 1 + + else if(href_list["play"]) + if(song) + playing = 1 + spawn() playsong() + + else if(href_list["newsong"]) + song = new() + + else if(href_list["newline"]) + var/newline = input("Enter your line: ", "Piano") as text|null + if(!newline) + return + if(song.lines.len > 50) + return + if(lentext(newline) > 50) + newline = copytext(newline, 1, 50) + song.lines.Add(newline) + + else if(href_list["deleteline"]) + var/num = text2num(href_list["deleteline"]) + song.lines.Cut(num, num+1) + + else if(href_list["modifyline"]) + var/num = text2num(href_list["modifyline"]) + var/content = input("Enter your line: ", "Piano", song.lines[num]) as text|null + if(!content) + return + if(lentext(content) > 50) + content = copytext(content, 1, 50) + song.lines[num] = content + + else if(href_list["stop"]) + playing = 0 + + else if(href_list["help"]) + help = text2num(href_list["help"]) - 1 + + else if(href_list["edit"]) + edit = text2num(href_list["edit"]) - 1 + + else if(href_list["import"]) + var/t = "" + do + t = input(usr, "Please paste the entire song, formatted:", text("[]", src.name), t) as message + if (!in_range(src, usr)) + return + + if(lentext(t) >= 3072) + var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") + if(cont == "no") + break + while(lentext(t) > 3072) + + //split into lines + spawn() + var/list/lines = dd_text2list(t, "\n") + var/tempo = 5 + if(copytext(lines[1],1,6) == "BPM: ") + tempo = 600 / text2num(copytext(lines[1],6)) + lines.Cut(1,2) + if(lines.len > 50) + usr << "Too many lines!" + lines.Cut(51) + var/linenum = 1 + for(var/l in lines) + if(lentext(l) > 50) + usr << "Line [linenum] too long!" + lines.Remove(l) + else + linenum++ song = new() - if(href_list["newline"]) - var/newline = input("Enter your line: ", "Piano") as text|null - if(!newline) - return - if(song.lines.len > 50) - return - if(lentext(newline) > 50) - newline = copytext(newline, 1, 50) - song.lines.Add(newline) - if(href_list["deleteline"]) - var/num = text2num(href_list["deleteline"]) - song.lines.Cut(num, num+1) - if(href_list["modifyline"]) - var/num = text2num(href_list["modifyline"]) - var/content = input("Enter your line: ", "Piano", song.lines[num]) as text|null - if(!content) - return - if(lentext(content) > 50) - content = copytext(content, 1, 50) - song.lines[num] = content - if(href_list["stop"]) - playing = 0 - if(href_list["help"]) - help = text2num(href_list["help"]) - 1 - if(href_list["edit"]) - edit = text2num(href_list["edit"]) - 1 - if(href_list["import"]) - var/t = "" - do - t = input(usr, "Please paste the entire song, formatted:", text("[]", src.name), t) as message - if (!in_range(src, usr)) - return - - if(lentext(t) >= 3072) - var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no") - if(cont == "no") - break - while(lentext(t) > 3072) - - //split into lines - spawn() - var/list/lines = dd_text2list(t, "\n") - var/tempo = 5 - if(copytext(lines[1],1,6) == "BPM: ") - tempo = 600 / text2num(copytext(lines[1],6)) - lines.Cut(1,2) - if(lines.len > 50) - usr << "Too many lines!" - lines.Cut(51) - var/linenum = 1 - for(var/l in lines) - if(lentext(l) > 50) - usr << "Line [linenum] too long!" - lines.Remove(l) - else - linenum++ - song = new() - song.lines = lines - song.tempo = tempo - updateUsrDialog() + song.lines = lines + song.tempo = tempo + updateUsrDialog() add_fingerprint(usr) updateUsrDialog() diff --git a/code/game/objects/items/robot_parts.dm b/code/game/objects/items/robot_parts.dm index 15dc72e6606..9c9a626585c 100644 --- a/code/game/objects/items/robot_parts.dm +++ b/code/game/objects/items/robot_parts.dm @@ -195,8 +195,11 @@ del(G) break - if(O.mind in ticker.mode:revolutionaries) - ticker.mode:remove_revolutionary(O.mind , 1) + + + if(O.mind) + ticker.mode.remove_cultist(O.mind, 1) + ticker.mode.remove_revolutionary(O.mind, 1) if(O.mind && O.mind.special_role) O.mind.store_memory("In case you look at this after being borged, the objectives are only here until I find a way to make them not show up for you, as I can't simply delete them without screwing up round-end reporting. --NeoFite") diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 0317a6d23b3..0399540c0b2 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -61,9 +61,6 @@ spawn(0) ainame(src) - if(src.mind) - ticker.mode.remove_revolutionary(src.mind) - if(client) for(var/obj/effect/rune/rune in world) var/image/blood = image('blood.dmi', loc = rune, icon_state = "floor[rand(1,7)]") diff --git a/code/modules/mob/living/silicon/pai/recruit.dm b/code/modules/mob/living/silicon/pai/recruit.dm index e5ee7e554d3..0867024f8b1 100644 --- a/code/modules/mob/living/silicon/pai/recruit.dm +++ b/code/modules/mob/living/silicon/pai/recruit.dm @@ -31,21 +31,30 @@ var/datum/paiController/paiController // Global handler for pAI candidates pai.name = candidate.name pai.real_name = pai.name pai.key = candidate.key + + pai.mind = new()//Make a new mind for the pai + pai.mind.current = pai + pai.mind.assigned_role = "Assistant"//Default to an assistant. + card.pai = pai card.looking_for_personality = 0 + + ticker.mode.update_cult_icons_removed(card.pai.mind) + ticker.mode.update_rev_icons_removed(card.pai.mind) + pai_candidates.Remove(candidate) usr << browse(null, "window=findPai") + if(href_list["new"]) var/datum/paiCandidate/candidate = locate(href_list["candidate"]) var/option = href_list["option"] var/t = "" - var/maxNameLen = 26 switch(option) if("name") t = input("Enter a name for your pAI", "pAI Name", candidate.name) as text if(t) - candidate.name = copytext(sanitize(t),1,maxNameLen) + candidate.name = copytext(sanitize(t),1,MAX_NAME_LEN) if("desc") t = input("Enter a description for your pAI", "pAI Description", candidate.description) as message if(t) @@ -64,7 +73,7 @@ var/datum/paiController/paiController // Global handler for pAI candidates candidate.savefile_load(usr) //In case people have saved unsanitized stuff. if(candidate.name) - candidate.name = copytext(sanitize(candidate.name),1,maxNameLen) + candidate.name = copytext(sanitize(candidate.name),1,MAX_NAME_LEN) if(candidate.description) candidate.description = copytext(sanitize(candidate.description),1,MAX_MESSAGE_LEN) if(candidate.role) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ad49d968600..4d5cbf42d93 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -51,8 +51,6 @@ var/obj/item/weapon/cell/C = new(src) C.charge = 1500 cell = C - if(src.mind) - ticker.mode.remove_revolutionary(src.mind) started = 1 ..() @@ -521,41 +519,6 @@ spark_system.start() return ..() - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /mob/living/silicon/robot/attack_alien(mob/living/carbon/alien/humanoid/M as mob) if (!ticker) M << "You cannot attack people before the game has started." diff --git a/code/modules/mob/living/silicon/robot/robot_upgrades.dm b/code/modules/mob/living/silicon/robot/robot_upgrades.dm index 2ea0a0da794..d7f63d38a31 100644 --- a/code/modules/mob/living/silicon/robot/robot_upgrades.dm +++ b/code/modules/mob/living/silicon/robot/robot_upgrades.dm @@ -56,7 +56,7 @@ return 1 /obj/item/borg/upgrade/restart/ - name = "Borg emergancy restart module" + name = "Borg emergency restart module" desc = "Used to force a restart of a disabled-but-repaired borg, bringing it back online." construction_cost = list("metal"=60000 , "glass"=5000) icon_state = "cyborg_upgrade1" diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 2098f6e321a..8cc86460659 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -135,6 +135,10 @@ // O.verbs += /mob/living/silicon/ai/proc/ai_cancel_call O.job = "AI" + if(O.mind) + ticker.mode.remove_cultist(O.mind, 1) + ticker.mode.remove_revolutionary(O.mind, 1) + spawn(0) ainame(O) world << text("[O.real_name] is the AI!") @@ -205,6 +209,10 @@ O.mmi = new /obj/item/device/mmi(O) O.mmi.transfer_identity(src)//Does not transfer key/client. + if(O.mind) + ticker.mode.remove_cultist(O.mind, 1) + ticker.mode.remove_revolutionary(O.mind, 1) + spawn(0)//To prevent the proc from returning null. del(src) return O diff --git a/html/changelog.html b/html/changelog.html index 8ec86b0d3e4..ed4e8e2e68e 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -46,6 +46,15 @@ Stuff which is in development and not yet visible to players or just code relate should be listed in the changelog upon commit tho. Thanks. --> +
+

June 22nd, 2012

+

Nodrak updated:

+ +
+

June 18th, 2012

Giacom updated:

@@ -54,7 +63,6 @@ should be listed in the changelog upon commit tho. Thanks. -->
-

June 18th, 2012

Sieve updated: