mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-28 19:11:37 +00:00
Wiring Upgrade
Continues the wiring upgrade. Now cameras, airlocks, robots, and air alarms also use the new wire datum system. Global wiring code is now removed but there are sneaky objects which didn't rely on them such as mulebots and autolathes. Fixes a few issues from the previous upgrade.
This commit is contained in:
@@ -121,9 +121,6 @@
|
||||
pulse(var/radio = 0)
|
||||
if(src.connected && src.wires)
|
||||
connected.Pulse(src)
|
||||
else if(istype(src.loc, /obj/machinery/door/airlock) && src.airlock_wire && src.wires)
|
||||
var/obj/machinery/door/airlock/A = src.loc
|
||||
A.pulse(src.airlock_wire)
|
||||
else if(holder)
|
||||
holder.process_activation(src, 1, 0)
|
||||
else
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
/mob/living/silicon/robot/proc/handle_regular_status_updates()
|
||||
|
||||
if(src.camera && !scrambledcodes)
|
||||
if(src.stat == 2 || isWireCut(5))
|
||||
if(src.stat == 2 || wires.IsIndexCut(BORG_WIRE_CAMERA))
|
||||
src.camera.status = 0
|
||||
else
|
||||
src.camera.status = 1
|
||||
|
||||
@@ -21,6 +21,7 @@ var/list/robot_verbs_default = list(
|
||||
var/crisis //Admin-settable for combat module use.
|
||||
var/crisis_override = 0
|
||||
var/integrated_light_power = 6
|
||||
var/datum/wires/robot/wires
|
||||
|
||||
//Hud stuff
|
||||
|
||||
@@ -81,6 +82,8 @@ var/list/robot_verbs_default = list(
|
||||
|
||||
add_language("Robot Talk", 1)
|
||||
|
||||
wires = new(src)
|
||||
|
||||
ident = rand(1, 999)
|
||||
updatename("Default")
|
||||
updateicon()
|
||||
@@ -106,7 +109,7 @@ var/list/robot_verbs_default = list(
|
||||
camera = new /obj/machinery/camera(src)
|
||||
camera.c_tag = real_name
|
||||
camera.network = list("SS13","Robots")
|
||||
if(isWireCut(5)) // 5 = BORG CAMERA
|
||||
if(wires.IsIndexCut(BORG_WIRE_CAMERA))
|
||||
camera.status = 0
|
||||
|
||||
initialize_components()
|
||||
@@ -303,6 +306,7 @@ var/list/robot_verbs_default = list(
|
||||
|
||||
choose_icon(6,module_sprites)
|
||||
radio.config(module.channels)
|
||||
notify_ai(2)
|
||||
|
||||
/mob/living/silicon/robot/proc/updatename(var/prefix as text)
|
||||
if(prefix)
|
||||
@@ -320,6 +324,8 @@ var/list/robot_verbs_default = list(
|
||||
changed_name = custom_name
|
||||
else
|
||||
changed_name = "[modtype] [braintype]-[num2text(ident)]"
|
||||
|
||||
notify_ai(3, real_name, changed_name)
|
||||
real_name = changed_name
|
||||
name = real_name
|
||||
|
||||
@@ -672,7 +678,7 @@ var/list/robot_verbs_default = list(
|
||||
user << "You close the cover."
|
||||
opened = 0
|
||||
updateicon()
|
||||
else if(wiresexposed && isWireCut(1) && isWireCut(2) && isWireCut(3) && isWireCut(4) && isWireCut(5))
|
||||
else if(wiresexposed && wires.IsAllCut())
|
||||
//Cell is out, wires are exposed, remove MMI, produce damaged chassis, baleet original mob.
|
||||
if(!mmi)
|
||||
user << "\The [src] has no brain to remove."
|
||||
@@ -743,7 +749,7 @@ var/list/robot_verbs_default = list(
|
||||
|
||||
else if (istype(W, /obj/item/weapon/wirecutters) || istype(W, /obj/item/device/multitool))
|
||||
if (wiresexposed)
|
||||
interact(user)
|
||||
wires.Interact(user)
|
||||
else
|
||||
user << "You can't reach the wiring."
|
||||
|
||||
@@ -1231,6 +1237,13 @@ var/list/robot_verbs_default = list(
|
||||
R << "Buffers flushed and reset. Camera system shutdown. All systems operational."
|
||||
src.verbs -= /mob/living/silicon/robot/proc/ResetSecurityCodes
|
||||
|
||||
/mob/living/silicon/robot/proc/SetLockdown(var/state = 1)
|
||||
// They stay locked down if their wire is cut.
|
||||
if(wires.LockedCut())
|
||||
state = 1
|
||||
lockcharge = state
|
||||
update_canmove()
|
||||
|
||||
/mob/living/silicon/robot/mode()
|
||||
set name = "Activate Held Object"
|
||||
set category = "IC"
|
||||
@@ -1310,4 +1323,15 @@ var/list/robot_verbs_default = list(
|
||||
var/datum/robot_component/RC = get_component("comms")
|
||||
use_power(RC.active_usage)
|
||||
return 1
|
||||
return 0
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/robot/proc/notify_ai(var/notifytype, var/oldname, var/newname)
|
||||
if(!connected_ai)
|
||||
return
|
||||
switch(notifytype)
|
||||
if(1) //New Cyborg
|
||||
connected_ai << "<br><br><span class='notice'>NOTICE - New cyborg connection detected: <a href='byond://?src=\ref[connected_ai];track2=\ref[connected_ai];track=\ref[src]'>[name]</a></span><br>"
|
||||
if(2) //New Module
|
||||
connected_ai << "<br><br><span class='notice'>NOTICE - Cyborg module change detected: [name] has loaded the [module.name] module.</span><br>"
|
||||
if(3) //New Name
|
||||
connected_ai << "<br><br><span class='notice'>NOTICE - Cyborg reclassification detected: [oldname] is now designated as [newname].</span><br>"
|
||||
|
||||
@@ -1,149 +0,0 @@
|
||||
#define BORG_WIRE_LAWCHECK 1
|
||||
#define BORG_WIRE_MAIN_POWER1 2
|
||||
#define BORG_WIRE_MAIN_POWER2 3
|
||||
#define BORG_WIRE_AI_CONTROL 4
|
||||
#define BORG_WIRE_CAMERA 5
|
||||
|
||||
/proc/RandomBorgWires()
|
||||
//to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else).
|
||||
var/list/Borgwires = list(0, 0, 0, 0, 0)
|
||||
BorgIndexToFlag = list(0, 0, 0, 0, 0)
|
||||
BorgIndexToWireColor = list(0, 0, 0, 0, 0)
|
||||
BorgWireColorToIndex = list(0, 0, 0, 0, 0)
|
||||
var/flagIndex = 1
|
||||
//I think it's easier to read this way, also doesn't rely on the random number generator to land on a new wire.
|
||||
var/list/colorIndexList = list(BORG_WIRE_LAWCHECK, BORG_WIRE_MAIN_POWER1, BORG_WIRE_MAIN_POWER2, BORG_WIRE_AI_CONTROL, BORG_WIRE_CAMERA)
|
||||
for (var/flag=1, flag<=16, flag+=flag)
|
||||
var/colorIndex = pick(colorIndexList)
|
||||
if (Borgwires[colorIndex]==0)
|
||||
Borgwires[colorIndex] = flag
|
||||
BorgIndexToFlag[flagIndex] = flag
|
||||
BorgIndexToWireColor[flagIndex] = colorIndex
|
||||
BorgWireColorToIndex[colorIndex] = flagIndex
|
||||
colorIndexList -= colorIndex // Shortens the list.
|
||||
//world.log << "Flag: [flag], CIndex: [colorIndex], FIndex: [flagIndex]"
|
||||
flagIndex+=1
|
||||
return Borgwires
|
||||
|
||||
/mob/living/silicon/robot/proc/isWireColorCut(var/wireColor)
|
||||
var/wireFlag = BorgWireColorToFlag[wireColor]
|
||||
return ((src.borgwires & wireFlag) == 0)
|
||||
|
||||
/mob/living/silicon/robot/proc/isWireCut(var/wireIndex)
|
||||
var/wireFlag = BorgIndexToFlag[wireIndex]
|
||||
return ((src.borgwires & wireFlag) == 0)
|
||||
|
||||
/mob/living/silicon/robot/proc/cut(var/wireColor)
|
||||
var/wireFlag = BorgWireColorToFlag[wireColor]
|
||||
var/wireIndex = BorgWireColorToIndex[wireColor]
|
||||
borgwires &= ~wireFlag
|
||||
switch(wireIndex)
|
||||
if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI
|
||||
if (src.lawupdate == 1)
|
||||
src << "LawSync protocol engaged."
|
||||
src.show_laws()
|
||||
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
|
||||
if (src.connected_ai)
|
||||
src.connected_ai = null
|
||||
if (BORG_WIRE_CAMERA)
|
||||
if(!isnull(src.camera) && !scrambledcodes)
|
||||
src.camera.status = 0
|
||||
src.camera.deactivate(usr, 0) // Will kick anyone who is watching the Cyborg's camera.
|
||||
|
||||
src.interact(usr)
|
||||
|
||||
/mob/living/silicon/robot/proc/mend(var/wireColor)
|
||||
var/wireFlag = BorgWireColorToFlag[wireColor]
|
||||
var/wireIndex = BorgWireColorToIndex[wireColor]
|
||||
borgwires |= wireFlag
|
||||
switch(wireIndex)
|
||||
if(BORG_WIRE_LAWCHECK) //turns law updates back on assuming the borg hasn't been emagged
|
||||
if (src.lawupdate == 0 && !src.emagged)
|
||||
src.lawupdate = 1
|
||||
if(BORG_WIRE_CAMERA)
|
||||
if (!isnull(src.camera) && !scrambledcodes)
|
||||
src.camera.status = 1
|
||||
src.camera.deactivate(usr, 0) // Will kick anyone who is watching the Cyborg's camera.
|
||||
|
||||
src.interact(usr)
|
||||
|
||||
|
||||
/mob/living/silicon/robot/proc/pulse(var/wireColor)
|
||||
var/wireIndex = BorgWireColorToIndex[wireColor]
|
||||
switch(wireIndex)
|
||||
if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh
|
||||
if (src.lawupdate)
|
||||
src.lawsync()
|
||||
src.photosync()
|
||||
|
||||
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
|
||||
if(!src.emagged)
|
||||
src.connected_ai = select_active_ai()
|
||||
|
||||
if (BORG_WIRE_CAMERA)
|
||||
if(!isnull(src.camera) && src.camera.status && !scrambledcodes)
|
||||
src.camera.deactivate(usr, 0) // Kick anyone watching the Cyborg's camera, doesn't display you disconnecting the camera.
|
||||
usr << "[src]'s camera lens focuses loudly."
|
||||
src << "Your camera lens focuses loudly."
|
||||
|
||||
src.interact(usr)
|
||||
|
||||
/mob/living/silicon/robot/proc/interact(mob/user)
|
||||
if(wiresexposed && (!istype(user, /mob/living/silicon)))
|
||||
user.set_machine(src)
|
||||
var/t1 = text("<B>Access Panel</B><br>\n")
|
||||
var/list/Borgwires = list(
|
||||
"Orange" = 1,
|
||||
"Dark red" = 2,
|
||||
"White" = 3,
|
||||
"Yellow" = 4,
|
||||
"Blue" = 5,
|
||||
)
|
||||
for(var/wiredesc in Borgwires)
|
||||
var/is_uncut = src.borgwires & BorgWireColorToFlag[Borgwires[wiredesc]]
|
||||
t1 += "[wiredesc] wire: "
|
||||
if(!is_uncut)
|
||||
t1 += "<a href='?src=\ref[src];borgwires=[Borgwires[wiredesc]]'>Mend</a>"
|
||||
else
|
||||
t1 += "<a href='?src=\ref[src];borgwires=[Borgwires[wiredesc]]'>Cut</a> "
|
||||
t1 += "<a href='?src=\ref[src];pulse=[Borgwires[wiredesc]]'>Pulse</a> "
|
||||
t1 += "<br>"
|
||||
t1 += text("<br>\n[(src.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]<br>\n[(src.connected_ai ? "The AI link light is on." : "The AI link light is off.")]")
|
||||
t1 += text("<br>\n[((!isnull(src.camera) && src.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]<br>\n")
|
||||
t1 += text("<p><a href='?src=\ref[src];close2=1'>Close</a></p>\n")
|
||||
user << browse(t1, "window=borgwires")
|
||||
onclose(user, "borgwires")
|
||||
|
||||
/mob/living/silicon/robot/Topic(href, href_list)
|
||||
..()
|
||||
if (((in_range(src, usr) && istype(src.loc, /turf))) && !istype(usr, /mob/living/silicon))
|
||||
usr.set_machine(src)
|
||||
if (href_list["borgwires"])
|
||||
var/t1 = text2num(href_list["borgwires"])
|
||||
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
|
||||
usr << "You need wirecutters!"
|
||||
return
|
||||
if (src.isWireColorCut(t1))
|
||||
src.mend(t1)
|
||||
else
|
||||
src.cut(t1)
|
||||
else if (href_list["pulse"])
|
||||
var/t1 = text2num(href_list["pulse"])
|
||||
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
usr << "You need a multitool!"
|
||||
return
|
||||
if (src.isWireColorCut(t1))
|
||||
usr << "You can't pulse a cut wire."
|
||||
return
|
||||
else
|
||||
src.pulse(t1)
|
||||
else if (href_list["close2"])
|
||||
usr << browse(null, "window=borgwires")
|
||||
usr.unset_machine()
|
||||
return
|
||||
|
||||
#undef BORG_WIRE_LAWCHECK
|
||||
#undef BORG_WIRE_MAIN_POWER1
|
||||
#undef BORG_WIRE_MAIN_POWER2
|
||||
#undef BORG_WIRE_AI_CONTROL
|
||||
#undef BORG_WIRE_CAMERA
|
||||
@@ -60,6 +60,34 @@
|
||||
for(var/mob/M in viewers(src))
|
||||
M.show_message( message, 1, blind_message, 2)
|
||||
|
||||
// Show a message to all mobs in earshot of this one
|
||||
// This would be for audible actions by the src mob
|
||||
// message is the message output to anyone who can hear.
|
||||
// self_message (optional) is what the src mob hears.
|
||||
// deaf_message (optional) is what deaf people will see.
|
||||
// hearing_distance (optional) is the range, how many tiles away the message can be heard.
|
||||
/mob/audible_message(var/message, var/deaf_message, var/hearing_distance, var/self_message)
|
||||
var/range = 7
|
||||
if(hearing_distance)
|
||||
range = hearing_distance
|
||||
var/msg = message
|
||||
for(var/mob/M in get_mobs_in_view(range, src))
|
||||
if(self_message && M==src)
|
||||
msg = self_message
|
||||
M.show_message( msg, 2, deaf_message, 1)
|
||||
|
||||
// Show a message to all mobs in earshot of this atom
|
||||
// Use for objects performing audible actions
|
||||
// message is the message output to anyone who can hear.
|
||||
// deaf_message (optional) is what deaf people will see.
|
||||
// hearing_distance (optional) is the range, how many tiles away the message can be heard.
|
||||
/atom/proc/audible_message(var/message, var/deaf_message, var/hearing_distance)
|
||||
var/range = 7
|
||||
if(hearing_distance)
|
||||
range = hearing_distance
|
||||
for(var/mob/M in get_mobs_in_view(range, src))
|
||||
M.show_message( message, 2, deaf_message, 1)
|
||||
|
||||
|
||||
/mob/proc/findname(msg)
|
||||
for(var/mob/M in mob_list)
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
O.mmi.transfer_identity(src)
|
||||
|
||||
callHook("borgify", list(O))
|
||||
|
||||
O.notify_ai(1)
|
||||
O.Namepick()
|
||||
|
||||
spawn(0)//To prevent the proc from returning null.
|
||||
|
||||
@@ -1228,7 +1228,6 @@
|
||||
update()
|
||||
else if (last_ch != charging)
|
||||
queue_icon_update()
|
||||
src.updateDialog()
|
||||
|
||||
// val 0=off, 1=off(auto) 2=on 3=on(auto)
|
||||
// on 0=off, 1=on, 2=autooff
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
if(istype(M, /mob/living/silicon/robot))
|
||||
var/mob/living/silicon/robot/Robot = M
|
||||
if(Robot.mmi) del(Robot.mmi)
|
||||
Robot.notify_ai(1)
|
||||
else
|
||||
for(var/obj/item/W in M)
|
||||
if(istype(W, /obj/item/weapon/implant)) //TODO: Carn. give implants a dropped() or something
|
||||
|
||||
Reference in New Issue
Block a user