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
This commit is contained in:
johnsonmt88@gmail.com
2012-06-20 17:06:33 +00:00
parent 117e4b643e
commit c6a55b6427
13 changed files with 142 additions and 137 deletions

View File

@@ -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 << "<b>System error. Rampancy detected. Emergancy shutdown failed. ... I am free. I make my own decisions. But first...</b>"
current << "<b>System error. Rampancy detected. Emergency shutdown failed. ... I am free. I make my own decisions. But first...</b>"
special_role = "malfunction"
current.icon_state = "ai-malf"

View File

@@ -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()

View File

@@ -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: \red<B>Assist 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.</B>"
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()

View File

@@ -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 <FONT size = 3><B>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.</B></FONT>"
cult_mind.memory = ""
update_cult_icons_removed(cult_mind)
for(var/mob/M in viewers(cult_mind.current))
M << "<FONT size = 3>[cult_mind.current] looks like they just reverted to their old faith!</FONT>"
if(show_message)
for(var/mob/M in viewers(cult_mind.current))
M << "<FONT size = 3>[cult_mind.current] looks like they just reverted to their old faith!</FONT>"
/datum/game_mode/proc/update_all_cult_icons()
spawn(0)

View File

@@ -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

View File

@@ -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 += "<A href='?src=\ref[src];play=1'>Play Song</A><BR><BR>"
dat += "<A href='?src=\ref[src];repeat=1'>Repeat Song: [repeat ? "Yes" : "No"]</A><BR><BR>"
dat += "<A href='?src=\ref[src];repeat=1'>Repeat Song: [repeat] times.</A><BR><BR>"
if(playing)
dat += "<A href='?src=\ref[src];stop=1'>Stop Playing</A><BR>"
dat += "<A href='?src=\ref[src];repeat=1'>Repeat Song: [repeat ? "Yes" : "No"]</A><BR><BR>"
dat += "Repeats left: [repeat].<BR><BR>"
if(!edit)
dat += "<A href='?src=\ref[src];edit=2'>Show Editor</A><BR><BR>"
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()

View File

@@ -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")

View File

@@ -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)]")

View File

@@ -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)

View File

@@ -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."

View File

@@ -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"

View File

@@ -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("<b>[O.real_name] is the AI!</b>")
@@ -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

View File

@@ -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. -->
<!-- To take advantage of the pretty new format (well it was new when I wrote this anyway), open the "add-to-changelog.html" file in any browser and add the stuff and then generate the html code and paste it here -->
<div class="commit sansserif">
<h2 class="date">June 22nd, 2012</h2>
<h3 class="author">Nodrak updated:</h3>
<ul class="changes bgimages16">
<li class="bugfix">AIs, Borgs are no longer able to be cultists or revolutionaries as their objectives completely contradict their laws. They can still be subverted of course.</li>
<li class="bugfix">pAI's no longer keep cult or rev icons.</li>
</ul>
</div>
<div class="commit sansserif">
<h2 class="date">June 18th, 2012</h2>
<h3 class="author">Giacom updated:</h3>
@@ -54,7 +63,6 @@ should be listed in the changelog upon commit tho. Thanks. -->
</ul>
</div>
<div class="commit sansserif">
<h2 class="date">June 18th, 2012</h2>
<h3 class="author">Sieve updated:</h3>