Merge remote-tracking branch 'upstream/master' into nanites

This commit is contained in:
Archie
2021-06-07 00:55:47 -03:00
88 changed files with 6360 additions and 6116 deletions
+12 -4
View File
@@ -334,8 +334,13 @@ GLOBAL_LIST_EMPTY(teleportlocs)
F.update_fire_light(fire)
for(var/obj/machinery/light/L in src)
L.update()
/area/proc/updateicon()
/**
* Update the icon state of the area
*
* Im not sure what the heck this does, somethign to do with weather being able to set icon
* states on areas?? where the heck would that even display?
*/
/area/update_icon_state()
var/weather_icon
for(var/V in SSweather.processing)
var/datum/weather/W = V
@@ -345,7 +350,10 @@ GLOBAL_LIST_EMPTY(teleportlocs)
if(!weather_icon)
icon_state = null
/area/space/updateicon()
/**
* Update the icon of the area (overridden to always be null for space
*/
/area/space/update_icon_state()
icon_state = null
/*
@@ -378,7 +386,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/area/proc/power_change()
for(var/obj/machinery/M in src) // for each machine in the area
M.power_change() // reverify power status (to update icons etc.)
updateicon()
update_icon()
/area/proc/usage(chan)
var/used = 0
+927 -901
View File
File diff suppressed because it is too large Load Diff
@@ -213,6 +213,7 @@
weight = 4
cost = 10
requirements = list(101,101,30,25,20,20,15,15,15,10)
minimum_players = 15
repeatable = TRUE
high_population_requirement = 10
flags = TRAITOR_RULESET
@@ -229,6 +230,7 @@
weight = 4
cost = 5
requirements = list(101,30,25,20,15,10,10,5,5,5)
minimum_players = 10
repeatable = TRUE
high_population_requirement = 10
flags = TRAITOR_RULESET
@@ -17,6 +17,7 @@
weight = 5
cost = 10
requirements = list(101,101,30,25,20,20,15,15,15,15)
minimum_players = 15
high_population_requirement = 10
var/autotraitor_cooldown = 450 // 15 minutes (ticks once per 2 sec)
chaos_min = 2.5
@@ -34,6 +35,7 @@
weight = 5
cost = 0
requirements = list(101,25,25,20,20,15,15,10,10,10)
minimum_players = 10
high_population_requirement = 10
//var/autotraitor_cooldown = 450 // 15 minutes (ticks once per 2 sec)
chaos_min = 2.0
@@ -186,6 +188,7 @@
weight = 3
cost = 10
requirements = list(101,101,50,40,40,30,30,30,20,20)
minimum_players = 15
high_population_requirement = 10
var/team_mode_probability = 30
chaos_min = 3.0
+48 -48
View File
@@ -1,48 +1,48 @@
/obj/machinery/bluespace_beacon
icon = 'icons/obj/objects.dmi'
icon_state = "floor_beaconf"
name = "bluespace gigabeacon"
desc = "A device that draws power from bluespace and creates a permanent tracking beacon."
level = 1 // underfloor
layer = LOW_OBJ_LAYER
use_power = IDLE_POWER_USE
idle_power_usage = 0
var/obj/item/beacon/Beacon
/obj/machinery/bluespace_beacon/Initialize()
. = ..()
var/turf/T = loc
Beacon = new(T)
Beacon.invisibility = INVISIBILITY_MAXIMUM
hide(T.intact)
/obj/machinery/bluespace_beacon/Destroy()
QDEL_NULL(Beacon)
return ..()
// update the invisibility and icon
/obj/machinery/bluespace_beacon/hide(intact)
invisibility = intact ? INVISIBILITY_MAXIMUM : 0
updateicon()
// update the icon_state
/obj/machinery/bluespace_beacon/proc/updateicon()
var/state="floor_beacon"
if(invisibility)
icon_state = "[state]f"
else
icon_state = "[state]"
/obj/machinery/bluespace_beacon/process()
if(!Beacon)
var/turf/T = loc
Beacon = new(T)
Beacon.invisibility = INVISIBILITY_MAXIMUM
else if (Beacon.loc != loc)
Beacon.forceMove(loc)
updateicon()
/obj/machinery/bluespace_beacon
icon = 'icons/obj/objects.dmi'
icon_state = "floor_beaconf"
name = "bluespace gigabeacon"
desc = "A device that draws power from bluespace and creates a permanent tracking beacon."
level = 1 // underfloor
layer = LOW_OBJ_LAYER
use_power = IDLE_POWER_USE
idle_power_usage = 0
var/obj/item/beacon/Beacon
/obj/machinery/bluespace_beacon/Initialize()
. = ..()
var/turf/T = loc
Beacon = new(T)
Beacon.invisibility = INVISIBILITY_MAXIMUM
hide(T.intact)
/obj/machinery/bluespace_beacon/Destroy()
QDEL_NULL(Beacon)
return ..()
// update the invisibility and icon
/obj/machinery/bluespace_beacon/hide(intact)
invisibility = intact ? INVISIBILITY_MAXIMUM : 0
update_icon()
// update the icon_state
/obj/machinery/bluespace_beacon/update_icon()
var/state="floor_beacon"
if(invisibility)
icon_state = "[state]f"
else
icon_state = "[state]"
/obj/machinery/bluespace_beacon/process()
if(!Beacon)
var/turf/T = loc
Beacon = new(T)
Beacon.invisibility = INVISIBILITY_MAXIMUM
else if (Beacon.loc != loc)
Beacon.forceMove(loc)
update_icon()
+266 -265
View File
@@ -1,265 +1,266 @@
/obj/machinery/button
name = "button"
desc = "A remote control switch."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "doorctrl"
var/skin = "doorctrl"
power_channel = ENVIRON
var/obj/item/assembly/device
var/obj/item/electronics/airlock/board
var/device_type = null
var/id = null
var/initialized_button = 0
armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 50, "bomb" = 10, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 70)
use_power = IDLE_POWER_USE
idle_power_usage = 2
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
/obj/machinery/button/Initialize(mapload, ndir = 0, built = 0)
. = ..()
if(built)
setDir(ndir)
pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
panel_open = TRUE
update_icon()
if(!built && !device && device_type)
device = new device_type(src)
src.check_access(null)
if(req_access.len || req_one_access.len)
board = new(src)
if(req_access.len)
board.accesses = req_access
else
board.one_access = 1
board.accesses = req_one_access
/obj/machinery/button/update_icon()
cut_overlays()
if(panel_open)
icon_state = "button-open"
if(device)
add_overlay("button-device")
if(board)
add_overlay("button-board")
else
if(stat & (NOPOWER|BROKEN))
icon_state = "[skin]-p"
else
icon_state = skin
/obj/machinery/button/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
if(panel_open || allowed(user))
default_deconstruction_screwdriver(user, "button-open", "[skin]",W)
update_icon()
else
to_chat(user, "<span class='danger'>Maintenance Access Denied</span>")
flick("[skin]-denied", src)
return
if(panel_open)
if(!device && istype(W, /obj/item/assembly))
if(!user.transferItemToLoc(W, src))
to_chat(user, "<span class='warning'>\The [W] is stuck to you!</span>")
return
device = W
to_chat(user, "<span class='notice'>You add [W] to the button.</span>")
if(!board && istype(W, /obj/item/electronics/airlock))
if(!user.transferItemToLoc(W, src))
to_chat(user, "<span class='warning'>\The [W] is stuck to you!</span>")
return
board = W
if(board.one_access)
req_one_access = board.accesses
else
req_access = board.accesses
to_chat(user, "<span class='notice'>You add [W] to the button.</span>")
if(!device && !board && istype(W, /obj/item/wrench))
to_chat(user, "<span class='notice'>You start unsecuring the button frame...</span>")
W.play_tool_sound(src)
if(W.use_tool(src, user, 40))
to_chat(user, "<span class='notice'>You unsecure the button frame.</span>")
transfer_fingerprints_to(new /obj/item/wallframe/button(get_turf(src)))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
qdel(src)
update_icon()
return
if(user.a_intent != INTENT_HARM && !(W.item_flags & NOBLUDGEON))
return attack_hand(user)
else
return ..()
/obj/machinery/button/emag_act(mob/user)
if(obj_flags & EMAGGED)
return
req_access = list()
req_one_access = list()
playsound(src, "sparks", 100, 1)
obj_flags |= EMAGGED
/obj/machinery/button/attack_ai(mob/user)
if(!panel_open)
return attack_hand(user)
/obj/machinery/button/attack_robot(mob/user)
return attack_ai(user)
/obj/machinery/button/proc/setup_device()
if(id && istype(device, /obj/item/assembly/control))
var/obj/item/assembly/control/A = device
A.id = id
initialized_button = 1
/obj/machinery/button/attack_hand(mob/user)
. = ..()
if(.)
return
if(!initialized_button)
setup_device()
add_fingerprint(user)
if(panel_open)
if(device || board)
if(device)
device.forceMove(drop_location())
device = null
if(board)
board.forceMove(drop_location())
req_access = list()
req_one_access = list()
board = null
update_icon()
to_chat(user, "<span class='notice'>You remove electronics from the button frame.</span>")
else
if(skin == "doorctrl")
skin = "launcher"
else
skin = "doorctrl"
to_chat(user, "<span class='notice'>You change the button frame's front panel.</span>")
return
if((stat & (NOPOWER|BROKEN)))
return
if(device && device.next_activate > world.time)
return
if(!allowed(user))
to_chat(user, "<span class='danger'>Access Denied</span>")
flick("[skin]-denied", src)
return
use_power(5)
icon_state = "[skin]1"
if(device)
device.pulsed()
addtimer(CALLBACK(src, .proc/update_icon), 15)
/obj/machinery/button/power_change()
..()
update_icon()
/obj/machinery/button/door
name = "door button"
desc = "A door remote control switch."
var/normaldoorcontrol = FALSE
var/specialfunctions = OPEN // Bitflag, see assembly file
/obj/machinery/button/door/setup_device()
if(!device)
if(normaldoorcontrol)
var/obj/item/assembly/control/airlock/A = new(src)
device = A
A.specialfunctions = specialfunctions
else
device = new /obj/item/assembly/control(src)
..()
/obj/machinery/button/door/incinerator_vent_toxmix
name = "combustion chamber vent control"
id = INCINERATOR_TOXMIX_VENT
req_access = list(ACCESS_TOX)
/obj/machinery/button/door/incinerator_vent_atmos_main
name = "turbine vent control"
id = INCINERATOR_ATMOS_MAINVENT
req_one_access = list(ACCESS_ATMOSPHERICS, ACCESS_MAINT_TUNNELS)
/obj/machinery/button/door/incinerator_vent_atmos_aux
name = "combustion chamber vent control"
id = INCINERATOR_ATMOS_AUXVENT
req_one_access = list(ACCESS_ATMOSPHERICS, ACCESS_MAINT_TUNNELS)
/obj/machinery/button/door/incinerator_vent_syndicatelava_main
name = "turbine vent control"
id = INCINERATOR_SYNDICATELAVA_MAINVENT
req_access = list(ACCESS_SYNDICATE)
/obj/machinery/button/door/incinerator_vent_syndicatelava_aux
name = "combustion chamber vent control"
id = INCINERATOR_SYNDICATELAVA_AUXVENT
req_access = list(ACCESS_SYNDICATE)
/obj/machinery/button/massdriver
name = "mass driver button"
desc = "A remote control switch for a mass driver."
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/massdriver
/obj/machinery/button/ignition
name = "ignition switch"
desc = "A remote control switch for a mounted igniter."
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/igniter
/obj/machinery/button/ignition/incinerator
name = "combustion chamber ignition switch"
desc = "A remote control switch for the combustion chamber's igniter."
/obj/machinery/button/ignition/incinerator/toxmix
id = INCINERATOR_TOXMIX_IGNITER
/obj/machinery/button/ignition/incinerator/atmos
id = INCINERATOR_ATMOS_IGNITER
/obj/machinery/button/ignition/incinerator/syndicatelava
id = INCINERATOR_SYNDICATELAVA_IGNITER
/obj/machinery/button/flasher
name = "flasher button"
desc = "A remote control switch for a mounted flasher."
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/flasher
/obj/machinery/button/crematorium
name = "crematorium igniter"
desc = "Burn baby burn!"
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/crematorium
req_access = list()
id = 1
/obj/item/wallframe/button
name = "button frame"
desc = "Used for building buttons."
icon_state = "button"
result_path = /obj/machinery/button
materials = list(MAT_METAL=MINERAL_MATERIAL_AMOUNT)
/obj/machinery/button
name = "button"
desc = "A remote control switch."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "doorctrl"
var/skin = "doorctrl"
power_channel = ENVIRON
var/obj/item/assembly/device
var/obj/item/electronics/airlock/board
var/device_type = null
var/id = null
var/initialized_button = 0
armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 50, "bomb" = 10, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 70)
use_power = IDLE_POWER_USE
idle_power_usage = 2
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
/obj/machinery/button/Initialize(mapload, ndir = 0, built = 0)
. = ..()
if(built)
setDir(ndir)
pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
panel_open = TRUE
update_icon()
if(!built && !device && device_type)
device = new device_type(src)
src.check_access(null)
if(req_access.len || req_one_access.len)
board = new(src)
if(req_access.len)
board.accesses = req_access
else
board.one_access = 1
board.accesses = req_one_access
/obj/machinery/button/update_icon_state()
if(panel_open)
icon_state = "button-open"
else if(stat & (NOPOWER|BROKEN))
icon_state = "[skin]-p"
else
icon_state = skin
/obj/machinery/button/update_overlays()
. = ..()
if(!panel_open)
return
if(device)
. += "button-device"
if(board)
. += "button-board"
/obj/machinery/button/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/screwdriver))
if(panel_open || allowed(user))
default_deconstruction_screwdriver(user, "button-open", "[skin]",W)
update_icon()
else
to_chat(user, "<span class='danger'>Maintenance Access Denied</span>")
flick("[skin]-denied", src)
return
if(panel_open)
if(!device && istype(W, /obj/item/assembly))
if(!user.transferItemToLoc(W, src))
to_chat(user, "<span class='warning'>\The [W] is stuck to you!</span>")
return
device = W
to_chat(user, "<span class='notice'>You add [W] to the button.</span>")
if(!board && istype(W, /obj/item/electronics/airlock))
if(!user.transferItemToLoc(W, src))
to_chat(user, "<span class='warning'>\The [W] is stuck to you!</span>")
return
board = W
if(board.one_access)
req_one_access = board.accesses
else
req_access = board.accesses
to_chat(user, "<span class='notice'>You add [W] to the button.</span>")
if(!device && !board && istype(W, /obj/item/wrench))
to_chat(user, "<span class='notice'>You start unsecuring the button frame...</span>")
W.play_tool_sound(src)
if(W.use_tool(src, user, 40))
to_chat(user, "<span class='notice'>You unsecure the button frame.</span>")
transfer_fingerprints_to(new /obj/item/wallframe/button(get_turf(src)))
playsound(loc, 'sound/items/deconstruct.ogg', 50, 1)
qdel(src)
update_icon()
return
if(user.a_intent != INTENT_HARM && !(W.item_flags & NOBLUDGEON))
return attack_hand(user)
else
return ..()
/obj/machinery/button/emag_act(mob/user)
if(obj_flags & EMAGGED)
return
req_access = list()
req_one_access = list()
playsound(src, "sparks", 100, 1)
obj_flags |= EMAGGED
/obj/machinery/button/attack_ai(mob/user)
if(!panel_open)
return attack_hand(user)
/obj/machinery/button/attack_robot(mob/user)
return attack_ai(user)
/obj/machinery/button/proc/setup_device()
if(id && istype(device, /obj/item/assembly/control))
var/obj/item/assembly/control/A = device
A.id = id
initialized_button = 1
/obj/machinery/button/attack_hand(mob/user)
. = ..()
if(.)
return
if(!initialized_button)
setup_device()
add_fingerprint(user)
if(panel_open)
if(device || board)
if(device)
device.forceMove(drop_location())
device = null
if(board)
board.forceMove(drop_location())
req_access = list()
req_one_access = list()
board = null
update_icon()
to_chat(user, "<span class='notice'>You remove electronics from the button frame.</span>")
else
if(skin == "doorctrl")
skin = "launcher"
else
skin = "doorctrl"
to_chat(user, "<span class='notice'>You change the button frame's front panel.</span>")
return
if((stat & (NOPOWER|BROKEN)))
return
if(device && device.next_activate > world.time)
return
if(!allowed(user))
to_chat(user, "<span class='danger'>Access Denied</span>")
flick("[skin]-denied", src)
return
use_power(5)
icon_state = "[skin]1"
if(device)
device.pulsed()
addtimer(CALLBACK(src, /atom/.proc/update_icon), 15)
/obj/machinery/button/power_change()
..()
update_icon()
/obj/machinery/button/door
name = "door button"
desc = "A door remote control switch."
var/normaldoorcontrol = FALSE
var/specialfunctions = OPEN // Bitflag, see assembly file
/obj/machinery/button/door/setup_device()
if(!device)
if(normaldoorcontrol)
var/obj/item/assembly/control/airlock/A = new(src)
device = A
A.specialfunctions = specialfunctions
else
device = new /obj/item/assembly/control(src)
..()
/obj/machinery/button/door/incinerator_vent_toxmix
name = "combustion chamber vent control"
id = INCINERATOR_TOXMIX_VENT
req_access = list(ACCESS_TOX)
/obj/machinery/button/door/incinerator_vent_atmos_main
name = "turbine vent control"
id = INCINERATOR_ATMOS_MAINVENT
req_one_access = list(ACCESS_ATMOSPHERICS, ACCESS_MAINT_TUNNELS)
/obj/machinery/button/door/incinerator_vent_atmos_aux
name = "combustion chamber vent control"
id = INCINERATOR_ATMOS_AUXVENT
req_one_access = list(ACCESS_ATMOSPHERICS, ACCESS_MAINT_TUNNELS)
/obj/machinery/button/door/incinerator_vent_syndicatelava_main
name = "turbine vent control"
id = INCINERATOR_SYNDICATELAVA_MAINVENT
req_access = list(ACCESS_SYNDICATE)
/obj/machinery/button/door/incinerator_vent_syndicatelava_aux
name = "combustion chamber vent control"
id = INCINERATOR_SYNDICATELAVA_AUXVENT
req_access = list(ACCESS_SYNDICATE)
/obj/machinery/button/massdriver
name = "mass driver button"
desc = "A remote control switch for a mass driver."
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/massdriver
/obj/machinery/button/ignition
name = "ignition switch"
desc = "A remote control switch for a mounted igniter."
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/igniter
/obj/machinery/button/ignition/incinerator
name = "combustion chamber ignition switch"
desc = "A remote control switch for the combustion chamber's igniter."
/obj/machinery/button/ignition/incinerator/toxmix
id = INCINERATOR_TOXMIX_IGNITER
/obj/machinery/button/ignition/incinerator/atmos
id = INCINERATOR_ATMOS_IGNITER
/obj/machinery/button/ignition/incinerator/syndicatelava
id = INCINERATOR_SYNDICATELAVA_IGNITER
/obj/machinery/button/flasher
name = "flasher button"
desc = "A remote control switch for a mounted flasher."
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/flasher
/obj/machinery/button/crematorium
name = "crematorium igniter"
desc = "Burn baby burn!"
icon_state = "launcher"
skin = "launcher"
device_type = /obj/item/assembly/control/crematorium
req_access = list()
id = 1
/obj/item/wallframe/button
name = "button frame"
desc = "Used for building buttons."
icon_state = "button"
result_path = /obj/machinery/button
materials = list(MAT_METAL=MINERAL_MATERIAL_AMOUNT)
+1 -1
View File
@@ -292,7 +292,7 @@
new /obj/item/stack/cable_coil(loc, 2)
qdel(src)
/obj/machinery/camera/update_icon()
/obj/machinery/camera/update_icon_state()
if(!status)
icon_state = "[initial(icon_state)]1"
else if (stat & EMPED)
+130 -130
View File
@@ -1,130 +1,130 @@
/obj/machinery/cell_charger
name = "cell charger"
desc = "It charges power cells."
icon = 'icons/obj/power.dmi'
icon_state = "ccharger"
use_power = IDLE_POWER_USE
idle_power_usage = 5
active_power_usage = 60
power_channel = EQUIP
circuit = /obj/item/circuitboard/machine/cell_charger
pass_flags = PASSTABLE
var/obj/item/stock_parts/cell/charging = null
var/chargelevel = -1
var/charge_rate = 500
/obj/machinery/cell_charger/proc/updateicon()
cut_overlays()
if(charging)
add_overlay(image(charging.icon, charging.icon_state))
add_overlay("ccharger-on")
if(!(stat & (BROKEN|NOPOWER)))
var/newlevel = round(charging.percent() * 4 / 100)
chargelevel = newlevel
add_overlay("ccharger-o[newlevel]")
/obj/machinery/cell_charger/examine(mob/user)
. = ..()
. += "There's [charging ? "a" : "no"] cell in the charger."
if(charging)
. += "Current charge: [round(charging.percent(), 1)]%."
/obj/machinery/cell_charger/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stock_parts/cell) && !panel_open)
if(stat & BROKEN)
to_chat(user, "<span class='warning'>[src] is broken!</span>")
return
if(!anchored)
to_chat(user, "<span class='warning'>[src] isn't attached to the ground!</span>")
return
if(charging)
to_chat(user, "<span class='warning'>There is already a cell in the charger!</span>")
return
else
var/area/a = loc.loc // Gets our locations location, like a dream within a dream
if(!isarea(a))
return
if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power!
to_chat(user, "<span class='warning'>[src] blinks red as you try to insert the cell!</span>")
return
if(!user.transferItemToLoc(W,src))
return
charging = W
user.visible_message("[user] inserts a cell into [src].", "<span class='notice'>You insert a cell into [src].</span>")
chargelevel = -1
updateicon()
else
if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W))
return
if(default_deconstruction_crowbar(W))
return
if(!charging && default_unfasten_wrench(user, W))
return
return ..()
/obj/machinery/cell_charger/deconstruct()
if(charging)
charging.forceMove(drop_location())
return ..()
/obj/machinery/cell_charger/Destroy()
QDEL_NULL(charging)
return ..()
/obj/machinery/cell_charger/proc/removecell()
charging.update_icon()
charging = null
chargelevel = -1
updateicon()
/obj/machinery/cell_charger/attack_hand(mob/user)
. = ..()
if(.)
return
if(!charging)
return
user.put_in_hands(charging)
charging.add_fingerprint(user)
user.visible_message("[user] removes [charging] from [src].", "<span class='notice'>You remove [charging] from [src].</span>")
removecell()
/obj/machinery/cell_charger/attack_tk(mob/user)
if(!charging)
return
charging.forceMove(loc)
to_chat(user, "<span class='notice'>You telekinetically remove [charging] from [src].</span>")
removecell()
/obj/machinery/cell_charger/attack_ai(mob/user)
return
/obj/machinery/cell_charger/emp_act(severity)
. = ..()
if(stat & (BROKEN|NOPOWER) || . & EMP_PROTECT_CONTENTS)
return
if(charging)
charging.emp_act(severity)
/obj/machinery/cell_charger/RefreshParts()
charge_rate = 500
for(var/obj/item/stock_parts/capacitor/C in component_parts)
charge_rate *= C.rating
/obj/machinery/cell_charger/process()
if(!charging || !anchored || (stat & (BROKEN|NOPOWER)))
return
if(charging.percent() >= 100)
return
use_power(charge_rate)
charging.give(charge_rate) //this is 2558, efficient batteries exist
updateicon()
/obj/machinery/cell_charger
name = "cell charger"
desc = "It charges power cells."
icon = 'icons/obj/power.dmi'
icon_state = "ccharger"
use_power = IDLE_POWER_USE
idle_power_usage = 5
active_power_usage = 60
power_channel = EQUIP
circuit = /obj/item/circuitboard/machine/cell_charger
pass_flags = PASSTABLE
var/obj/item/stock_parts/cell/charging = null
var/chargelevel = -1
var/charge_rate = 500
/obj/machinery/cell_charger/update_icon()
cut_overlays()
if(charging)
add_overlay(image(charging.icon, charging.icon_state))
add_overlay("ccharger-on")
if(!(stat & (BROKEN|NOPOWER)))
var/newlevel = round(charging.percent() * 4 / 100)
chargelevel = newlevel
add_overlay("ccharger-o[newlevel]")
/obj/machinery/cell_charger/examine(mob/user)
. = ..()
. += "There's [charging ? "a" : "no"] cell in the charger."
if(charging)
. += "Current charge: [round(charging.percent(), 1)]%."
/obj/machinery/cell_charger/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stock_parts/cell) && !panel_open)
if(stat & BROKEN)
to_chat(user, "<span class='warning'>[src] is broken!</span>")
return
if(!anchored)
to_chat(user, "<span class='warning'>[src] isn't attached to the ground!</span>")
return
if(charging)
to_chat(user, "<span class='warning'>There is already a cell in the charger!</span>")
return
else
var/area/a = loc.loc // Gets our locations location, like a dream within a dream
if(!isarea(a))
return
if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power!
to_chat(user, "<span class='warning'>[src] blinks red as you try to insert the cell!</span>")
return
if(!user.transferItemToLoc(W,src))
return
charging = W
user.visible_message("[user] inserts a cell into [src].", "<span class='notice'>You insert a cell into [src].</span>")
chargelevel = -1
update_icon()
else
if(!charging && default_deconstruction_screwdriver(user, icon_state, icon_state, W))
return
if(default_deconstruction_crowbar(W))
return
if(!charging && default_unfasten_wrench(user, W))
return
return ..()
/obj/machinery/cell_charger/deconstruct()
if(charging)
charging.forceMove(drop_location())
return ..()
/obj/machinery/cell_charger/Destroy()
QDEL_NULL(charging)
return ..()
/obj/machinery/cell_charger/proc/removecell()
charging.update_icon()
charging = null
chargelevel = -1
update_icon()
/obj/machinery/cell_charger/attack_hand(mob/user)
. = ..()
if(.)
return
if(!charging)
return
user.put_in_hands(charging)
charging.add_fingerprint(user)
user.visible_message("[user] removes [charging] from [src].", "<span class='notice'>You remove [charging] from [src].</span>")
removecell()
/obj/machinery/cell_charger/attack_tk(mob/user)
if(!charging)
return
charging.forceMove(loc)
to_chat(user, "<span class='notice'>You telekinetically remove [charging] from [src].</span>")
removecell()
/obj/machinery/cell_charger/attack_ai(mob/user)
return
/obj/machinery/cell_charger/emp_act(severity)
. = ..()
if(stat & (BROKEN|NOPOWER) || . & EMP_PROTECT_CONTENTS)
return
if(charging)
charging.emp_act(severity)
/obj/machinery/cell_charger/RefreshParts()
charge_rate = 500
for(var/obj/item/stock_parts/capacitor/C in component_parts)
charge_rate *= C.rating
/obj/machinery/cell_charger/process()
if(!charging || !anchored || (stat & (BROKEN|NOPOWER)))
return
if(charging.percent() >= 100)
return
use_power(charge_rate)
charging.give(charge_rate) //this is 2558, efficient batteries exist
update_icon()
+15 -11
View File
@@ -38,17 +38,21 @@
defib.cell.give(180) //90% efficiency, slightly better than the cell charger's 87.5%
update_icon()
/obj/machinery/defibrillator_mount/update_icon()
cut_overlays()
if(defib)
add_overlay("defib")
if(defib.powered)
add_overlay(defib.safety ? "online" : "emagged")
var/ratio = defib.cell.charge / defib.cell.maxcharge
ratio = CEILING(ratio * 4, 1) * 25
add_overlay("charge[ratio]")
if(clamps_locked)
add_overlay("clamps")
/obj/machinery/defibrillator_mount/update_overlays()
. = ..()
if(!defib)
return
. += "defib"
if(defib.powered)
. += (defib.safety ? "online" : "emagged")
var/ratio = defib.cell.charge / defib.cell.maxcharge
ratio = CEILING(ratio * 4, 1) * 25
. += "charge[ratio]"
if(clamps_locked)
. += "clamps"
/obj/machinery/defibrillator_mount/get_cell()
if(defib)
+67 -67
View File
@@ -1,67 +1,67 @@
// the light switch
// can have multiple per area
// can also operate on non-loc area through "otherarea" var
/obj/machinery/light_switch
name = "light switch"
icon = 'icons/obj/power.dmi'
icon_state = "light1"
desc = "Make dark."
var/on = TRUE
var/area/area = null
var/otherarea = null
/obj/machinery/light_switch/Initialize()
. = ..()
area = get_area(src)
if(otherarea)
area = locate(text2path("/area/[otherarea]"))
if(!name)
name = "light switch ([area.name])"
on = area.lightswitch
updateicon()
/obj/machinery/light_switch/proc/updateicon()
if(stat & NOPOWER)
icon_state = "light-p"
else
if(on)
icon_state = "light1"
else
icon_state = "light0"
/obj/machinery/light_switch/examine(mob/user)
. = ..()
. += "It is [on? "on" : "off"]."
/obj/machinery/light_switch/interact(mob/user)
. = ..()
on = !on
area.lightswitch = on
area.updateicon()
for(var/obj/machinery/light_switch/L in area)
L.on = on
L.updateicon()
area.power_change()
/obj/machinery/light_switch/power_change()
if(!otherarea)
if(powered(LIGHT))
stat &= ~NOPOWER
else
stat |= NOPOWER
updateicon()
/obj/machinery/light_switch/emp_act(severity)
. = ..()
if (. & EMP_PROTECT_SELF)
return
if(!(stat & (BROKEN|NOPOWER)))
power_change()
// the light switch
// can have multiple per area
// can also operate on non-loc area through "otherarea" var
/obj/machinery/light_switch
name = "light switch"
icon = 'icons/obj/power.dmi'
icon_state = "light1"
desc = "Make dark."
var/on = TRUE
var/area/area = null
var/otherarea = null
/obj/machinery/light_switch/Initialize()
. = ..()
area = get_area(src)
if(otherarea)
area = locate(text2path("/area/[otherarea]"))
if(!name)
name = "light switch ([area.name])"
on = area.lightswitch
update_icon()
/obj/machinery/light_switch/update_icon()
if(stat & NOPOWER)
icon_state = "light-p"
else
if(on)
icon_state = "light1"
else
icon_state = "light0"
/obj/machinery/light_switch/examine(mob/user)
. = ..()
. += "It is [on? "on" : "off"]."
/obj/machinery/light_switch/interact(mob/user)
. = ..()
on = !on
area.lightswitch = on
area.update_icon()
for(var/obj/machinery/light_switch/L in area)
L.on = on
L.update_icon()
area.power_change()
/obj/machinery/light_switch/power_change()
if(!otherarea)
if(powered(LIGHT))
stat &= ~NOPOWER
else
stat |= NOPOWER
update_icon()
/obj/machinery/light_switch/emp_act(severity)
. = ..()
if (. & EMP_PROTECT_SELF)
return
if(!(stat & (BROKEN|NOPOWER)))
power_change()
+386 -386
View File
@@ -1,386 +1,386 @@
// Magnetic attractor, creates variable magnetic fields and attraction.
// Can also be used to emit electron/proton beams to create a center of magnetism on another tile
// tl;dr: it's magnets lol
// This was created for firing ranges, but I suppose this could have other applications - Doohl
/obj/machinery/magnetic_module
icon = 'icons/obj/objects.dmi'
icon_state = "floor_magnet-f"
name = "electromagnetic generator"
desc = "A device that uses station power to create points of magnetic energy."
level = 1 // underfloor
layer = LOW_OBJ_LAYER
use_power = IDLE_POWER_USE
idle_power_usage = 50
var/freq = FREQ_MAGNETS // radio frequency
var/electricity_level = 1 // intensity of the magnetic pull
var/magnetic_field = 1 // the range of magnetic attraction
var/code = 0 // frequency code, they should be different unless you have a group of magnets working together or something
var/turf/center // the center of magnetic attraction
var/on = FALSE
var/magneting = FALSE
// x, y modifiers to the center turf; (0, 0) is centered on the magnet, whereas (1, -1) is one tile right, one tile down
var/center_x = 0
var/center_y = 0
var/max_dist = 20 // absolute value of center_x,y cannot exceed this integer
/obj/machinery/magnetic_module/Initialize()
..()
var/turf/T = loc
hide(T.intact)
center = T
SSradio.add_object(src, freq, RADIO_MAGNETS)
return INITIALIZE_HINT_LATELOAD
/obj/machinery/magnetic_module/LateInitialize()
magnetic_process()
/obj/machinery/magnetic_module/Destroy()
SSradio.remove_object(src, freq)
center = null
return ..()
// update the invisibility and icon
/obj/machinery/magnetic_module/hide(intact)
invisibility = intact ? INVISIBILITY_MAXIMUM : 0
updateicon()
// update the icon_state
/obj/machinery/magnetic_module/proc/updateicon()
var/state="floor_magnet"
var/onstate=""
if(!on)
onstate="0"
if(invisibility)
icon_state = "[state][onstate]-f" // if invisible, set icon to faded version
// in case of being revealed by T-scanner
else
icon_state = "[state][onstate]"
/obj/machinery/magnetic_module/receive_signal(datum/signal/signal)
var/command = signal.data["command"]
var/modifier = signal.data["modifier"]
var/signal_code = signal.data["code"]
if(command && (signal_code == code))
Cmd(command, modifier)
/obj/machinery/magnetic_module/proc/Cmd(command, modifier)
if(command)
switch(command)
if("set-electriclevel")
if(modifier)
electricity_level = modifier
if("set-magneticfield")
if(modifier)
magnetic_field = modifier
if("add-elec")
electricity_level++
if(electricity_level > 12)
electricity_level = 12
if("sub-elec")
electricity_level--
if(electricity_level <= 0)
electricity_level = 1
if("add-mag")
magnetic_field++
if(magnetic_field > 4)
magnetic_field = 4
if("sub-mag")
magnetic_field--
if(magnetic_field <= 0)
magnetic_field = 1
if("set-x")
if(modifier)
center_x = modifier
if("set-y")
if(modifier)
center_y = modifier
if("N") // NORTH
center_y++
if("S") // SOUTH
center_y--
if("E") // EAST
center_x++
if("W") // WEST
center_x--
if("C") // CENTER
center_x = 0
center_y = 0
if("R") // RANDOM
center_x = rand(-max_dist, max_dist)
center_y = rand(-max_dist, max_dist)
if("set-code")
if(modifier)
code = modifier
if("toggle-power")
on = !on
if(on)
INVOKE_ASYNC(src, .proc/magnetic_process)
/obj/machinery/magnetic_module/process()
if(stat & NOPOWER)
on = FALSE
// Sanity checks:
if(electricity_level <= 0)
electricity_level = 1
if(magnetic_field <= 0)
magnetic_field = 1
// Limitations:
if(abs(center_x) > max_dist)
center_x = max_dist
if(abs(center_y) > max_dist)
center_y = max_dist
if(magnetic_field > 4)
magnetic_field = 4
if(electricity_level > 12)
electricity_level = 12
// Update power usage:
if(on)
use_power = ACTIVE_POWER_USE
active_power_usage = electricity_level*15
else
use_power = NO_POWER_USE
updateicon()
/obj/machinery/magnetic_module/proc/magnetic_process() // proc that actually does the magneting
if(magneting)
return
while(on)
magneting = TRUE
center = locate(x+center_x, y+center_y, z)
if(center)
for(var/obj/M in orange(magnetic_field, center))
if(!M.anchored && (M.flags_1 & CONDUCT_1))
step_towards(M, center)
for(var/mob/living/silicon/S in orange(magnetic_field, center))
if(isAI(S))
continue
step_towards(S, center)
use_power(electricity_level * 5)
sleep(13 - electricity_level)
magneting = FALSE
/obj/machinery/magnetic_controller
name = "magnetic control console"
icon = 'icons/obj/airlock_machines.dmi' // uses an airlock machine icon, THINK GREEN HELP THE ENVIRONMENT - RECYCLING!
icon_state = "airlock_control_standby"
density = FALSE
use_power = IDLE_POWER_USE
idle_power_usage = 45
var/frequency = FREQ_MAGNETS
var/code = 0
var/list/magnets = list()
var/title = "Magnetic Control Console"
var/autolink = 0 // if set to 1, can't probe for other magnets!
var/pathpos = 1 // position in the path
var/path = "w;e;e;w;s;n;n;s" // text path of the magnet
var/speed = 1 // lowest = 1, highest = 10
var/list/rpath = list() // real path of the magnet, used in iterator
var/moving = 0 // 1 if scheduled to loop
var/looping = 0 // 1 if looping
var/datum/radio_frequency/radio_connection
/obj/machinery/magnetic_controller/Initialize()
. = ..()
if(autolink)
for(var/obj/machinery/magnetic_module/M in GLOB.machines)
if(M.freq == frequency && M.code == code)
magnets.Add(M)
if(path) // check for default path
filter_path() // renders rpath
radio_connection = SSradio.add_object(src, frequency, RADIO_MAGNETS)
/obj/machinery/magnetic_controller/Destroy()
SSradio.remove_object(src, frequency)
magnets = null
rpath = null
return ..()
/obj/machinery/magnetic_controller/process()
if(magnets.len == 0 && autolink)
for(var/obj/machinery/magnetic_module/M in GLOB.machines)
if(M.freq == frequency && M.code == code)
magnets.Add(M)
/obj/machinery/magnetic_controller/ui_interact(mob/user)
. = ..()
var/dat = "<B>Magnetic Control Console</B><BR><BR>"
if(!autolink)
dat += {"
Frequency: <a href='?src=[REF(src)];operation=setfreq'>[frequency]</a><br>
Code: <a href='?src=[REF(src)];operation=setfreq'>[code]</a><br>
<a href='?src=[REF(src)];operation=probe'>Probe Generators</a><br>
"}
if(magnets.len >= 1)
dat += "Magnets confirmed: <br>"
var/i = 0
for(var/obj/machinery/magnetic_module/M in magnets)
i++
dat += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;< \[[i]\] (<a href='?src=[REF(src)];radio-op=togglepower'>[M.on ? "On":"Off"]</a>) | Electricity level: <a href='?src=[REF(src)];radio-op=minuselec'>-</a> [M.electricity_level] <a href='?src=[REF(src)];radio-op=pluselec'>+</a>; Magnetic field: <a href='?src=[REF(src)];radio-op=minusmag'>-</a> [M.magnetic_field] <a href='?src=[REF(src)];radio-op=plusmag'>+</a><br>"
dat += "<br>Speed: <a href='?src=[REF(src)];operation=minusspeed'>-</a> [speed] <a href='?src=[REF(src)];operation=plusspeed'>+</a><br>"
dat += "Path: {<a href='?src=[REF(src)];operation=setpath'>[path]</a>}<br>"
dat += "Moving: <a href='?src=[REF(src)];operation=togglemoving'>[moving ? "Enabled":"Disabled"]</a>"
user << browse(dat, "window=magnet;size=400x500")
onclose(user, "magnet")
/obj/machinery/magnetic_controller/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
if(href_list["radio-op"])
// Prepare signal beforehand, because this is a radio operation
var/datum/signal/signal = new(list("code" = code))
// Apply any necessary commands
switch(href_list["radio-op"])
if("togglepower")
signal.data["command"] = "toggle-power"
if("minuselec")
signal.data["command"] = "sub-elec"
if("pluselec")
signal.data["command"] = "add-elec"
if("minusmag")
signal.data["command"] = "sub-mag"
if("plusmag")
signal.data["command"] = "add-mag"
// Broadcast the signal
radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
spawn(1)
updateUsrDialog() // pretty sure this increases responsiveness
if(href_list["operation"])
switch(href_list["operation"])
if("plusspeed")
speed ++
if(speed > 10)
speed = 10
if("minusspeed")
speed --
if(speed <= 0)
speed = 1
if("setpath")
var/newpath = stripped_input(usr, "Please define a new path!", "New Path", path, MAX_MESSAGE_LEN)
if(newpath && newpath != "")
moving = 0 // stop moving
path = newpath
pathpos = 1 // reset position
filter_path() // renders rpath
if("togglemoving")
moving = !moving
if(moving)
spawn() MagnetMove()
updateUsrDialog()
/obj/machinery/magnetic_controller/proc/MagnetMove()
if(looping)
return
while(moving && rpath.len >= 1)
if(stat & (BROKEN|NOPOWER))
break
looping = 1
// Prepare the radio signal
var/datum/signal/signal = new(list("code" = code))
if(pathpos > rpath.len) // if the position is greater than the length, we just loop through the list!
pathpos = 1
var/nextmove = uppertext(rpath[pathpos]) // makes it un-case-sensitive
if(!(nextmove in list("N","S","E","W","C","R")))
// N, S, E, W are directional
// C is center
// R is random (in magnetic field's bounds)
qdel(signal)
break // break the loop if the character located is invalid
signal.data["command"] = nextmove
pathpos++ // increase iterator
// Broadcast the signal
spawn()
radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
if(speed == 10)
sleep(1)
else
sleep(12-speed)
looping = 0
/obj/machinery/magnetic_controller/proc/filter_path()
// Generates the rpath variable using the path string, think of this as "string2list"
// Doesn't use params2list() because of the akward way it stacks entities
rpath = list() // clear rpath
var/maximum_characters = 50
var/lentext = length(path)
var/nextchar = ""
var/charcount = 0
for(var/i = 1, i <= lentext, i += length(nextchar)) // iterates through all characters in path
nextchar = path[i] // find next character
if(nextchar in list(";", "&", "*", " ")) // if char is a separator, ignore
continue
rpath += nextchar // else, add to list
// there doesn't HAVE to be separators but it makes paths syntatically visible
charcount++
if(charcount >= maximum_characters)
break
// Magnetic attractor, creates variable magnetic fields and attraction.
// Can also be used to emit electron/proton beams to create a center of magnetism on another tile
// tl;dr: it's magnets lol
// This was created for firing ranges, but I suppose this could have other applications - Doohl
/obj/machinery/magnetic_module
icon = 'icons/obj/objects.dmi'
icon_state = "floor_magnet-f"
name = "electromagnetic generator"
desc = "A device that uses station power to create points of magnetic energy."
level = 1 // underfloor
layer = LOW_OBJ_LAYER
use_power = IDLE_POWER_USE
idle_power_usage = 50
var/freq = FREQ_MAGNETS // radio frequency
var/electricity_level = 1 // intensity of the magnetic pull
var/magnetic_field = 1 // the range of magnetic attraction
var/code = 0 // frequency code, they should be different unless you have a group of magnets working together or something
var/turf/center // the center of magnetic attraction
var/on = FALSE
var/magneting = FALSE
// x, y modifiers to the center turf; (0, 0) is centered on the magnet, whereas (1, -1) is one tile right, one tile down
var/center_x = 0
var/center_y = 0
var/max_dist = 20 // absolute value of center_x,y cannot exceed this integer
/obj/machinery/magnetic_module/Initialize()
..()
var/turf/T = loc
hide(T.intact)
center = T
SSradio.add_object(src, freq, RADIO_MAGNETS)
return INITIALIZE_HINT_LATELOAD
/obj/machinery/magnetic_module/LateInitialize()
magnetic_process()
/obj/machinery/magnetic_module/Destroy()
SSradio.remove_object(src, freq)
center = null
return ..()
// update the invisibility and icon
/obj/machinery/magnetic_module/hide(intact)
invisibility = intact ? INVISIBILITY_MAXIMUM : 0
update_icon()
// update the icon_state
/obj/machinery/magnetic_module/update_icon()
var/state="floor_magnet"
var/onstate=""
if(!on)
onstate="0"
if(invisibility)
icon_state = "[state][onstate]-f" // if invisible, set icon to faded version
// in case of being revealed by T-scanner
else
icon_state = "[state][onstate]"
/obj/machinery/magnetic_module/receive_signal(datum/signal/signal)
var/command = signal.data["command"]
var/modifier = signal.data["modifier"]
var/signal_code = signal.data["code"]
if(command && (signal_code == code))
Cmd(command, modifier)
/obj/machinery/magnetic_module/proc/Cmd(command, modifier)
if(command)
switch(command)
if("set-electriclevel")
if(modifier)
electricity_level = modifier
if("set-magneticfield")
if(modifier)
magnetic_field = modifier
if("add-elec")
electricity_level++
if(electricity_level > 12)
electricity_level = 12
if("sub-elec")
electricity_level--
if(electricity_level <= 0)
electricity_level = 1
if("add-mag")
magnetic_field++
if(magnetic_field > 4)
magnetic_field = 4
if("sub-mag")
magnetic_field--
if(magnetic_field <= 0)
magnetic_field = 1
if("set-x")
if(modifier)
center_x = modifier
if("set-y")
if(modifier)
center_y = modifier
if("N") // NORTH
center_y++
if("S") // SOUTH
center_y--
if("E") // EAST
center_x++
if("W") // WEST
center_x--
if("C") // CENTER
center_x = 0
center_y = 0
if("R") // RANDOM
center_x = rand(-max_dist, max_dist)
center_y = rand(-max_dist, max_dist)
if("set-code")
if(modifier)
code = modifier
if("toggle-power")
on = !on
if(on)
INVOKE_ASYNC(src, .proc/magnetic_process)
/obj/machinery/magnetic_module/process()
if(stat & NOPOWER)
on = FALSE
// Sanity checks:
if(electricity_level <= 0)
electricity_level = 1
if(magnetic_field <= 0)
magnetic_field = 1
// Limitations:
if(abs(center_x) > max_dist)
center_x = max_dist
if(abs(center_y) > max_dist)
center_y = max_dist
if(magnetic_field > 4)
magnetic_field = 4
if(electricity_level > 12)
electricity_level = 12
// Update power usage:
if(on)
use_power = ACTIVE_POWER_USE
active_power_usage = electricity_level*15
else
use_power = NO_POWER_USE
update_icon()
/obj/machinery/magnetic_module/proc/magnetic_process() // proc that actually does the magneting
if(magneting)
return
while(on)
magneting = TRUE
center = locate(x+center_x, y+center_y, z)
if(center)
for(var/obj/M in orange(magnetic_field, center))
if(!M.anchored && (M.flags_1 & CONDUCT_1))
step_towards(M, center)
for(var/mob/living/silicon/S in orange(magnetic_field, center))
if(isAI(S))
continue
step_towards(S, center)
use_power(electricity_level * 5)
sleep(13 - electricity_level)
magneting = FALSE
/obj/machinery/magnetic_controller
name = "magnetic control console"
icon = 'icons/obj/airlock_machines.dmi' // uses an airlock machine icon, THINK GREEN HELP THE ENVIRONMENT - RECYCLING!
icon_state = "airlock_control_standby"
density = FALSE
use_power = IDLE_POWER_USE
idle_power_usage = 45
var/frequency = FREQ_MAGNETS
var/code = 0
var/list/magnets = list()
var/title = "Magnetic Control Console"
var/autolink = 0 // if set to 1, can't probe for other magnets!
var/pathpos = 1 // position in the path
var/path = "w;e;e;w;s;n;n;s" // text path of the magnet
var/speed = 1 // lowest = 1, highest = 10
var/list/rpath = list() // real path of the magnet, used in iterator
var/moving = 0 // 1 if scheduled to loop
var/looping = 0 // 1 if looping
var/datum/radio_frequency/radio_connection
/obj/machinery/magnetic_controller/Initialize()
. = ..()
if(autolink)
for(var/obj/machinery/magnetic_module/M in GLOB.machines)
if(M.freq == frequency && M.code == code)
magnets.Add(M)
if(path) // check for default path
filter_path() // renders rpath
radio_connection = SSradio.add_object(src, frequency, RADIO_MAGNETS)
/obj/machinery/magnetic_controller/Destroy()
SSradio.remove_object(src, frequency)
magnets = null
rpath = null
return ..()
/obj/machinery/magnetic_controller/process()
if(magnets.len == 0 && autolink)
for(var/obj/machinery/magnetic_module/M in GLOB.machines)
if(M.freq == frequency && M.code == code)
magnets.Add(M)
/obj/machinery/magnetic_controller/ui_interact(mob/user)
. = ..()
var/dat = "<B>Magnetic Control Console</B><BR><BR>"
if(!autolink)
dat += {"
Frequency: <a href='?src=[REF(src)];operation=setfreq'>[frequency]</a><br>
Code: <a href='?src=[REF(src)];operation=setfreq'>[code]</a><br>
<a href='?src=[REF(src)];operation=probe'>Probe Generators</a><br>
"}
if(magnets.len >= 1)
dat += "Magnets confirmed: <br>"
var/i = 0
for(var/obj/machinery/magnetic_module/M in magnets)
i++
dat += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;< \[[i]\] (<a href='?src=[REF(src)];radio-op=togglepower'>[M.on ? "On":"Off"]</a>) | Electricity level: <a href='?src=[REF(src)];radio-op=minuselec'>-</a> [M.electricity_level] <a href='?src=[REF(src)];radio-op=pluselec'>+</a>; Magnetic field: <a href='?src=[REF(src)];radio-op=minusmag'>-</a> [M.magnetic_field] <a href='?src=[REF(src)];radio-op=plusmag'>+</a><br>"
dat += "<br>Speed: <a href='?src=[REF(src)];operation=minusspeed'>-</a> [speed] <a href='?src=[REF(src)];operation=plusspeed'>+</a><br>"
dat += "Path: {<a href='?src=[REF(src)];operation=setpath'>[path]</a>}<br>"
dat += "Moving: <a href='?src=[REF(src)];operation=togglemoving'>[moving ? "Enabled":"Disabled"]</a>"
user << browse(dat, "window=magnet;size=400x500")
onclose(user, "magnet")
/obj/machinery/magnetic_controller/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
if(href_list["radio-op"])
// Prepare signal beforehand, because this is a radio operation
var/datum/signal/signal = new(list("code" = code))
// Apply any necessary commands
switch(href_list["radio-op"])
if("togglepower")
signal.data["command"] = "toggle-power"
if("minuselec")
signal.data["command"] = "sub-elec"
if("pluselec")
signal.data["command"] = "add-elec"
if("minusmag")
signal.data["command"] = "sub-mag"
if("plusmag")
signal.data["command"] = "add-mag"
// Broadcast the signal
radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
spawn(1)
updateUsrDialog() // pretty sure this increases responsiveness
if(href_list["operation"])
switch(href_list["operation"])
if("plusspeed")
speed ++
if(speed > 10)
speed = 10
if("minusspeed")
speed --
if(speed <= 0)
speed = 1
if("setpath")
var/newpath = stripped_input(usr, "Please define a new path!", "New Path", path, MAX_MESSAGE_LEN)
if(newpath && newpath != "")
moving = 0 // stop moving
path = newpath
pathpos = 1 // reset position
filter_path() // renders rpath
if("togglemoving")
moving = !moving
if(moving)
spawn() MagnetMove()
updateUsrDialog()
/obj/machinery/magnetic_controller/proc/MagnetMove()
if(looping)
return
while(moving && rpath.len >= 1)
if(stat & (BROKEN|NOPOWER))
break
looping = 1
// Prepare the radio signal
var/datum/signal/signal = new(list("code" = code))
if(pathpos > rpath.len) // if the position is greater than the length, we just loop through the list!
pathpos = 1
var/nextmove = uppertext(rpath[pathpos]) // makes it un-case-sensitive
if(!(nextmove in list("N","S","E","W","C","R")))
// N, S, E, W are directional
// C is center
// R is random (in magnetic field's bounds)
qdel(signal)
break // break the loop if the character located is invalid
signal.data["command"] = nextmove
pathpos++ // increase iterator
// Broadcast the signal
spawn()
radio_connection.post_signal(src, signal, filter = RADIO_MAGNETS)
if(speed == 10)
sleep(1)
else
sleep(12-speed)
looping = 0
/obj/machinery/magnetic_controller/proc/filter_path()
// Generates the rpath variable using the path string, think of this as "string2list"
// Doesn't use params2list() because of the akward way it stacks entities
rpath = list() // clear rpath
var/maximum_characters = 50
var/lentext = length(path)
var/nextchar = ""
var/charcount = 0
for(var/i = 1, i <= lentext, i += length(nextchar)) // iterates through all characters in path
nextchar = path[i] // find next character
if(nextchar in list(";", "&", "*", " ")) // if char is a separator, ignore
continue
rpath += nextchar // else, add to list
// there doesn't HAVE to be separators but it makes paths syntatically visible
charcount++
if(charcount >= maximum_characters)
break
+214 -214
View File
@@ -1,214 +1,214 @@
// Navigation beacon for AI robots
// No longer exists on the radio controller, it is managed by a global list.
/obj/machinery/navbeacon
icon = 'icons/obj/objects.dmi'
icon_state = "navbeacon0-f"
name = "navigation beacon"
desc = "A radio beacon used for bot navigation."
level = 1 // underfloor
layer = LOW_OBJ_LAYER
max_integrity = 500
armor = list("melee" = 70, "bullet" = 70, "laser" = 70, "energy" = 70, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80)
var/open = FALSE // true if cover is open
var/locked = TRUE // true if controls are locked
var/freq = FREQ_NAV_BEACON
var/location = "" // location response text
var/list/codes // assoc. list of transponder codes
var/codes_txt = "" // codes as set on map: "tag1;tag2" or "tag1=value;tag2=value"
req_one_access = list(ACCESS_ENGINE, ACCESS_ROBOTICS)
/obj/machinery/navbeacon/Initialize()
. = ..()
set_codes()
var/turf/T = loc
hide(T.intact)
if(codes["patrol"])
if(!GLOB.navbeacons["[z]"])
GLOB.navbeacons["[z]"] = list()
GLOB.navbeacons["[z]"] += src //Register with the patrol list!
if(codes["delivery"])
GLOB.deliverybeacons += src
GLOB.deliverybeacontags += location
/obj/machinery/navbeacon/Destroy()
if (GLOB.navbeacons["[z]"])
GLOB.navbeacons["[z]"] -= src //Remove from beacon list, if in one.
GLOB.deliverybeacons -= src
return ..()
/obj/machinery/navbeacon/onTransitZ(old_z, new_z)
if (GLOB.navbeacons["[old_z]"])
GLOB.navbeacons["[old_z]"] -= src
if (GLOB.navbeacons["[new_z]"])
GLOB.navbeacons["[new_z]"] += src
..()
// set the transponder codes assoc list from codes_txt
/obj/machinery/navbeacon/proc/set_codes()
if(!codes_txt)
return
codes = new()
var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons
for(var/e in entries)
var/index = findtext(e, "=") // format is "key=value"
if(index)
var/key = copytext(e, 1, index)
var/val = copytext(e, index + length(e[index]))
codes[key] = val
else
codes[e] = "1"
// called when turf state changes
// hide the object if turf is intact
/obj/machinery/navbeacon/hide(intact)
invisibility = intact ? INVISIBILITY_MAXIMUM : 0
updateicon()
// update the icon_state
/obj/machinery/navbeacon/proc/updateicon()
var/state="navbeacon[open]"
if(invisibility)
icon_state = "[state]-f" // if invisible, set icon to faded version
// in case revealed by T-scanner
else
icon_state = "[state]"
/obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params)
var/turf/T = loc
if(T.intact)
return // prevent intraction when T-scanner revealed
if(istype(I, /obj/item/screwdriver))
open = !open
user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "<span class='notice'>You [open ? "open" : "close"] the beacon's cover.</span>")
updateicon()
else if (istype(I, /obj/item/card/id)||istype(I, /obj/item/pda))
if(open)
if (src.allowed(user))
src.locked = !src.locked
to_chat(user, "<span class='notice'>Controls are now [src.locked ? "locked" : "unlocked"].</span>")
else
to_chat(user, "<span class='danger'>Access denied.</span>")
updateDialog()
else
to_chat(user, "<span class='warning'>You must open the cover first!</span>")
else
return ..()
/obj/machinery/navbeacon/attack_ai(mob/user)
interact(user, 1)
/obj/machinery/navbeacon/attack_paw()
return
/obj/machinery/navbeacon/ui_interact(mob/user)
. = ..()
var/ai = isAI(user)
var/turf/T = loc
if(T.intact)
return // prevent intraction when T-scanner revealed
if(!open && !ai) // can't alter controls if not open, unless you're an AI
to_chat(user, "<span class='warning'>The beacon's control cover is closed!</span>")
return
var/t
if(locked && !ai)
t = {"<TT><B>Navigation Beacon</B><HR><BR>
<i>(swipe card to unlock controls)</i><BR>
Location: [location ? location : "(none)"]</A><BR>
Transponder Codes:<UL>"}
for(var/key in codes)
t += "<LI>[key] ... [codes[key]]"
t+= "<UL></TT>"
else
t = {"<TT><B>Navigation Beacon</B><HR><BR>
<i>(swipe card to lock controls)</i><BR>
<HR>
Location: <A href='byond://?src=[REF(src)];locedit=1'>[location ? location : "None"]</A><BR>
Transponder Codes:<UL>"}
for(var/key in codes)
t += "<LI>[key] ... [codes[key]]"
t += " <A href='byond://?src=[REF(src)];edit=1;code=[key]'>Edit</A>"
t += " <A href='byond://?src=[REF(src)];delete=1;code=[key]'>Delete</A><BR>"
t += " <A href='byond://?src=[REF(src)];add=1;'>Add New</A><BR>"
t+= "<UL></TT>"
var/datum/browser/popup = new(user, "navbeacon", "Navigation Beacon", 300, 400)
popup.set_content(t)
popup.open()
return
/obj/machinery/navbeacon/Topic(href, href_list)
if(..())
return
if(open && !locked)
usr.set_machine(src)
if(href_list["locedit"])
var/newloc = stripped_input(usr, "Enter New Location", "Navigation Beacon", location, MAX_MESSAGE_LEN)
if(newloc)
location = newloc
updateDialog()
else if(href_list["edit"])
var/codekey = href_list["code"]
var/newkey = stripped_input(usr, "Enter Transponder Code Key", "Navigation Beacon", codekey)
if(!newkey)
return
var/codeval = codes[codekey]
var/newval = stripped_input(usr, "Enter Transponder Code Value", "Navigation Beacon", codeval)
if(!newval)
newval = codekey
return
codes.Remove(codekey)
codes[newkey] = newval
updateDialog()
else if(href_list["delete"])
var/codekey = href_list["code"]
codes.Remove(codekey)
updateDialog()
else if(href_list["add"])
var/newkey = stripped_input(usr, "Enter New Transponder Code Key", "Navigation Beacon")
if(!newkey)
return
var/newval = stripped_input(usr, "Enter New Transponder Code Value", "Navigation Beacon")
if(!newval)
newval = "1"
return
if(!codes)
codes = new()
codes[newkey] = newval
updateDialog()
// Navigation beacon for AI robots
// No longer exists on the radio controller, it is managed by a global list.
/obj/machinery/navbeacon
icon = 'icons/obj/objects.dmi'
icon_state = "navbeacon0-f"
name = "navigation beacon"
desc = "A radio beacon used for bot navigation."
level = 1 // underfloor
layer = LOW_OBJ_LAYER
max_integrity = 500
armor = list("melee" = 70, "bullet" = 70, "laser" = 70, "energy" = 70, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 80)
var/open = FALSE // true if cover is open
var/locked = TRUE // true if controls are locked
var/freq = FREQ_NAV_BEACON
var/location = "" // location response text
var/list/codes // assoc. list of transponder codes
var/codes_txt = "" // codes as set on map: "tag1;tag2" or "tag1=value;tag2=value"
req_one_access = list(ACCESS_ENGINE, ACCESS_ROBOTICS)
/obj/machinery/navbeacon/Initialize()
. = ..()
set_codes()
var/turf/T = loc
hide(T.intact)
if(codes["patrol"])
if(!GLOB.navbeacons["[z]"])
GLOB.navbeacons["[z]"] = list()
GLOB.navbeacons["[z]"] += src //Register with the patrol list!
if(codes["delivery"])
GLOB.deliverybeacons += src
GLOB.deliverybeacontags += location
/obj/machinery/navbeacon/Destroy()
if (GLOB.navbeacons["[z]"])
GLOB.navbeacons["[z]"] -= src //Remove from beacon list, if in one.
GLOB.deliverybeacons -= src
return ..()
/obj/machinery/navbeacon/onTransitZ(old_z, new_z)
if (GLOB.navbeacons["[old_z]"])
GLOB.navbeacons["[old_z]"] -= src
if (GLOB.navbeacons["[new_z]"])
GLOB.navbeacons["[new_z]"] += src
..()
// set the transponder codes assoc list from codes_txt
/obj/machinery/navbeacon/proc/set_codes()
if(!codes_txt)
return
codes = new()
var/list/entries = splittext(codes_txt, ";") // entries are separated by semicolons
for(var/e in entries)
var/index = findtext(e, "=") // format is "key=value"
if(index)
var/key = copytext(e, 1, index)
var/val = copytext(e, index + length(e[index]))
codes[key] = val
else
codes[e] = "1"
// called when turf state changes
// hide the object if turf is intact
/obj/machinery/navbeacon/hide(intact)
invisibility = intact ? INVISIBILITY_MAXIMUM : 0
update_icon()
// update the icon_state
/obj/machinery/navbeacon/update_icon()
var/state="navbeacon[open]"
if(invisibility)
icon_state = "[state]-f" // if invisible, set icon to faded version
// in case revealed by T-scanner
else
icon_state = "[state]"
/obj/machinery/navbeacon/attackby(obj/item/I, mob/user, params)
var/turf/T = loc
if(T.intact)
return // prevent intraction when T-scanner revealed
if(istype(I, /obj/item/screwdriver))
open = !open
user.visible_message("[user] [open ? "opens" : "closes"] the beacon's cover.", "<span class='notice'>You [open ? "open" : "close"] the beacon's cover.</span>")
update_icon()
else if (istype(I, /obj/item/card/id)||istype(I, /obj/item/pda))
if(open)
if (src.allowed(user))
src.locked = !src.locked
to_chat(user, "<span class='notice'>Controls are now [src.locked ? "locked" : "unlocked"].</span>")
else
to_chat(user, "<span class='danger'>Access denied.</span>")
updateDialog()
else
to_chat(user, "<span class='warning'>You must open the cover first!</span>")
else
return ..()
/obj/machinery/navbeacon/attack_ai(mob/user)
interact(user, 1)
/obj/machinery/navbeacon/attack_paw()
return
/obj/machinery/navbeacon/ui_interact(mob/user)
. = ..()
var/ai = isAI(user)
var/turf/T = loc
if(T.intact)
return // prevent intraction when T-scanner revealed
if(!open && !ai) // can't alter controls if not open, unless you're an AI
to_chat(user, "<span class='warning'>The beacon's control cover is closed!</span>")
return
var/t
if(locked && !ai)
t = {"<TT><B>Navigation Beacon</B><HR><BR>
<i>(swipe card to unlock controls)</i><BR>
Location: [location ? location : "(none)"]</A><BR>
Transponder Codes:<UL>"}
for(var/key in codes)
t += "<LI>[key] ... [codes[key]]"
t+= "<UL></TT>"
else
t = {"<TT><B>Navigation Beacon</B><HR><BR>
<i>(swipe card to lock controls)</i><BR>
<HR>
Location: <A href='byond://?src=[REF(src)];locedit=1'>[location ? location : "None"]</A><BR>
Transponder Codes:<UL>"}
for(var/key in codes)
t += "<LI>[key] ... [codes[key]]"
t += " <A href='byond://?src=[REF(src)];edit=1;code=[key]'>Edit</A>"
t += " <A href='byond://?src=[REF(src)];delete=1;code=[key]'>Delete</A><BR>"
t += " <A href='byond://?src=[REF(src)];add=1;'>Add New</A><BR>"
t+= "<UL></TT>"
var/datum/browser/popup = new(user, "navbeacon", "Navigation Beacon", 300, 400)
popup.set_content(t)
popup.open()
return
/obj/machinery/navbeacon/Topic(href, href_list)
if(..())
return
if(open && !locked)
usr.set_machine(src)
if(href_list["locedit"])
var/newloc = stripped_input(usr, "Enter New Location", "Navigation Beacon", location, MAX_MESSAGE_LEN)
if(newloc)
location = newloc
updateDialog()
else if(href_list["edit"])
var/codekey = href_list["code"]
var/newkey = stripped_input(usr, "Enter Transponder Code Key", "Navigation Beacon", codekey)
if(!newkey)
return
var/codeval = codes[codekey]
var/newval = stripped_input(usr, "Enter Transponder Code Value", "Navigation Beacon", codeval)
if(!newval)
newval = codekey
return
codes.Remove(codekey)
codes[newkey] = newval
updateDialog()
else if(href_list["delete"])
var/codekey = href_list["code"]
codes.Remove(codekey)
updateDialog()
else if(href_list["add"])
var/newkey = stripped_input(usr, "Enter New Transponder Code Key", "Navigation Beacon")
if(!newkey)
return
var/newval = stripped_input(usr, "Enter New Transponder Code Value", "Navigation Beacon")
if(!newval)
newval = "1"
return
if(!codes)
codes = new()
codes[newkey] = newval
updateDialog()
@@ -464,7 +464,7 @@
status = rcd_status
delay = rcd_delay
if (status == RCD_DECONSTRUCT)
addtimer(CALLBACK(src, .proc/update_icon), 11)
addtimer(CALLBACK(src, /atom/.proc/update_icon), 11)
delay -= 11
icon_state = "rcd_end_reverse"
else
+9 -13
View File
@@ -46,8 +46,7 @@
/obj/item/defibrillator/update_icon()
update_power()
update_overlays()
update_charge()
return ..()
/obj/item/defibrillator/proc/update_power()
if(!QDELETED(cell))
@@ -58,23 +57,20 @@
else
powered = FALSE
/obj/item/defibrillator/proc/update_overlays()
cut_overlays()
/obj/item/defibrillator/update_overlays()
. = ..()
if(!on)
add_overlay("[initial(icon_state)]-paddles")
. += "[initial(icon_state)]-paddles"
if(powered)
add_overlay("[initial(icon_state)]-powered")
if(!cell)
add_overlay("[initial(icon_state)]-nocell")
if(!safety)
add_overlay("[initial(icon_state)]-emagged")
/obj/item/defibrillator/proc/update_charge()
if(powered) //so it doesn't show charge if it's unpowered
. += "[initial(icon_state)]-powered"
if(!QDELETED(cell))
var/ratio = cell.charge / cell.maxcharge
ratio = CEILING(ratio*4, 1) * 25
add_overlay("[initial(icon_state)]-charge[ratio]")
if(!cell)
. += "[initial(icon_state)]-nocell"
if(!safety)
. += "[initial(icon_state)]-emagged"
/obj/item/defibrillator/CheckParts(list/parts_list)
..()
+237 -237
View File
@@ -1,237 +1,237 @@
/obj/item/transfer_valve
icon = 'icons/obj/assemblies.dmi'
name = "tank transfer valve"
icon_state = "valve_1"
item_state = "ttv"
lefthand_file = 'icons/mob/inhands/weapons/bombs_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/bombs_righthand.dmi'
desc = "Regulates the transfer of air between two tanks."
w_class = WEIGHT_CLASS_BULKY
var/obj/item/tank/tank_one
var/obj/item/tank/tank_two
var/obj/item/assembly/attached_device
var/mob/attacher = null
var/valve_open = FALSE
var/toggle = 1
/obj/item/transfer_valve/IsAssemblyHolder()
return TRUE
/obj/item/transfer_valve/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/tank))
if(tank_one && tank_two)
to_chat(user, "<span class='warning'>There are already two tanks attached, remove one first!</span>")
return
if(!tank_one)
if(!user.transferItemToLoc(item, src))
return
tank_one = item
to_chat(user, "<span class='notice'>You attach the tank to the transfer valve.</span>")
else if(!tank_two)
if(!user.transferItemToLoc(item, src))
return
tank_two = item
to_chat(user, "<span class='notice'>You attach the tank to the transfer valve.</span>")
update_icon()
//TODO: Have this take an assemblyholder
else if(isassembly(item))
var/obj/item/assembly/A = item
if(A.secured)
to_chat(user, "<span class='notice'>The device is secured.</span>")
return
if(attached_device)
to_chat(user, "<span class='warning'>There is already a device attached to the valve, remove it first!</span>")
return
if(!user.transferItemToLoc(item, src))
return
attached_device = A
to_chat(user, "<span class='notice'>You attach the [item] to the valve controls and secure it.</span>")
A.holder = src
A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb).
GLOB.bombers += "[key_name(user)] attached a [item] to a transfer valve."
message_admins("[ADMIN_LOOKUPFLW(user)] attached a [item] to a transfer valve.")
log_game("[key_name(user)] attached a [item] to a transfer valve.")
attacher = user
return
//Attached device memes
/obj/item/transfer_valve/Move()
. = ..()
if(attached_device)
attached_device.holder_movement()
/obj/item/transfer_valve/dropped()
. = ..()
if(attached_device)
attached_device.dropped()
/obj/item/transfer_valve/on_found(mob/finder)
if(attached_device)
attached_device.on_found(finder)
/obj/item/transfer_valve/Crossed(atom/movable/AM as mob|obj)
. = ..()
if(attached_device)
attached_device.Crossed(AM)
/obj/item/transfer_valve/attack_hand()//Triggers mousetraps
. = ..()
if(.)
return
if(attached_device)
attached_device.attack_hand()
//These keep attached devices synced up, for example a TTV with a mouse trap being found in a bag so it's triggered, or moving the TTV with an infrared beam sensor to update the beam's direction.
/obj/item/transfer_valve/attack_self(mob/user)
user.set_machine(src)
var/dat = {"<B> Valve properties: </B>
<BR> <B> Attachment one:</B> [tank_one] [tank_one ? "<A href='?src=[REF(src)];tankone=1'>Remove</A>" : ""]
<BR> <B> Attachment two:</B> [tank_two] [tank_two ? "<A href='?src=[REF(src)];tanktwo=1'>Remove</A>" : ""]
<BR> <B> Valve attachment:</B> [attached_device ? "<A href='?src=[REF(src)];device=1'>[attached_device]</A>" : "None"] [attached_device ? "<A href='?src=[REF(src)];rem_device=1'>Remove</A>" : ""]
<BR> <B> Valve status: </B> [ valve_open ? "<A href='?src=[REF(src)];open=1'>Closed</A> <B>Open</B>" : "<B>Closed</B> <A href='?src=[REF(src)];open=1'>Open</A>"]"}
var/datum/browser/popup = new(user, "trans_valve", name)
popup.set_content(dat)
popup.open()
return
/obj/item/transfer_valve/Topic(href, href_list)
..()
if(!usr.canUseTopic(src))
return
if(tank_one && href_list["tankone"])
split_gases()
valve_open = FALSE
tank_one.forceMove(drop_location())
tank_one = null
update_icon()
else if(tank_two && href_list["tanktwo"])
split_gases()
valve_open = FALSE
tank_two.forceMove(drop_location())
tank_two = null
update_icon()
else if(href_list["open"])
toggle_valve()
else if(attached_device)
if(href_list["rem_device"])
attached_device.on_detach()
attached_device = null
update_icon()
if(href_list["device"])
attached_device.attack_self(usr)
attack_self(usr)
add_fingerprint(usr)
/obj/item/transfer_valve/proc/process_activation(obj/item/D)
if(toggle)
toggle = FALSE
toggle_valve()
addtimer(CALLBACK(src, .proc/toggle_off), 5) //To stop a signal being spammed from a proxy sensor constantly going off or whatever
/obj/item/transfer_valve/proc/toggle_off()
toggle = TRUE
/obj/item/transfer_valve/update_icon()
cut_overlays()
underlays = null
if(!tank_one && !tank_two && !attached_device)
icon_state = "valve_1"
return
icon_state = "valve"
if(tank_one)
add_overlay("[tank_one.icon_state]")
if(tank_two)
var/icon/J = new(icon, icon_state = "[tank_two.icon_state]")
J.Shift(WEST, 13)
underlays += J
if(attached_device)
add_overlay("device")
if(istype(attached_device, /obj/item/assembly/infra))
var/obj/item/assembly/infra/sensor = attached_device
if(sensor.on && sensor.visible)
add_overlay("proxy_beam")
/obj/item/transfer_valve/proc/merge_gases(datum/gas_mixture/target, change_volume = TRUE)
var/target_self = FALSE
if(!target || (target == tank_one.air_contents))
target = tank_two.air_contents
if(target == tank_two.air_contents)
target_self = TRUE
if(change_volume)
if(!target_self)
target.volume += tank_two.volume
target.volume += tank_one.air_contents.volume
var/datum/gas_mixture/temp
temp = tank_one.air_contents.remove_ratio(1)
target.merge(temp)
if(!target_self)
temp = tank_two.air_contents.remove_ratio(1)
target.merge(temp)
/obj/item/transfer_valve/proc/split_gases()
if (!valve_open || !tank_one || !tank_two)
return
var/ratio1 = tank_one.air_contents.volume/tank_two.air_contents.volume
var/datum/gas_mixture/temp
temp = tank_two.air_contents.remove_ratio(ratio1)
tank_one.air_contents.merge(temp)
tank_two.air_contents.volume -= tank_one.air_contents.volume
/*
Exadv1: I know this isn't how it's going to work, but this was just to check
it explodes properly when it gets a signal (and it does).
*/
/obj/item/transfer_valve/proc/toggle_valve()
if(!valve_open && tank_one && tank_two)
valve_open = TRUE
var/turf/bombturf = get_turf(src)
var/attachment
if(attached_device)
if(istype(attached_device, /obj/item/assembly/signaler))
attachment = "<A HREF='?_src_=holder;[HrefToken()];secrets=list_signalers'>[attached_device]</A>"
else
attachment = attached_device
var/admin_attachment_message
var/attachment_message
if(attachment)
admin_attachment_message = " with [attachment] attached by [attacher ? ADMIN_LOOKUPFLW(attacher) : "Unknown"]"
attachment_message = " with [attachment] attached by [attacher ? key_name_admin(attacher) : "Unknown"]"
var/mob/bomber = get_mob_by_key(fingerprintslast)
var/admin_bomber_message
var/bomber_message
if(bomber)
admin_bomber_message = " - Last touched by: [ADMIN_LOOKUPFLW(bomber)]"
bomber_message = " - Last touched by: [key_name_admin(bomber)]"
var/admin_bomb_message = "Bomb valve opened in [ADMIN_VERBOSEJMP(bombturf)][admin_attachment_message][admin_bomber_message]"
GLOB.bombers += admin_bomb_message
message_admins(admin_bomb_message, 0, 1)
log_game("Bomb valve opened in [AREACOORD(bombturf)][attachment_message][bomber_message]")
merge_gases()
for(var/i in 1 to 6)
addtimer(CALLBACK(src, .proc/update_icon), 20 + (i - 1) * 10)
else if(valve_open && tank_one && tank_two)
split_gases()
valve_open = FALSE
update_icon()
// this doesn't do anything but the timer etc. expects it to be here
// eventually maybe have it update icon to show state (timer, prox etc.) like old bombs
/obj/item/transfer_valve/proc/c_state()
return
/obj/item/transfer_valve
icon = 'icons/obj/assemblies.dmi'
name = "tank transfer valve"
icon_state = "valve_1"
item_state = "ttv"
lefthand_file = 'icons/mob/inhands/weapons/bombs_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/bombs_righthand.dmi'
desc = "Regulates the transfer of air between two tanks."
w_class = WEIGHT_CLASS_BULKY
var/obj/item/tank/tank_one
var/obj/item/tank/tank_two
var/obj/item/assembly/attached_device
var/mob/attacher = null
var/valve_open = FALSE
var/toggle = 1
/obj/item/transfer_valve/IsAssemblyHolder()
return TRUE
/obj/item/transfer_valve/attackby(obj/item/item, mob/user, params)
if(istype(item, /obj/item/tank))
if(tank_one && tank_two)
to_chat(user, "<span class='warning'>There are already two tanks attached, remove one first!</span>")
return
if(!tank_one)
if(!user.transferItemToLoc(item, src))
return
tank_one = item
to_chat(user, "<span class='notice'>You attach the tank to the transfer valve.</span>")
else if(!tank_two)
if(!user.transferItemToLoc(item, src))
return
tank_two = item
to_chat(user, "<span class='notice'>You attach the tank to the transfer valve.</span>")
update_icon()
//TODO: Have this take an assemblyholder
else if(isassembly(item))
var/obj/item/assembly/A = item
if(A.secured)
to_chat(user, "<span class='notice'>The device is secured.</span>")
return
if(attached_device)
to_chat(user, "<span class='warning'>There is already a device attached to the valve, remove it first!</span>")
return
if(!user.transferItemToLoc(item, src))
return
attached_device = A
to_chat(user, "<span class='notice'>You attach the [item] to the valve controls and secure it.</span>")
A.holder = src
A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb).
GLOB.bombers += "[key_name(user)] attached a [item] to a transfer valve."
message_admins("[ADMIN_LOOKUPFLW(user)] attached a [item] to a transfer valve.")
log_game("[key_name(user)] attached a [item] to a transfer valve.")
attacher = user
return
//Attached device memes
/obj/item/transfer_valve/Move()
. = ..()
if(attached_device)
attached_device.holder_movement()
/obj/item/transfer_valve/dropped()
. = ..()
if(attached_device)
attached_device.dropped()
/obj/item/transfer_valve/on_found(mob/finder)
if(attached_device)
attached_device.on_found(finder)
/obj/item/transfer_valve/Crossed(atom/movable/AM as mob|obj)
. = ..()
if(attached_device)
attached_device.Crossed(AM)
/obj/item/transfer_valve/attack_hand()//Triggers mousetraps
. = ..()
if(.)
return
if(attached_device)
attached_device.attack_hand()
//These keep attached devices synced up, for example a TTV with a mouse trap being found in a bag so it's triggered, or moving the TTV with an infrared beam sensor to update the beam's direction.
/obj/item/transfer_valve/attack_self(mob/user)
user.set_machine(src)
var/dat = {"<B> Valve properties: </B>
<BR> <B> Attachment one:</B> [tank_one] [tank_one ? "<A href='?src=[REF(src)];tankone=1'>Remove</A>" : ""]
<BR> <B> Attachment two:</B> [tank_two] [tank_two ? "<A href='?src=[REF(src)];tanktwo=1'>Remove</A>" : ""]
<BR> <B> Valve attachment:</B> [attached_device ? "<A href='?src=[REF(src)];device=1'>[attached_device]</A>" : "None"] [attached_device ? "<A href='?src=[REF(src)];rem_device=1'>Remove</A>" : ""]
<BR> <B> Valve status: </B> [ valve_open ? "<A href='?src=[REF(src)];open=1'>Closed</A> <B>Open</B>" : "<B>Closed</B> <A href='?src=[REF(src)];open=1'>Open</A>"]"}
var/datum/browser/popup = new(user, "trans_valve", name)
popup.set_content(dat)
popup.open()
return
/obj/item/transfer_valve/Topic(href, href_list)
..()
if(!usr.canUseTopic(src))
return
if(tank_one && href_list["tankone"])
split_gases()
valve_open = FALSE
tank_one.forceMove(drop_location())
tank_one = null
update_icon()
else if(tank_two && href_list["tanktwo"])
split_gases()
valve_open = FALSE
tank_two.forceMove(drop_location())
tank_two = null
update_icon()
else if(href_list["open"])
toggle_valve()
else if(attached_device)
if(href_list["rem_device"])
attached_device.on_detach()
attached_device = null
update_icon()
if(href_list["device"])
attached_device.attack_self(usr)
attack_self(usr)
add_fingerprint(usr)
/obj/item/transfer_valve/proc/process_activation(obj/item/D)
if(toggle)
toggle = FALSE
toggle_valve()
addtimer(CALLBACK(src, .proc/toggle_off), 5) //To stop a signal being spammed from a proxy sensor constantly going off or whatever
/obj/item/transfer_valve/proc/toggle_off()
toggle = TRUE
/obj/item/transfer_valve/update_icon()
cut_overlays()
underlays = null
if(!tank_one && !tank_two && !attached_device)
icon_state = "valve_1"
return
icon_state = "valve"
if(tank_one)
add_overlay("[tank_one.icon_state]")
if(tank_two)
var/icon/J = new(icon, icon_state = "[tank_two.icon_state]")
J.Shift(WEST, 13)
underlays += J
if(attached_device)
add_overlay("device")
if(istype(attached_device, /obj/item/assembly/infra))
var/obj/item/assembly/infra/sensor = attached_device
if(sensor.on && sensor.visible)
add_overlay("proxy_beam")
/obj/item/transfer_valve/proc/merge_gases(datum/gas_mixture/target, change_volume = TRUE)
var/target_self = FALSE
if(!target || (target == tank_one.air_contents))
target = tank_two.air_contents
if(target == tank_two.air_contents)
target_self = TRUE
if(change_volume)
if(!target_self)
target.volume += tank_two.volume
target.volume += tank_one.air_contents.volume
var/datum/gas_mixture/temp
temp = tank_one.air_contents.remove_ratio(1)
target.merge(temp)
if(!target_self)
temp = tank_two.air_contents.remove_ratio(1)
target.merge(temp)
/obj/item/transfer_valve/proc/split_gases()
if (!valve_open || !tank_one || !tank_two)
return
var/ratio1 = tank_one.air_contents.volume/tank_two.air_contents.volume
var/datum/gas_mixture/temp
temp = tank_two.air_contents.remove_ratio(ratio1)
tank_one.air_contents.merge(temp)
tank_two.air_contents.volume -= tank_one.air_contents.volume
/*
Exadv1: I know this isn't how it's going to work, but this was just to check
it explodes properly when it gets a signal (and it does).
*/
/obj/item/transfer_valve/proc/toggle_valve()
if(!valve_open && tank_one && tank_two)
valve_open = TRUE
var/turf/bombturf = get_turf(src)
var/attachment
if(attached_device)
if(istype(attached_device, /obj/item/assembly/signaler))
attachment = "<A HREF='?_src_=holder;[HrefToken()];secrets=list_signalers'>[attached_device]</A>"
else
attachment = attached_device
var/admin_attachment_message
var/attachment_message
if(attachment)
admin_attachment_message = " with [attachment] attached by [attacher ? ADMIN_LOOKUPFLW(attacher) : "Unknown"]"
attachment_message = " with [attachment] attached by [attacher ? key_name_admin(attacher) : "Unknown"]"
var/mob/bomber = get_mob_by_key(fingerprintslast)
var/admin_bomber_message
var/bomber_message
if(bomber)
admin_bomber_message = " - Last touched by: [ADMIN_LOOKUPFLW(bomber)]"
bomber_message = " - Last touched by: [key_name_admin(bomber)]"
var/admin_bomb_message = "Bomb valve opened in [ADMIN_VERBOSEJMP(bombturf)][admin_attachment_message][admin_bomber_message]"
GLOB.bombers += admin_bomb_message
message_admins(admin_bomb_message, 0, 1)
log_game("Bomb valve opened in [AREACOORD(bombturf)][attachment_message][bomber_message]")
merge_gases()
for(var/i in 1 to 6)
addtimer(CALLBACK(src, /atom/.proc/update_icon), 20 + (i - 1) * 10)
else if(valve_open && tank_one && tank_two)
split_gases()
valve_open = FALSE
update_icon()
// this doesn't do anything but the timer etc. expects it to be here
// eventually maybe have it update icon to show state (timer, prox etc.) like old bombs
/obj/item/transfer_valve/proc/c_state()
return
+3 -4
View File
@@ -213,7 +213,7 @@
loadedWeightClass -= I.w_class
else if (A == tank)
tank = null
update_icons()
update_icon()
/obj/item/pneumatic_cannon/ghetto //Obtainable by improvised methods; more gas per use, less capacity, but smaller
name = "improvised pneumatic cannon"
@@ -239,14 +239,13 @@
return
to_chat(user, "<span class='notice'>You hook \the [thetank] up to \the [src].</span>")
tank = thetank
update_icons()
update_icon()
/obj/item/pneumatic_cannon/proc/update_icons()
/obj/item/pneumatic_cannon/update_icon()
cut_overlays()
if(!tank)
return
add_overlay(tank.icon_state)
update_icon()
/obj/item/pneumatic_cannon/proc/fill_with_type(type, amount)
if(!ispath(type, /obj) && !ispath(type, /mob))
+413 -413
View File
@@ -1,413 +1,413 @@
//The robot bodyparts have been moved to code/module/surgery/bodyparts/robot_bodyparts.dm
/obj/item/robot_suit
name = "cyborg endoskeleton"
desc = "A complex metal backbone with standard limb sockets and pseudomuscle anchors."
icon = 'icons/mob/augmentation/augments.dmi'
icon_state = "robo_suit"
var/obj/item/bodypart/l_arm/robot/l_arm = null
var/obj/item/bodypart/r_arm/robot/r_arm = null
var/obj/item/bodypart/l_leg/robot/l_leg = null
var/obj/item/bodypart/r_leg/robot/r_leg = null
var/obj/item/bodypart/chest/robot/chest = null
var/obj/item/bodypart/head/robot/head = null
var/created_name = ""
var/mob/living/silicon/ai/forced_ai
var/locomotion = 1
var/lawsync = 1
var/aisync = 1
var/panel_locked = TRUE
/obj/item/robot_suit/New()
..()
updateicon()
/obj/item/robot_suit/prebuilt/New()
l_arm = new(src)
r_arm = new(src)
l_leg = new(src)
r_leg = new(src)
head = new(src)
head.flash1 = new(head)
head.flash2 = new(head)
chest = new(src)
chest.wired = TRUE
chest.cell = new /obj/item/stock_parts/cell/high/plus(chest)
..()
/obj/item/robot_suit/proc/updateicon()
cut_overlays()
if(l_arm)
add_overlay("[l_arm.icon_state]+o")
if(r_arm)
add_overlay("[r_arm.icon_state]+o")
if(chest)
add_overlay("[chest.icon_state]+o")
if(l_leg)
add_overlay("[l_leg.icon_state]+o")
if(r_leg)
add_overlay("[r_leg.icon_state]+o")
if(head)
add_overlay("[head.icon_state]+o")
/obj/item/robot_suit/proc/check_completion()
if(src.l_arm && src.r_arm)
if(src.l_leg && src.r_leg)
if(src.chest && src.head)
SSblackbox.record_feedback("amount", "cyborg_frames_built", 1)
return 1
return 0
/obj/item/robot_suit/wrench_act(mob/living/user, obj/item/I) //Deconstucts empty borg shell. Flashes remain unbroken because they haven't been used yet
var/turf/T = get_turf(src)
if(l_leg || r_leg || chest || l_arm || r_arm || head)
if(I.use_tool(src, user, 5, volume=50))
if(l_leg)
l_leg.forceMove(T)
l_leg = null
if(r_leg)
r_leg.forceMove(T)
r_leg = null
if(chest)
if (chest.cell) //Sanity check.
chest.cell.forceMove(T)
chest.cell = null
chest.forceMove(T)
new /obj/item/stack/cable_coil(T, 1)
chest.wired = FALSE
chest = null
if(l_arm)
l_arm.forceMove(T)
l_arm = null
if(r_arm)
r_arm.forceMove(T)
r_arm = null
if(head)
head.forceMove(T)
head.flash1.forceMove(T)
head.flash1 = null
head.flash2.forceMove(T)
head.flash2 = null
head = null
to_chat(user, "<span class='notice'>You disassemble the cyborg shell.</span>")
else
to_chat(user, "<span class='notice'>There is nothing to remove from the endoskeleton.</span>")
updateicon()
/obj/item/robot_suit/proc/put_in_hand_or_drop(mob/living/user, obj/item/I) //normal put_in_hands() drops the item ontop of the player, this drops it at the suit's loc
if(!user.put_in_hands(I))
I.forceMove(drop_location())
return FALSE
return TRUE
/obj/item/robot_suit/screwdriver_act(mob/living/user, obj/item/I) //Swaps the power cell if you're holding a new one in your other hand.
. = ..()
if(.)
return TRUE
if(!chest) //can't remove a cell if there's no chest to remove it from.
to_chat(user, "<span class='notice'>[src] has no attached torso.</span>")
return
var/obj/item/stock_parts/cell/temp_cell = user.is_holding_item_of_type(/obj/item/stock_parts/cell)
var/swap_failed
if(!temp_cell) //if we're not holding a cell
swap_failed = TRUE
else if(!user.transferItemToLoc(temp_cell, chest))
swap_failed = TRUE
to_chat(user, "<span class='warning'>[temp_cell] is stuck to your hand, you can't put it in [src]!</span>")
if(chest.cell) //drop the chest's current cell no matter what.
put_in_hand_or_drop(user, chest.cell)
if(swap_failed) //we didn't transfer any new items.
if(chest.cell) //old cell ejected, nothing inserted.
to_chat(user, "<span class='notice'>You remove [chest.cell] from [src].</span>")
chest.cell = null
else
to_chat(user, "<span class='notice'>The power cell slot in [src]'s torso is empty.</span>")
return
to_chat(user, "<span class='notice'>You [chest.cell ? "replace [src]'s [chest.cell.name] with [temp_cell]" : "insert [temp_cell] into [src]"].</span>")
chest.cell = temp_cell
return TRUE
/obj/item/robot_suit/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stack/sheet/metal))
var/obj/item/stack/sheet/metal/M = W
if(!l_arm && !r_arm && !l_leg && !r_leg && !chest && !head)
if (M.use(1))
var/obj/item/bot_assembly/ed209/B = new
B.forceMove(drop_location())
to_chat(user, "<span class='notice'>You arm the robot frame.</span>")
var/holding_this = user.get_inactive_held_item()==src
qdel(src)
if (holding_this)
user.put_in_inactive_hand(B)
else
to_chat(user, "<span class='warning'>You need one sheet of metal to start building ED-209!</span>")
return
else if(istype(W, /obj/item/bodypart/l_leg/robot))
if(src.l_leg)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)
W.cut_overlays()
src.l_leg = W
src.updateicon()
else if(istype(W, /obj/item/bodypart/r_leg/robot))
if(src.r_leg)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)
W.cut_overlays()
src.r_leg = W
src.updateicon()
else if(istype(W, /obj/item/bodypart/l_arm/robot))
if(src.l_arm)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)
W.cut_overlays()
src.l_arm = W
src.updateicon()
else if(istype(W, /obj/item/bodypart/r_arm/robot))
if(src.r_arm)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)//in case it is a dismembered robotic limb
W.cut_overlays()
src.r_arm = W
src.updateicon()
else if(istype(W, /obj/item/bodypart/chest/robot))
var/obj/item/bodypart/chest/robot/CH = W
if(src.chest)
return
if(CH.wired && CH.cell)
if(!user.transferItemToLoc(CH, src))
return
CH.icon_state = initial(CH.icon_state) //in case it is a dismembered robotic limb
CH.cut_overlays()
src.chest = CH
src.updateicon()
else if(!CH.wired)
to_chat(user, "<span class='warning'>You need to attach wires to it first!</span>")
else
to_chat(user, "<span class='warning'>You need to attach a cell to it first!</span>")
else if(istype(W, /obj/item/bodypart/head/robot))
var/obj/item/bodypart/head/robot/HD = W
for(var/X in HD.contents)
if(istype(X, /obj/item/organ))
to_chat(user, "<span class='warning'>There are organs inside [HD]!</span>")
return
if(src.head)
return
if(HD.flash2 && HD.flash1)
if(!user.transferItemToLoc(HD, src))
return
HD.icon_state = initial(HD.icon_state)//in case it is a dismembered robotic limb
HD.cut_overlays()
src.head = HD
src.updateicon()
else
to_chat(user, "<span class='warning'>You need to attach a flash to it first!</span>")
else if (istype(W, /obj/item/multitool))
if(check_completion())
Interact(user)
else
to_chat(user, "<span class='warning'>The endoskeleton must be assembled before debugging can begin!</span>")
else if(istype(W, /obj/item/mmi))
var/obj/item/mmi/M = W
if(check_completion())
if(!chest.cell)
to_chat(user, "<span class='warning'>The endoskeleton still needs a power cell!</span>")
return
if(!isturf(loc))
to_chat(user, "<span class='warning'>You can't put [M] in, the frame has to be standing on the ground to be perfectly precise!</span>")
return
if(!M.brainmob)
to_chat(user, "<span class='warning'>Sticking an empty [M.name] into the frame would sort of defeat the purpose!</span>")
return
var/mob/living/brain/BM = M.brainmob
if(!BM.key || !BM.mind)
to_chat(user, "<span class='warning'>The MMI indicates that their mind is completely unresponsive; there's no point!</span>")
return
if(!BM.client) //braindead
to_chat(user, "<span class='warning'>The MMI indicates that their mind is currently inactive; it might change!</span>")
return
if(BM.stat == DEAD || (M.brain && M.brain.organ_flags & ORGAN_FAILING))
to_chat(user, "<span class='warning'>Sticking a dead brain into the frame would sort of defeat the purpose!</span>")
return
if(jobban_isbanned(BM, "Cyborg") || QDELETED(src) || QDELETED(BM) || QDELETED(user) || QDELETED(M) || !Adjacent(user))
if(!QDELETED(M))
to_chat(user, "<span class='warning'>This [M.name] does not seem to fit!</span>")
return
if(!user.temporarilyRemoveItemFromInventory(W))
return
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc))
if(!O)
return
if(M.laws && M.laws.id != DEFAULT_AI_LAWID)
aisync = 0
lawsync = 0
O.laws = M.laws
M.laws.associate(O)
O.invisibility = 0
//Transfer debug settings to new mob
O.custom_name = created_name
O.locked = panel_locked
if(!aisync)
lawsync = 0
O.set_connected_ai(null)
else
O.notify_ai(NEW_BORG)
if(forced_ai)
O.set_connected_ai(forced_ai)
if(!lawsync)
O.lawupdate = 0
if(M.laws.id == DEFAULT_AI_LAWID)
O.make_laws()
SSticker.mode.remove_antag_for_borging(BM.mind)
if(!istype(M.laws, /datum/ai_laws/ratvar))
remove_servant_of_ratvar(BM, TRUE)
BM.mind.transfer_to(O)
if(O.mind && O.mind.special_role)
O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.")
to_chat(O, "<span class='userdanger'>You have been robotized!</span>")
to_chat(O, "<span class='danger'>You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.</span>")
O.job = "Cyborg"
O.cell = chest.cell
chest.cell.forceMove(O)
chest.cell = null
W.forceMove(O)//Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
if(O.mmi) //we delete the mmi created by robot/New()
qdel(O.mmi)
O.mmi = W //and give the real mmi to the borg.
O.updatename()
SSblackbox.record_feedback("amount", "cyborg_birth", 1)
forceMove(O)
O.robot_suit = src
if(!locomotion)
O.lockcharge = 1
O.update_canmove()
to_chat(O, "<span class='warning'>Error: Servo motors unresponsive.</span>")
else
to_chat(user, "<span class='warning'>The MMI must go in after everything else!</span>")
else if(istype(W, /obj/item/borg/upgrade/ai))
var/obj/item/borg/upgrade/ai/M = W
if(check_completion())
if(!isturf(loc))
to_chat(user, "<span class='warning'>You cannot install[M], the frame has to be standing on the ground to be perfectly precise!</span>")
return
if(!user.temporarilyRemoveItemFromInventory(M))
to_chat(user, "<span class='warning'>[M] is stuck to your hand!</span>")
return
qdel(M)
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot/shell(get_turf(src))
if(!aisync)
lawsync = FALSE
O.set_connected_ai(null)
else
if(forced_ai)
O.set_connected_ai(forced_ai)
O.notify_ai(AI_SHELL)
if(!lawsync)
O.lawupdate = FALSE
O.make_laws()
O.cell = chest.cell
chest.cell.forceMove(O)
chest.cell = null
O.locked = panel_locked
O.job = "Cyborg"
forceMove(O)
O.robot_suit = src
if(!locomotion)
O.lockcharge = TRUE
O.update_canmove()
else if(istype(W, /obj/item/pen))
to_chat(user, "<span class='warning'>You need to use a multitool to name [src]!</span>")
else
return ..()
/obj/item/robot_suit/proc/Interact(mob/user)
var/t1 = "Designation: <A href='?src=[REF(src)];Name=1'>[(created_name ? "[created_name]" : "Default Cyborg")]</a><br>\n"
t1 += "Master AI: <A href='?src=[REF(src)];Master=1'>[(forced_ai ? "[forced_ai.name]" : "Automatic")]</a><br><br>\n"
t1 += "LawSync Port: <A href='?src=[REF(src)];Law=1'>[(lawsync ? "Open" : "Closed")]</a><br>\n"
t1 += "AI Connection Port: <A href='?src=[REF(src)];AI=1'>[(aisync ? "Open" : "Closed")]</a><br>\n"
t1 += "Servo Motor Functions: <A href='?src=[REF(src)];Loco=1'>[(locomotion ? "Unlocked" : "Locked")]</a><br>\n"
t1 += "Panel Lock: <A href='?src=[REF(src)];Panel=1'>[(panel_locked ? "Engaged" : "Disengaged")]</a><br>\n"
var/datum/browser/popup = new(user, "robotdebug", "Cyborg Boot Debug", 310, 220)
popup.set_content(t1)
popup.open()
/obj/item/robot_suit/Topic(href, href_list)
if(usr.incapacitated() || !Adjacent(usr))
return
var/mob/living/living_user = usr
var/obj/item/item_in_hand = living_user.get_active_held_item()
if(!istype(item_in_hand, /obj/item/multitool))
to_chat(living_user, "<span class='warning'>You need a multitool!</span>")
return
if(href_list["Name"])
var/new_name = reject_bad_name(input(usr, "Enter new designation. Set to blank to reset to default.", "Cyborg Debug", src.created_name), TRUE)
if(!in_range(src, usr) && src.loc != usr)
return
if(new_name)
created_name = new_name
else
created_name = ""
else if(href_list["Master"])
forced_ai = select_active_ai(usr)
if(!forced_ai)
to_chat(usr, "<span class='error'>No active AIs detected.</span>")
else if(href_list["Law"])
lawsync = !lawsync
else if(href_list["AI"])
aisync = !aisync
else if(href_list["Loco"])
locomotion = !locomotion
else if(href_list["Panel"])
panel_locked = !panel_locked
add_fingerprint(usr)
Interact(usr)
//The robot bodyparts have been moved to code/module/surgery/bodyparts/robot_bodyparts.dm
/obj/item/robot_suit
name = "cyborg endoskeleton"
desc = "A complex metal backbone with standard limb sockets and pseudomuscle anchors."
icon = 'icons/mob/augmentation/augments.dmi'
icon_state = "robo_suit"
var/obj/item/bodypart/l_arm/robot/l_arm = null
var/obj/item/bodypart/r_arm/robot/r_arm = null
var/obj/item/bodypart/l_leg/robot/l_leg = null
var/obj/item/bodypart/r_leg/robot/r_leg = null
var/obj/item/bodypart/chest/robot/chest = null
var/obj/item/bodypart/head/robot/head = null
var/created_name = ""
var/mob/living/silicon/ai/forced_ai
var/locomotion = 1
var/lawsync = 1
var/aisync = 1
var/panel_locked = TRUE
/obj/item/robot_suit/New()
..()
update_icon()
/obj/item/robot_suit/prebuilt/New()
l_arm = new(src)
r_arm = new(src)
l_leg = new(src)
r_leg = new(src)
head = new(src)
head.flash1 = new(head)
head.flash2 = new(head)
chest = new(src)
chest.wired = TRUE
chest.cell = new /obj/item/stock_parts/cell/high/plus(chest)
..()
/obj/item/robot_suit/update_icon()
cut_overlays()
if(l_arm)
add_overlay("[l_arm.icon_state]+o")
if(r_arm)
add_overlay("[r_arm.icon_state]+o")
if(chest)
add_overlay("[chest.icon_state]+o")
if(l_leg)
add_overlay("[l_leg.icon_state]+o")
if(r_leg)
add_overlay("[r_leg.icon_state]+o")
if(head)
add_overlay("[head.icon_state]+o")
/obj/item/robot_suit/proc/check_completion()
if(src.l_arm && src.r_arm)
if(src.l_leg && src.r_leg)
if(src.chest && src.head)
SSblackbox.record_feedback("amount", "cyborg_frames_built", 1)
return 1
return 0
/obj/item/robot_suit/wrench_act(mob/living/user, obj/item/I) //Deconstucts empty borg shell. Flashes remain unbroken because they haven't been used yet
var/turf/T = get_turf(src)
if(l_leg || r_leg || chest || l_arm || r_arm || head)
if(I.use_tool(src, user, 5, volume=50))
if(l_leg)
l_leg.forceMove(T)
l_leg = null
if(r_leg)
r_leg.forceMove(T)
r_leg = null
if(chest)
if (chest.cell) //Sanity check.
chest.cell.forceMove(T)
chest.cell = null
chest.forceMove(T)
new /obj/item/stack/cable_coil(T, 1)
chest.wired = FALSE
chest = null
if(l_arm)
l_arm.forceMove(T)
l_arm = null
if(r_arm)
r_arm.forceMove(T)
r_arm = null
if(head)
head.forceMove(T)
head.flash1.forceMove(T)
head.flash1 = null
head.flash2.forceMove(T)
head.flash2 = null
head = null
to_chat(user, "<span class='notice'>You disassemble the cyborg shell.</span>")
else
to_chat(user, "<span class='notice'>There is nothing to remove from the endoskeleton.</span>")
update_icon()
/obj/item/robot_suit/proc/put_in_hand_or_drop(mob/living/user, obj/item/I) //normal put_in_hands() drops the item ontop of the player, this drops it at the suit's loc
if(!user.put_in_hands(I))
I.forceMove(drop_location())
return FALSE
return TRUE
/obj/item/robot_suit/screwdriver_act(mob/living/user, obj/item/I) //Swaps the power cell if you're holding a new one in your other hand.
. = ..()
if(.)
return TRUE
if(!chest) //can't remove a cell if there's no chest to remove it from.
to_chat(user, "<span class='notice'>[src] has no attached torso.</span>")
return
var/obj/item/stock_parts/cell/temp_cell = user.is_holding_item_of_type(/obj/item/stock_parts/cell)
var/swap_failed
if(!temp_cell) //if we're not holding a cell
swap_failed = TRUE
else if(!user.transferItemToLoc(temp_cell, chest))
swap_failed = TRUE
to_chat(user, "<span class='warning'>[temp_cell] is stuck to your hand, you can't put it in [src]!</span>")
if(chest.cell) //drop the chest's current cell no matter what.
put_in_hand_or_drop(user, chest.cell)
if(swap_failed) //we didn't transfer any new items.
if(chest.cell) //old cell ejected, nothing inserted.
to_chat(user, "<span class='notice'>You remove [chest.cell] from [src].</span>")
chest.cell = null
else
to_chat(user, "<span class='notice'>The power cell slot in [src]'s torso is empty.</span>")
return
to_chat(user, "<span class='notice'>You [chest.cell ? "replace [src]'s [chest.cell.name] with [temp_cell]" : "insert [temp_cell] into [src]"].</span>")
chest.cell = temp_cell
return TRUE
/obj/item/robot_suit/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/stack/sheet/metal))
var/obj/item/stack/sheet/metal/M = W
if(!l_arm && !r_arm && !l_leg && !r_leg && !chest && !head)
if (M.use(1))
var/obj/item/bot_assembly/ed209/B = new
B.forceMove(drop_location())
to_chat(user, "<span class='notice'>You arm the robot frame.</span>")
var/holding_this = user.get_inactive_held_item()==src
qdel(src)
if (holding_this)
user.put_in_inactive_hand(B)
else
to_chat(user, "<span class='warning'>You need one sheet of metal to start building ED-209!</span>")
return
else if(istype(W, /obj/item/bodypart/l_leg/robot))
if(src.l_leg)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)
W.cut_overlays()
src.l_leg = W
update_icon()
else if(istype(W, /obj/item/bodypart/r_leg/robot))
if(src.r_leg)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)
W.cut_overlays()
src.r_leg = W
update_icon()
else if(istype(W, /obj/item/bodypart/l_arm/robot))
if(src.l_arm)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)
W.cut_overlays()
src.l_arm = W
update_icon()
else if(istype(W, /obj/item/bodypart/r_arm/robot))
if(src.r_arm)
return
if(!user.transferItemToLoc(W, src))
return
W.icon_state = initial(W.icon_state)//in case it is a dismembered robotic limb
W.cut_overlays()
src.r_arm = W
update_icon()
else if(istype(W, /obj/item/bodypart/chest/robot))
var/obj/item/bodypart/chest/robot/CH = W
if(src.chest)
return
if(CH.wired && CH.cell)
if(!user.transferItemToLoc(CH, src))
return
CH.icon_state = initial(CH.icon_state) //in case it is a dismembered robotic limb
CH.cut_overlays()
src.chest = CH
update_icon()
else if(!CH.wired)
to_chat(user, "<span class='warning'>You need to attach wires to it first!</span>")
else
to_chat(user, "<span class='warning'>You need to attach a cell to it first!</span>")
else if(istype(W, /obj/item/bodypart/head/robot))
var/obj/item/bodypart/head/robot/HD = W
for(var/X in HD.contents)
if(istype(X, /obj/item/organ))
to_chat(user, "<span class='warning'>There are organs inside [HD]!</span>")
return
if(src.head)
return
if(HD.flash2 && HD.flash1)
if(!user.transferItemToLoc(HD, src))
return
HD.icon_state = initial(HD.icon_state)//in case it is a dismembered robotic limb
HD.cut_overlays()
src.head = HD
update_icon()
else
to_chat(user, "<span class='warning'>You need to attach a flash to it first!</span>")
else if (istype(W, /obj/item/multitool))
if(check_completion())
Interact(user)
else
to_chat(user, "<span class='warning'>The endoskeleton must be assembled before debugging can begin!</span>")
else if(istype(W, /obj/item/mmi))
var/obj/item/mmi/M = W
if(check_completion())
if(!chest.cell)
to_chat(user, "<span class='warning'>The endoskeleton still needs a power cell!</span>")
return
if(!isturf(loc))
to_chat(user, "<span class='warning'>You can't put [M] in, the frame has to be standing on the ground to be perfectly precise!</span>")
return
if(!M.brainmob)
to_chat(user, "<span class='warning'>Sticking an empty [M.name] into the frame would sort of defeat the purpose!</span>")
return
var/mob/living/brain/BM = M.brainmob
if(!BM.key || !BM.mind)
to_chat(user, "<span class='warning'>The MMI indicates that their mind is completely unresponsive; there's no point!</span>")
return
if(!BM.client) //braindead
to_chat(user, "<span class='warning'>The MMI indicates that their mind is currently inactive; it might change!</span>")
return
if(BM.stat == DEAD || (M.brain && M.brain.organ_flags & ORGAN_FAILING))
to_chat(user, "<span class='warning'>Sticking a dead brain into the frame would sort of defeat the purpose!</span>")
return
if(jobban_isbanned(BM, "Cyborg") || QDELETED(src) || QDELETED(BM) || QDELETED(user) || QDELETED(M) || !Adjacent(user))
if(!QDELETED(M))
to_chat(user, "<span class='warning'>This [M.name] does not seem to fit!</span>")
return
if(!user.temporarilyRemoveItemFromInventory(W))
return
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot(get_turf(loc))
if(!O)
return
if(M.laws && M.laws.id != DEFAULT_AI_LAWID)
aisync = 0
lawsync = 0
O.laws = M.laws
M.laws.associate(O)
O.invisibility = 0
//Transfer debug settings to new mob
O.custom_name = created_name
O.locked = panel_locked
if(!aisync)
lawsync = 0
O.set_connected_ai(null)
else
O.notify_ai(NEW_BORG)
if(forced_ai)
O.set_connected_ai(forced_ai)
if(!lawsync)
O.lawupdate = 0
if(M.laws.id == DEFAULT_AI_LAWID)
O.make_laws()
SSticker.mode.remove_antag_for_borging(BM.mind)
if(!istype(M.laws, /datum/ai_laws/ratvar))
remove_servant_of_ratvar(BM, TRUE)
BM.mind.transfer_to(O)
if(O.mind && O.mind.special_role)
O.mind.store_memory("As a cyborg, you must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.")
to_chat(O, "<span class='userdanger'>You have been robotized!</span>")
to_chat(O, "<span class='danger'>You must obey your silicon laws and master AI above all else. Your objectives will consider you to be dead.</span>")
O.job = "Cyborg"
O.cell = chest.cell
chest.cell.forceMove(O)
chest.cell = null
W.forceMove(O)//Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
if(O.mmi) //we delete the mmi created by robot/New()
qdel(O.mmi)
O.mmi = W //and give the real mmi to the borg.
O.updatename()
SSblackbox.record_feedback("amount", "cyborg_birth", 1)
forceMove(O)
O.robot_suit = src
if(!locomotion)
O.lockcharge = 1
O.update_canmove()
to_chat(O, "<span class='warning'>Error: Servo motors unresponsive.</span>")
else
to_chat(user, "<span class='warning'>The MMI must go in after everything else!</span>")
else if(istype(W, /obj/item/borg/upgrade/ai))
var/obj/item/borg/upgrade/ai/M = W
if(check_completion())
if(!isturf(loc))
to_chat(user, "<span class='warning'>You cannot install[M], the frame has to be standing on the ground to be perfectly precise!</span>")
return
if(!user.temporarilyRemoveItemFromInventory(M))
to_chat(user, "<span class='warning'>[M] is stuck to your hand!</span>")
return
qdel(M)
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot/shell(get_turf(src))
if(!aisync)
lawsync = FALSE
O.set_connected_ai(null)
else
if(forced_ai)
O.set_connected_ai(forced_ai)
O.notify_ai(AI_SHELL)
if(!lawsync)
O.lawupdate = FALSE
O.make_laws()
O.cell = chest.cell
chest.cell.forceMove(O)
chest.cell = null
O.locked = panel_locked
O.job = "Cyborg"
forceMove(O)
O.robot_suit = src
if(!locomotion)
O.lockcharge = TRUE
O.update_canmove()
else if(istype(W, /obj/item/pen))
to_chat(user, "<span class='warning'>You need to use a multitool to name [src]!</span>")
else
return ..()
/obj/item/robot_suit/proc/Interact(mob/user)
var/t1 = "Designation: <A href='?src=[REF(src)];Name=1'>[(created_name ? "[created_name]" : "Default Cyborg")]</a><br>\n"
t1 += "Master AI: <A href='?src=[REF(src)];Master=1'>[(forced_ai ? "[forced_ai.name]" : "Automatic")]</a><br><br>\n"
t1 += "LawSync Port: <A href='?src=[REF(src)];Law=1'>[(lawsync ? "Open" : "Closed")]</a><br>\n"
t1 += "AI Connection Port: <A href='?src=[REF(src)];AI=1'>[(aisync ? "Open" : "Closed")]</a><br>\n"
t1 += "Servo Motor Functions: <A href='?src=[REF(src)];Loco=1'>[(locomotion ? "Unlocked" : "Locked")]</a><br>\n"
t1 += "Panel Lock: <A href='?src=[REF(src)];Panel=1'>[(panel_locked ? "Engaged" : "Disengaged")]</a><br>\n"
var/datum/browser/popup = new(user, "robotdebug", "Cyborg Boot Debug", 310, 220)
popup.set_content(t1)
popup.open()
/obj/item/robot_suit/Topic(href, href_list)
if(usr.incapacitated() || !Adjacent(usr))
return
var/mob/living/living_user = usr
var/obj/item/item_in_hand = living_user.get_active_held_item()
if(!istype(item_in_hand, /obj/item/multitool))
to_chat(living_user, "<span class='warning'>You need a multitool!</span>")
return
if(href_list["Name"])
var/new_name = reject_bad_name(input(usr, "Enter new designation. Set to blank to reset to default.", "Cyborg Debug", src.created_name), TRUE)
if(!in_range(src, usr) && src.loc != usr)
return
if(new_name)
created_name = new_name
else
created_name = ""
else if(href_list["Master"])
forced_ai = select_active_ai(usr)
if(!forced_ai)
to_chat(usr, "<span class='error'>No active AIs detected.</span>")
else if(href_list["Law"])
lawsync = !lawsync
else if(href_list["AI"])
aisync = !aisync
else if(href_list["Loco"])
locomotion = !locomotion
else if(href_list["Panel"])
panel_locked = !panel_locked
add_fingerprint(usr)
Interact(usr)
+6
View File
@@ -392,3 +392,9 @@
icon_type = "silver ring"
spawn_type = /obj/item/clothing/gloves/ring/silver
/obj/item/storage/fancy/ringbox/lyricalpaws
name = "Ornate Ring Box"
desc = "A rich royal blue felted box, the inside lined with a beautiful black silk. It was clearly designed to hold a ring of sorts."
icon_state = "paws ringbox"
icon_type = "ornate ring"
spawn_type = /obj/item/clothing/gloves/ring/lyricalpaws
+252 -255
View File
@@ -1,255 +1,252 @@
/obj
var/crit_fail = FALSE
animate_movement = 2
speech_span = SPAN_ROBOT
var/obj_flags = CAN_BE_HIT
var/set_obj_flags // ONLY FOR MAPPING: Sets flags from a string list, handled in Initialize. Usage: set_obj_flags = "EMAGGED;!CAN_BE_HIT" to set EMAGGED and clear CAN_BE_HIT.
var/damtype = BRUTE
var/force = 0
var/datum/armor/armor
var/obj_integrity //defaults to max_integrity
var/max_integrity = 500
var/integrity_failure = 0 //0 if we have no special broken behavior
var/resistance_flags = NONE // INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ON_FIRE | UNACIDABLE | ACID_PROOF
var/acid_level = 0 //how much acid is on that obj
var/persistence_replacement //have something WAY too amazing to live to the next round? Set a new path here. Overuse of this var will make me upset.
var/current_skin //the item reskin
var/list/unique_reskin //List of options to reskin.
var/always_reskinnable = FALSE
// Access levels, used in modules\jobs\access.dm
var/list/req_access
var/req_access_txt = "0"
var/list/req_one_access
var/req_one_access_txt = "0"
var/renamedByPlayer = FALSE //set when a player uses a pen on a renamable object
vis_flags = VIS_INHERIT_PLANE //when this be added to vis_contents of something it inherit something.plane, important for visualisation of obj in openspace.
/obj/vv_edit_var(vname, vval)
switch(vname)
if("anchored")
setAnchored(vval)
return TRUE
if("obj_flags")
if ((obj_flags & DANGEROUS_POSSESSION) && !(vval & DANGEROUS_POSSESSION))
return FALSE
if("control_object")
var/obj/O = vval
if(istype(O) && (O.obj_flags & DANGEROUS_POSSESSION))
return FALSE
return ..()
/obj/Initialize()
. = ..()
if (islist(armor))
armor = getArmor(arglist(armor))
else if (!armor)
armor = getArmor()
else if (!istype(armor, /datum/armor))
stack_trace("Invalid type [armor.type] found in .armor during /obj Initialize()")
if(obj_integrity == null)
obj_integrity = max_integrity
if (set_obj_flags)
var/flagslist = splittext(set_obj_flags,";")
var/list/string_to_objflag = GLOB.bitfields["obj_flags"]
for (var/flag in flagslist)
if(flag[1] == "!")
flag = copytext(flag, length(flag[1]) + 1) // Get all but the initial !
obj_flags &= ~string_to_objflag[flag]
else
obj_flags |= string_to_objflag[flag]
if((obj_flags & ON_BLUEPRINTS) && isturf(loc))
var/turf/T = loc
T.add_blueprints_preround(src)
/obj/Destroy(force=FALSE)
if(!ismachinery(src))
STOP_PROCESSING(SSobj, src) // TODO: Have a processing bitflag to reduce on unnecessary loops through the processing lists
SStgui.close_uis(src)
. = ..()
/obj/proc/setAnchored(anchorvalue)
SEND_SIGNAL(src, COMSIG_OBJ_SETANCHORED, anchorvalue)
anchored = anchorvalue
/obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, messy_throw = TRUE)
. = ..()
if(obj_flags & FROZEN)
visible_message("<span class='danger'>[src] shatters into a million pieces!</span>")
qdel(src)
/obj/assume_air(datum/gas_mixture/giver)
if(loc)
return loc.assume_air(giver)
else
return null
/obj/remove_air(amount)
if(loc)
return loc.remove_air(amount)
else
return null
/obj/return_air()
if(loc)
return loc.return_air()
else
return null
/obj/proc/handle_internal_lifeform(mob/lifeform_inside_me, breath_request)
//Return: (NONSTANDARD)
// null if object handles breathing logic for lifeform
// datum/air_group to tell lifeform to process using that breath return
//DEFAULT: Take air from turf to give to have mob process
if(breath_request>0)
var/datum/gas_mixture/environment = return_air()
var/breath_percentage = BREATH_VOLUME / environment.return_volume()
return remove_air(environment.total_moles() * breath_percentage)
else
return null
/obj/proc/updateUsrDialog()
if((obj_flags & IN_USE) && !(obj_flags & USES_TGUI))
var/is_in_use = FALSE
var/list/nearby = viewers(1, src)
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = TRUE
ui_interact(M)
if(isAI(usr) || iscyborg(usr) || IsAdminGhost(usr))
if (!(usr in nearby))
if (usr.client && usr.machine==src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh.
is_in_use = TRUE
ui_interact(usr)
// check for TK users
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
if(!(usr in nearby))
if(usr.client && usr.machine==src)
if(H.dna.check_mutation(TK))
is_in_use = TRUE
ui_interact(usr)
if (is_in_use)
obj_flags |= IN_USE
else
obj_flags &= ~IN_USE
/obj/proc/updateDialog(update_viewers = TRUE,update_ais = TRUE)
// Check that people are actually using the machine. If not, don't update anymore.
if(obj_flags & IN_USE)
var/is_in_use = FALSE
if(update_viewers)
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
is_in_use = TRUE
src.interact(M)
var/ai_in_use = FALSE
if(update_ais)
ai_in_use = AutoUpdateAI(src)
if(update_viewers && update_ais) //State change is sure only if we check both
if(!ai_in_use && !is_in_use)
obj_flags &= ~IN_USE
/obj/attack_ghost(mob/user)
. = ..()
if(.)
return
ui_interact(user)
/obj/proc/container_resist(mob/living/user)
return
/obj/proc/update_icon()
return
/mob/proc/unset_machine()
if(machine)
machine.on_unset_machine(src)
machine = null
//called when the user unsets the machine.
/atom/movable/proc/on_unset_machine(mob/user)
return
/mob/proc/set_machine(obj/O)
if(src.machine)
unset_machine()
src.machine = O
if(istype(O))
O.obj_flags |= IN_USE
/obj/item/proc/updateSelfDialog()
var/mob/M = src.loc
if(istype(M) && M.client && M.machine == src)
src.attack_self(M)
/obj/proc/hide(h)
return
/obj/singularity_pull(S, current_size)
..()
if(!anchored || current_size >= STAGE_FIVE)
step_towards(src,S)
/obj/get_dumping_location(datum/component/storage/source,mob/user)
return get_turf(src)
/obj/proc/CanAStarPass()
. = !density
/obj/proc/check_uplink_validity()
return 1
/obj/proc/intercept_user_move(dir, mob, newLoc, oldLoc)
return
/obj/vv_get_dropdown()
. = ..()
.["Delete all of type"] = "?_src_=vars;[HrefToken()];delall=[REF(src)]"
.["Osay"] = "?_src_=vars;[HrefToken()];osay[REF(src)]"
.["Modify armor values"] = "?_src_=vars;[HrefToken()];modarmor=[REF(src)]"
/obj/examine(mob/user)
. = ..()
if(obj_flags & UNIQUE_RENAME)
. += "<span class='notice'>Use a pen on it to rename it or change its description.</span>"
if(unique_reskin && (!current_skin || always_reskinnable))
. += "<span class='notice'>Alt-click it to reskin it.</span>"
/obj/AltClick(mob/user)
. = ..()
if(unique_reskin && (!current_skin || always_reskinnable) && user.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
reskin_obj(user)
return TRUE
/obj/proc/reskin_obj(mob/M)
if(!LAZYLEN(unique_reskin))
return
var/dat = "<b>Reskin options for [name]:</b>\n"
for(var/V in unique_reskin)
var/output = icon2html(src, M, unique_reskin[V])
dat += "[V]: <span class='reallybig'>[output]</span>\n"
to_chat(M, dat)
var/choice = input(M, always_reskinnable ? "Choose the a reskin for [src]" : "Warning, you can only reskin [src] once!","Reskin Object") as null|anything in unique_reskin
if(QDELETED(src) || !choice || (current_skin && !always_reskinnable) || M.incapacitated() || !in_range(M,src) || !unique_reskin[choice] || unique_reskin[choice] == current_skin)
return
current_skin = choice
icon_state = unique_reskin[choice]
to_chat(M, "[src] is now skinned as '[choice]'.")
/obj
var/crit_fail = FALSE
animate_movement = 2
speech_span = SPAN_ROBOT
var/obj_flags = CAN_BE_HIT
var/set_obj_flags // ONLY FOR MAPPING: Sets flags from a string list, handled in Initialize. Usage: set_obj_flags = "EMAGGED;!CAN_BE_HIT" to set EMAGGED and clear CAN_BE_HIT.
var/damtype = BRUTE
var/force = 0
var/datum/armor/armor
var/obj_integrity //defaults to max_integrity
var/max_integrity = 500
var/integrity_failure = 0 //0 if we have no special broken behavior
var/resistance_flags = NONE // INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ON_FIRE | UNACIDABLE | ACID_PROOF
var/acid_level = 0 //how much acid is on that obj
var/persistence_replacement //have something WAY too amazing to live to the next round? Set a new path here. Overuse of this var will make me upset.
var/current_skin //the item reskin
var/list/unique_reskin //List of options to reskin.
var/always_reskinnable = FALSE
// Access levels, used in modules\jobs\access.dm
var/list/req_access
var/req_access_txt = "0"
var/list/req_one_access
var/req_one_access_txt = "0"
var/renamedByPlayer = FALSE //set when a player uses a pen on a renamable object
vis_flags = VIS_INHERIT_PLANE //when this be added to vis_contents of something it inherit something.plane, important for visualisation of obj in openspace.
/obj/vv_edit_var(vname, vval)
switch(vname)
if("anchored")
setAnchored(vval)
return TRUE
if("obj_flags")
if ((obj_flags & DANGEROUS_POSSESSION) && !(vval & DANGEROUS_POSSESSION))
return FALSE
if("control_object")
var/obj/O = vval
if(istype(O) && (O.obj_flags & DANGEROUS_POSSESSION))
return FALSE
return ..()
/obj/Initialize()
. = ..()
if (islist(armor))
armor = getArmor(arglist(armor))
else if (!armor)
armor = getArmor()
else if (!istype(armor, /datum/armor))
stack_trace("Invalid type [armor.type] found in .armor during /obj Initialize()")
if(obj_integrity == null)
obj_integrity = max_integrity
if (set_obj_flags)
var/flagslist = splittext(set_obj_flags,";")
var/list/string_to_objflag = GLOB.bitfields["obj_flags"]
for (var/flag in flagslist)
if(flag[1] == "!")
flag = copytext(flag, length(flag[1]) + 1) // Get all but the initial !
obj_flags &= ~string_to_objflag[flag]
else
obj_flags |= string_to_objflag[flag]
if((obj_flags & ON_BLUEPRINTS) && isturf(loc))
var/turf/T = loc
T.add_blueprints_preround(src)
/obj/Destroy(force=FALSE)
if(!ismachinery(src))
STOP_PROCESSING(SSobj, src) // TODO: Have a processing bitflag to reduce on unnecessary loops through the processing lists
SStgui.close_uis(src)
. = ..()
/obj/proc/setAnchored(anchorvalue)
SEND_SIGNAL(src, COMSIG_OBJ_SETANCHORED, anchorvalue)
anchored = anchorvalue
/obj/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, messy_throw = TRUE)
. = ..()
if(obj_flags & FROZEN)
visible_message("<span class='danger'>[src] shatters into a million pieces!</span>")
qdel(src)
/obj/assume_air(datum/gas_mixture/giver)
if(loc)
return loc.assume_air(giver)
else
return null
/obj/remove_air(amount)
if(loc)
return loc.remove_air(amount)
else
return null
/obj/return_air()
if(loc)
return loc.return_air()
else
return null
/obj/proc/handle_internal_lifeform(mob/lifeform_inside_me, breath_request)
//Return: (NONSTANDARD)
// null if object handles breathing logic for lifeform
// datum/air_group to tell lifeform to process using that breath return
//DEFAULT: Take air from turf to give to have mob process
if(breath_request>0)
var/datum/gas_mixture/environment = return_air()
var/breath_percentage = BREATH_VOLUME / environment.return_volume()
return remove_air(environment.total_moles() * breath_percentage)
else
return null
/obj/proc/updateUsrDialog()
if((obj_flags & IN_USE) && !(obj_flags & USES_TGUI))
var/is_in_use = FALSE
var/list/nearby = viewers(1, src)
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = TRUE
ui_interact(M)
if(isAI(usr) || iscyborg(usr) || IsAdminGhost(usr))
if (!(usr in nearby))
if (usr.client && usr.machine==src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh.
is_in_use = TRUE
ui_interact(usr)
// check for TK users
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
if(!(usr in nearby))
if(usr.client && usr.machine==src)
if(H.dna.check_mutation(TK))
is_in_use = TRUE
ui_interact(usr)
if (is_in_use)
obj_flags |= IN_USE
else
obj_flags &= ~IN_USE
/obj/proc/updateDialog(update_viewers = TRUE,update_ais = TRUE)
// Check that people are actually using the machine. If not, don't update anymore.
if(obj_flags & IN_USE)
var/is_in_use = FALSE
if(update_viewers)
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
is_in_use = TRUE
src.interact(M)
var/ai_in_use = FALSE
if(update_ais)
ai_in_use = AutoUpdateAI(src)
if(update_viewers && update_ais) //State change is sure only if we check both
if(!ai_in_use && !is_in_use)
obj_flags &= ~IN_USE
/obj/attack_ghost(mob/user)
. = ..()
if(.)
return
ui_interact(user)
/obj/proc/container_resist(mob/living/user)
return
/mob/proc/unset_machine()
if(machine)
machine.on_unset_machine(src)
machine = null
//called when the user unsets the machine.
/atom/movable/proc/on_unset_machine(mob/user)
return
/mob/proc/set_machine(obj/O)
if(src.machine)
unset_machine()
src.machine = O
if(istype(O))
O.obj_flags |= IN_USE
/obj/item/proc/updateSelfDialog()
var/mob/M = src.loc
if(istype(M) && M.client && M.machine == src)
src.attack_self(M)
/obj/proc/hide(h)
return
/obj/singularity_pull(S, current_size)
..()
if(!anchored || current_size >= STAGE_FIVE)
step_towards(src,S)
/obj/get_dumping_location(datum/component/storage/source,mob/user)
return get_turf(src)
/obj/proc/CanAStarPass()
. = !density
/obj/proc/check_uplink_validity()
return 1
/obj/proc/intercept_user_move(dir, mob, newLoc, oldLoc)
return
/obj/vv_get_dropdown()
. = ..()
.["Delete all of type"] = "?_src_=vars;[HrefToken()];delall=[REF(src)]"
.["Osay"] = "?_src_=vars;[HrefToken()];osay[REF(src)]"
.["Modify armor values"] = "?_src_=vars;[HrefToken()];modarmor=[REF(src)]"
/obj/examine(mob/user)
. = ..()
if(obj_flags & UNIQUE_RENAME)
. += "<span class='notice'>Use a pen on it to rename it or change its description.</span>"
if(unique_reskin && (!current_skin || always_reskinnable))
. += "<span class='notice'>Alt-click it to reskin it.</span>"
/obj/AltClick(mob/user)
. = ..()
if(unique_reskin && (!current_skin || always_reskinnable) && user.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
reskin_obj(user)
return TRUE
/obj/proc/reskin_obj(mob/M)
if(!LAZYLEN(unique_reskin))
return
var/dat = "<b>Reskin options for [name]:</b>\n"
for(var/V in unique_reskin)
var/output = icon2html(src, M, unique_reskin[V])
dat += "[V]: <span class='reallybig'>[output]</span>\n"
to_chat(M, dat)
var/choice = input(M, always_reskinnable ? "Choose the a reskin for [src]" : "Warning, you can only reskin [src] once!","Reskin Object") as null|anything in unique_reskin
if(QDELETED(src) || !choice || (current_skin && !always_reskinnable) || M.incapacitated() || !in_range(M,src) || !unique_reskin[choice] || unique_reskin[choice] == current_skin)
return
current_skin = choice
icon_state = unique_reskin[choice]
to_chat(M, "[src] is now skinned as '[choice]'.")
+3 -3
View File
@@ -40,11 +40,11 @@
last_process = world.time
to_chat(user, "<span class='notice'>The water feels warm and soothing as you touch it. The fountain immediately dries up shortly afterwards.</span>")
user.reagents.add_reagent(/datum/reagent/medicine/omnizine/godblood,20)
update_icons()
addtimer(CALLBACK(src, .proc/update_icons), time_between_uses)
update_icon()
addtimer(CALLBACK(src, /atom/.proc/update_icon), time_between_uses)
/obj/structure/healingfountain/proc/update_icons()
/obj/structure/healingfountain/update_icon()
if(last_process + time_between_uses > world.time)
icon_state = "fountain"
else
+1 -1
View File
@@ -71,7 +71,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
// basic doesn't initialize and this will cause issues
// no warning though because this can happen naturaly as a result of it being built on top of
path = /turf/open/space
if(!GLOB.use_preloader && path == type && !(flags & CHANGETURF_FORCEOP)) // Don't no-op if the map loader requires it to be reconstructed
if(!GLOB.use_preloader && path == type && !(flags & CHANGETURF_FORCEOP) && (baseturfs == new_baseturfs)) // Don't no-op if the map loader requires it to be reconstructed, or if this is a new set of baseturfs
return src
if(flags & CHANGETURF_SKIP)
return new path(src)
+2 -2
View File
@@ -103,9 +103,9 @@
/turf/open/floor/blob_act(obj/structure/blob/B)
return
/turf/open/floor/proc/update_icon()
/turf/open/floor/update_icon()
. = ..()
update_visuals()
return 1
/turf/open/floor/attack_paw(mob/user)
return attack_hand(user)
@@ -202,15 +202,20 @@
return 1
return 0
/turf/closed/wall/r_wall/proc/update_icon()
/turf/closed/wall/r_wall/update_icon()
. = ..()
if(d_state != INTACT)
smooth = SMOOTH_FALSE
clear_smooth_overlays()
icon_state = "r_wall-[d_state]"
else
smooth = SMOOTH_TRUE
queue_smooth_neighbors(src)
queue_smooth(src)
/turf/closed/wall/r_wall/update_icon_state()
if(d_state != INTACT)
icon_state = "r_wall-[d_state]"
else
icon_state = "r_wall"
/turf/closed/wall/r_wall/singularity_pull(S, current_size)
+5 -2
View File
@@ -103,10 +103,13 @@
for(var/atom/movable/AM in src)
throw_atom(AM)
/turf/open/space/transit/proc/update_icon()
icon_state = "speedspace_ns_[get_transit_state(src)]"
/turf/open/space/transit/update_icon()
. = ..()
transform = turn(matrix(), get_transit_angle(src))
/turf/open/space/transit/update_icon_state()
icon_state = "speedspace_ns_[get_transit_state(src)]"
/proc/get_transit_state(turf/T)
var/p = 9
. = 1