mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
212 lines
4.4 KiB
Plaintext
212 lines
4.4 KiB
Plaintext
#define CONTROL_POD_DOORS 0
|
|
#define CONTROL_NORMAL_DOORS 1
|
|
#define CONTROL_EMITTERS 2
|
|
|
|
/obj/machinery/button/remote
|
|
name = "remote object control"
|
|
desc = "It controls objects, remotely."
|
|
icon = 'icons/obj/stationobjs.dmi'
|
|
icon_state = "doorctrl0"
|
|
power_channel = ENVIRON
|
|
var/desiredstate = 0
|
|
var/exposedwires = 0
|
|
var/wires = 3
|
|
/*
|
|
Bitflag, 1=checkID
|
|
2=Network Access
|
|
*/
|
|
|
|
anchored = 1.0
|
|
use_power = 1
|
|
idle_power_usage = 2
|
|
active_power_usage = 4
|
|
|
|
/obj/machinery/button/remote/attack_ai(mob/user as mob)
|
|
if(wires & 2)
|
|
return src.attack_hand(user)
|
|
else
|
|
user << "Error, no route to host."
|
|
|
|
/obj/machinery/button/remote/attackby(obj/item/weapon/W, mob/user as mob)
|
|
/* For later implementation
|
|
if (istype(W, /obj/item/weapon/screwdriver))
|
|
{
|
|
if(wiresexposed)
|
|
icon_state = "doorctrl0"
|
|
wiresexposed = 0
|
|
|
|
else
|
|
icon_state = "doorctrl-open"
|
|
wiresexposed = 1
|
|
|
|
return
|
|
}
|
|
*/
|
|
if(istype(W, /obj/item/device/detective_scanner))
|
|
return
|
|
if(istype(W, /obj/item/weapon/card/emag))
|
|
req_access = list()
|
|
req_one_access = list()
|
|
playsound(src.loc, "sparks", 100, 1)
|
|
return src.attack_hand(user)
|
|
|
|
/obj/machinery/button/remote/attack_hand(mob/user as mob)
|
|
if(..())
|
|
return
|
|
|
|
src.add_fingerprint(user)
|
|
if(stat & (NOPOWER|BROKEN))
|
|
return
|
|
|
|
if(!allowed(user) && (wires & 1))
|
|
user << "<span class='warning'>Access Denied</span>"
|
|
flick("doorctrl-denied",src)
|
|
return
|
|
|
|
use_power(5)
|
|
icon_state = "doorctrl1"
|
|
trigger()
|
|
desiredstate = !desiredstate
|
|
spawn(15)
|
|
update_icon()
|
|
|
|
/obj/machinery/button/remote/proc/trigger()
|
|
return
|
|
|
|
/obj/machinery/button/remote/power_change()
|
|
..()
|
|
update_icon()
|
|
|
|
/obj/machinery/button/remote/update_icon()
|
|
if(stat & NOPOWER)
|
|
icon_state = "doorctrl-p"
|
|
else
|
|
icon_state = "doorctrl0"
|
|
|
|
/*
|
|
Airlock remote control
|
|
*/
|
|
/obj/machinery/button/remote/airlock
|
|
name = "remote door-control"
|
|
desc = "It controls doors, remotely."
|
|
|
|
var/specialfunctions = 1
|
|
/*
|
|
Bitflag, 1= open
|
|
2= idscan,
|
|
4= bolts
|
|
8= shock
|
|
16= door safties
|
|
*/
|
|
|
|
/obj/machinery/button/remote/airlock/trigger()
|
|
for(var/obj/machinery/door/airlock/D in world)
|
|
if(D.id_tag == src.id)
|
|
if(specialfunctions & OPEN)
|
|
if (D.density)
|
|
spawn(0)
|
|
D.open()
|
|
return
|
|
else
|
|
spawn(0)
|
|
D.close()
|
|
return
|
|
if(desiredstate == 1)
|
|
if(specialfunctions & IDSCAN)
|
|
D.set_idscan(0)
|
|
if(specialfunctions & BOLTS)
|
|
D.lock()
|
|
if(specialfunctions & SHOCK)
|
|
D.electrify(-1)
|
|
if(specialfunctions & SAFE)
|
|
D.set_safeties(0)
|
|
else
|
|
if(specialfunctions & IDSCAN)
|
|
D.set_idscan(1)
|
|
if(specialfunctions & BOLTS)
|
|
D.unlock()
|
|
if(specialfunctions & SHOCK)
|
|
D.electrify(0)
|
|
if(specialfunctions & SAFE)
|
|
D.set_safeties(1)
|
|
|
|
/*
|
|
Blast door remote control
|
|
*/
|
|
/obj/machinery/button/remote/blast_door
|
|
name = "remote blast door-control"
|
|
desc = "It controls blast doors, remotely."
|
|
|
|
/obj/machinery/button/remote/blast_door/trigger()
|
|
for(var/obj/machinery/door/blast/M in world)
|
|
if(M.id == src.id)
|
|
if(M.density)
|
|
spawn(0)
|
|
M.open()
|
|
return
|
|
else
|
|
spawn(0)
|
|
M.close()
|
|
return
|
|
|
|
/*
|
|
Emitter remote control
|
|
*/
|
|
/obj/machinery/button/remote/emitter
|
|
name = "remote emitter control"
|
|
desc = "It controls emitters, remotely."
|
|
|
|
/obj/machinery/button/remote/emitter/trigger(mob/user as mob)
|
|
for(var/obj/machinery/power/emitter/E in world)
|
|
if(E.id == src.id)
|
|
spawn(0)
|
|
E.activate(user)
|
|
return
|
|
|
|
/*
|
|
Mass driver remote control
|
|
*/
|
|
/obj/machinery/button/remote/driver
|
|
name = "mass driver button"
|
|
desc = "A remote control switch for a mass driver."
|
|
icon = 'icons/obj/objects.dmi'
|
|
icon_state = "launcherbtt"
|
|
|
|
/obj/machinery/button/remote/driver/trigger(mob/user as mob)
|
|
if(..())
|
|
return
|
|
|
|
active = 1
|
|
update_icon()
|
|
|
|
for(var/obj/machinery/door/blast/M in machines)
|
|
if (M.id == src.id)
|
|
spawn( 0 )
|
|
M.open()
|
|
return
|
|
|
|
sleep(20)
|
|
|
|
for(var/obj/machinery/mass_driver/M in machines)
|
|
if(M.id == src.id)
|
|
M.drive()
|
|
|
|
sleep(50)
|
|
|
|
for(var/obj/machinery/door/blast/M in machines)
|
|
if (M.id == src.id)
|
|
spawn(0)
|
|
M.close()
|
|
return
|
|
|
|
icon_state = "launcherbtt"
|
|
update_icon()
|
|
|
|
return
|
|
|
|
/obj/machinery/button/remote/driver/update_icon()
|
|
if(!active || (stat & NOPOWER))
|
|
icon_state = "launcherbtt"
|
|
else
|
|
icon_state = "launcheract"
|