mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-03 05:52:43 +00:00
Moved cyborg law-syncing back into New().
New Borgs now sync with the AI with the fewest associated borgs. So, say there were 3 AIs and 6 borgs, each would get two each. Cyborg cells now default to 7500 (like the transform procs do), this is so admin-spawn borgs don't end up with 1500-charge cells with a max of 1000-charge. Default lawset is asimov rather than an empty lawset pulsing a borg's sync wire will cause it to randomly pick an AI. As a borg, your laws are shown to you at login. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4641 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -364,25 +364,32 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
|||||||
return borgs[select]
|
return borgs[select]
|
||||||
|
|
||||||
//When a borg is activated, it can choose which AI it wants to be slaved to
|
//When a borg is activated, it can choose which AI it wants to be slaved to
|
||||||
/proc/activeais()
|
/proc/active_ais()
|
||||||
var/select = null
|
. = list()
|
||||||
var/list/names = list()
|
for(var/mob/living/silicon/ai/A in living_mob_list)
|
||||||
var/list/ais = list()
|
if(A.stat == DEAD)
|
||||||
var/list/namecounts = list()
|
|
||||||
for (var/mob/living/silicon/ai/A in living_mob_list)
|
|
||||||
var/name = A.real_name
|
|
||||||
if (A.stat == 2)
|
|
||||||
continue
|
continue
|
||||||
if (A.control_disabled == 1)
|
if(A.control_disabled == 1)
|
||||||
continue
|
continue
|
||||||
else
|
. += A
|
||||||
names.Add(name)
|
return .
|
||||||
namecounts[name] = 1
|
|
||||||
ais[name] = A
|
|
||||||
|
|
||||||
|
//Find an active ai with the least borgs. VERBOSE PROCNAME HUH!
|
||||||
|
/proc/select_active_ai_with_fewest_borgs()
|
||||||
|
var/mob/living/silicon/ai/selected
|
||||||
|
var/list/active = active_ais()
|
||||||
|
for(var/mob/living/silicon/ai/A in active)
|
||||||
|
if(!selected || (selected.connected_robots > A.connected_robots))
|
||||||
|
selected = A
|
||||||
|
|
||||||
|
return selected
|
||||||
|
|
||||||
|
/proc/select_active_ai(var/mob/user)
|
||||||
|
var/list/ais = active_ais()
|
||||||
if(ais.len)
|
if(ais.len)
|
||||||
select = input("AI signals detected:", "AI selection") in ais
|
if(user) . = input(usr,"AI signals detected:", "AI selection") in ais
|
||||||
return ais[select]
|
else . = pick(ais)
|
||||||
|
return .
|
||||||
|
|
||||||
//Returns a list of all mobs with their name
|
//Returns a list of all mobs with their name
|
||||||
/proc/getmobs()
|
/proc/getmobs()
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
usr << "The upload computer is broken!"
|
usr << "The upload computer is broken!"
|
||||||
return
|
return
|
||||||
|
|
||||||
src.current = activeais()
|
src.current = select_active_ai(user)
|
||||||
|
|
||||||
if (!src.current)
|
if (!src.current)
|
||||||
usr << "No active AIs detected."
|
usr << "No active AIs detected."
|
||||||
|
|||||||
@@ -1,46 +1,6 @@
|
|||||||
/mob/living/silicon/robot/Login(var/syndie = 0)
|
/mob/living/silicon/robot/Login()
|
||||||
..()
|
..()
|
||||||
regenerate_icons()
|
regenerate_icons()
|
||||||
|
show_laws(0)
|
||||||
if(!started)
|
if(mind) ticker.mode.remove_revolutionary(mind)
|
||||||
if(!syndie)
|
|
||||||
connected_ai = activeais()
|
|
||||||
if(connected_ai)
|
|
||||||
connected_ai.connected_robots += src
|
|
||||||
// laws = connected_ai.laws //The borg inherits its AI's laws
|
|
||||||
laws = new /datum/ai_laws
|
|
||||||
lawsync()
|
|
||||||
src << "<b>Unit slaved to [connected_ai.name], downloading laws.</b>"
|
|
||||||
lawupdate = 1
|
|
||||||
else
|
|
||||||
laws = new /datum/ai_laws/asimov
|
|
||||||
lawupdate = 0
|
|
||||||
src << "<b>Unable to locate an AI, reverting to standard Asimov laws.</b>"
|
|
||||||
else
|
|
||||||
laws = new /datum/ai_laws/antimov
|
|
||||||
lawupdate = 0
|
|
||||||
scrambledcodes = 1
|
|
||||||
src << "Follow your laws."
|
|
||||||
cell.maxcharge = 25000
|
|
||||||
cell.charge = 25000
|
|
||||||
module = new /obj/item/weapon/robot_module/syndicate(src)
|
|
||||||
hands.icon_state = "standard"
|
|
||||||
icon_state = "secborg"
|
|
||||||
modtype = "Synd"
|
|
||||||
|
|
||||||
radio = new /obj/item/device/radio/borg(src)
|
|
||||||
if(!scrambledcodes && !camera)
|
|
||||||
camera = new /obj/machinery/camera(src)
|
|
||||||
camera.c_tag = real_name
|
|
||||||
camera.network = "SS13"
|
|
||||||
if(isWireCut(5)) // 5 = BORG CAMERA
|
|
||||||
camera.status = 0
|
|
||||||
if(!cell)
|
|
||||||
var/obj/item/weapon/cell/C = new(src)
|
|
||||||
C.charge = 1500
|
|
||||||
cell = C
|
|
||||||
if(mind)
|
|
||||||
ticker.mode.remove_revolutionary(mind)
|
|
||||||
started = 1
|
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
icon_state = "robot"
|
icon_state = "robot"
|
||||||
maxHealth = 300
|
maxHealth = 300
|
||||||
health = 300
|
health = 300
|
||||||
var/started = null//A fix to ensure people don't try to bypass law assignment. Initial assignment sets it to one but it check on login whether they have been initiated -Sieve
|
|
||||||
var/sight_mode = 0
|
var/sight_mode = 0
|
||||||
|
|
||||||
//Hud stuff
|
//Hud stuff
|
||||||
@@ -60,15 +59,43 @@
|
|||||||
spark_system.set_up(5, 0, src)
|
spark_system.set_up(5, 0, src)
|
||||||
spark_system.attach(src)
|
spark_system.attach(src)
|
||||||
|
|
||||||
if(real_name == "Cyborg")
|
if(cmptext(real_name,"Cyborg"))
|
||||||
ident = rand(1, 999)
|
ident = rand(1, 999)
|
||||||
real_name += "-[ident]"
|
real_name += "-[ident]"
|
||||||
name = real_name
|
name = real_name
|
||||||
|
|
||||||
if(!cell)
|
if(!cell)
|
||||||
var/obj/item/weapon/cell/C = new(src)
|
cell = new /obj/item/weapon/cell(src)
|
||||||
C.charge = 1500
|
cell.maxcharge = 7500
|
||||||
cell = C
|
cell.charge = 7500
|
||||||
|
|
||||||
|
if(syndie)
|
||||||
|
laws = new /datum/ai_laws/antimov()
|
||||||
|
lawupdate = 0
|
||||||
|
scrambledcodes = 1
|
||||||
|
cell.maxcharge = 25000
|
||||||
|
cell.charge = 25000
|
||||||
|
module = new /obj/item/weapon/robot_module/syndicate(src)
|
||||||
|
hands.icon_state = "standard"
|
||||||
|
icon_state = "secborg"
|
||||||
|
modtype = "Synd"
|
||||||
|
else
|
||||||
|
laws = new /datum/ai_laws/asimov()
|
||||||
|
connected_ai = select_active_ai_with_fewest_borgs()
|
||||||
|
if(connected_ai)
|
||||||
|
connected_ai.connected_robots += src
|
||||||
|
lawsync()
|
||||||
|
lawupdate = 1
|
||||||
|
else
|
||||||
|
lawupdate = 0
|
||||||
|
|
||||||
|
radio = new /obj/item/device/radio/borg(src)
|
||||||
|
if(!scrambledcodes && !camera)
|
||||||
|
camera = new /obj/machinery/camera(src)
|
||||||
|
camera.c_tag = real_name
|
||||||
|
camera.network = "SS13"
|
||||||
|
if(isWireCut(5)) // 5 = BORG CAMERA
|
||||||
|
camera.status = 0
|
||||||
..()
|
..()
|
||||||
|
|
||||||
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
|
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
|
||||||
@@ -102,16 +129,12 @@
|
|||||||
module = new /obj/item/weapon/robot_module/butler(src)
|
module = new /obj/item/weapon/robot_module/butler(src)
|
||||||
hands.icon_state = "service"
|
hands.icon_state = "service"
|
||||||
var/icontype = input("Select an icon!", "Robot", null, null) in list("Waitress", "Bro", "Butler", "Kent", "Rich")
|
var/icontype = input("Select an icon!", "Robot", null, null) in list("Waitress", "Bro", "Butler", "Kent", "Rich")
|
||||||
if(icontype== "Waitress")
|
switch(icontype)
|
||||||
icon_state = "Service"
|
if("Waitress") icon_state = "Service"
|
||||||
else if(icontype == "Kent")
|
if("Kent") icon_state = "toiletbot"
|
||||||
icon_state = "toiletbot"
|
if("Bro") icon_state = "Brobot"
|
||||||
else if(icontype == "Bro")
|
if("Rich") icon_state = "maximillion"
|
||||||
icon_state = "Brobot"
|
else icon_state = "Service2"
|
||||||
else if(icontype == "Rich")
|
|
||||||
icon_state = "maximillion"
|
|
||||||
else
|
|
||||||
icon_state = "Service2"
|
|
||||||
modtype = "Butler"
|
modtype = "Butler"
|
||||||
feedback_inc("cyborg_service",1)
|
feedback_inc("cyborg_service",1)
|
||||||
|
|
||||||
@@ -166,7 +189,7 @@
|
|||||||
//not really necessary but just to avoid annoying people with
|
//not really necessary but just to avoid annoying people with
|
||||||
//unique names seeming as nobody could give me a straight answer as
|
//unique names seeming as nobody could give me a straight answer as
|
||||||
//to whether to remove custom borg names completely.
|
//to whether to remove custom borg names completely.
|
||||||
if(copytext(real_name, 1, 7) == "Cyborg")
|
if(cmptext(copytext(real_name, 1, 7),"Cyborg"))
|
||||||
real_name = "[prefix] [real_name]"
|
real_name = "[prefix] [real_name]"
|
||||||
name = real_name
|
name = real_name
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
|
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
|
||||||
if(!src.emagged)
|
if(!src.emagged)
|
||||||
src.connected_ai = activeais()
|
src.connected_ai = select_active_ai()
|
||||||
|
|
||||||
if (BORG_WIRE_CAMERA)
|
if (BORG_WIRE_CAMERA)
|
||||||
if(!isnull(src.camera) && src.camera.status && !scrambledcodes)
|
if(!isnull(src.camera) && src.camera.status && !scrambledcodes)
|
||||||
|
|||||||
Reference in New Issue
Block a user