Files
CHOMPStation2/code/modules/assembly/assembly.dm
Kelenius 35a20002c6 Merge branch 'dev' into ofResearchAndPrototypes
Conflicts:
	baystation12.dme
	code/defines/obj/weapon.dm
	code/game/mecha/equipment/tools/medical_tools.dm
	code/game/mecha/equipment/tools/tools.dm
	code/game/mecha/mecha.dm
	code/game/mecha/mecha_parts.dm
	code/game/objects/items/devices/flash.dm
	code/game/objects/items/devices/powersink.dm
	code/game/objects/items/devices/scanners.dm
	code/game/objects/items/stacks/sheets/glass.dm
	code/game/objects/items/stacks/sheets/sheet_types.dm
	code/game/objects/items/weapons/RCD.dm
	code/game/objects/items/weapons/circuitboards/machinery/biogenerator.dm
	code/game/objects/items/weapons/circuitboards/machinery/cloning.dm
	code/game/objects/items/weapons/circuitboards/machinery/mining_drill.dm
	code/game/objects/items/weapons/circuitboards/machinery/pacman.dm
	code/game/objects/items/weapons/circuitboards/machinery/power.dm
	code/game/objects/items/weapons/circuitboards/machinery/recharge_station.dm
	code/game/objects/items/weapons/circuitboards/machinery/research.dm
	code/game/objects/items/weapons/circuitboards/machinery/shieldgen.dm
	code/game/objects/items/weapons/circuitboards/machinery/telecomms.dm
	code/game/objects/items/weapons/circuitboards/machinery/unary_atmos.dm
	code/game/objects/items/weapons/flamethrower.dm
	code/game/objects/items/weapons/handcuffs.dm
	code/game/objects/items/weapons/kitchen.dm
	code/game/objects/items/weapons/shields.dm
	code/game/objects/items/weapons/storage/backpack.dm
	code/game/objects/items/weapons/surgery_tools.dm
	code/game/objects/items/weapons/teleportation.dm
	code/game/objects/items/weapons/tools.dm
	code/modules/assembly/igniter.dm
	code/modules/assembly/infrared.dm
	code/modules/assembly/mousetrap.dm
	code/modules/assembly/proximity.dm
	code/modules/assembly/signaler.dm
	code/modules/assembly/timer.dm
	code/modules/assembly/voice.dm
	code/modules/clothing/glasses/glasses.dm
	code/modules/hydroponics/trays/tray_tools.dm
	code/modules/mining/drilling/scanner.dm
	code/modules/mining/mine_items.dm
	code/modules/mining/ore.dm
	code/modules/mob/living/silicon/robot/analyzer.dm
	code/modules/power/rust/circuits_and_design.dm
	code/modules/projectiles/ammunition/boxes.dm
	code/modules/projectiles/guns/energy/laser.dm
	code/modules/projectiles/guns/energy/special.dm
	code/modules/projectiles/guns/energy/stun.dm
	code/modules/research/circuitprinter.dm
	code/modules/research/designs.dm
	code/modules/research/destructive_analyzer.dm
	code/modules/research/protolathe.dm
	code/modules/research/rdconsole.dm
	code/modules/research/research.dm
	code/modules/research/server.dm
	code/modules/research/xenoarchaeology/genetics/reconstitutor.dm
2015-05-20 11:50:28 +03:00

177 lines
4.4 KiB
Plaintext

/obj/item/device/assembly
name = "assembly"
desc = "A small electronic device that should never exist."
icon = 'icons/obj/assemblies/new_assemblies.dmi'
icon_state = ""
flags = CONDUCT
w_class = 2.0
matter = list(DEFAULT_WALL_MATERIAL = 100)
throwforce = 2
throw_speed = 3
throw_range = 10
origin_tech = list(TECH_MAGNET = 1)
var/secured = 1
var/list/attached_overlays = null
var/obj/item/device/assembly_holder/holder = null
var/cooldown = 0//To prevent spam
var/wires = WIRE_RECEIVE | WIRE_PULSE
var/const/WIRE_RECEIVE = 1 //Allows Pulsed(0) to call Activate()
var/const/WIRE_PULSE = 2 //Allows Pulse(0) to act on the holder
var/const/WIRE_PULSE_SPECIAL = 4 //Allows Pulse(0) to act on the holders special assembly
var/const/WIRE_RADIO_RECEIVE = 8 //Allows Pulsed(1) to call Activate()
var/const/WIRE_RADIO_PULSE = 16 //Allows Pulse(1) to send a radio message
proc/activate() //What the device does when turned on
return
proc/pulsed(var/radio = 0) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
return
proc/pulse(var/radio = 0) //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
return
proc/toggle_secure() //Code that has to happen when the assembly is un\secured goes here
return
proc/attach_assembly(var/obj/A, var/mob/user) //Called when an assembly is attacked by another
return
proc/process_cooldown() //Called via spawn(10) to have it count down the cooldown var
return
proc/holder_movement() //Called when the holder is moved
return
interact(mob/user as mob) //Called when attack_self is called
return
process_cooldown()
cooldown--
if(cooldown <= 0) return 0
spawn(10)
process_cooldown()
return 1
pulsed(var/radio = 0)
if(holder && (wires & WIRE_RECEIVE))
activate()
if(radio && (wires & WIRE_RADIO_RECEIVE))
activate()
return 1
pulse(var/radio = 0)
if(holder && (wires & WIRE_PULSE))
holder.process_activation(src, 1, 0)
if(holder && (wires & WIRE_PULSE_SPECIAL))
holder.process_activation(src, 0, 1)
// if(radio && (wires & WIRE_RADIO_PULSE))
//Not sure what goes here quite yet send signal?
return 1
activate()
if(!secured || (cooldown > 0)) return 0
cooldown = 2
spawn(10)
process_cooldown()
return 1
toggle_secure()
secured = !secured
update_icon()
return secured
attach_assembly(var/obj/item/device/assembly/A, var/mob/user)
holder = new/obj/item/device/assembly_holder(get_turf(src))
if(holder.attach(A,src,user))
user << "\blue You attach \the [A] to \the [src]!"
return 1
return 0
attackby(obj/item/weapon/W as obj, mob/user as mob)
if(isassembly(W))
var/obj/item/device/assembly/A = W
if((!A.secured) && (!secured))
attach_assembly(A,user)
return
if(isscrewdriver(W))
if(toggle_secure())
user << "\blue \The [src] is ready!"
else
user << "\blue \The [src] can now be attached!"
return
..()
return
process()
processing_objects.Remove(src)
return
examine(mob/user)
..(user)
if((in_range(src, user) || loc == user))
if(secured)
user << "\The [src] is ready!"
else
user << "\The [src] can be attached!"
return
attack_self(mob/user as mob)
if(!user) return 0
user.set_machine(src)
interact(user)
return 1
interact(mob/user as mob)
return //HTML MENU FOR WIRES GOES HERE
/*
var/small_icon_state = null//If this obj will go inside the assembly use this for icons
var/list/small_icon_state_overlays = null//Same here
var/obj/holder = null
var/cooldown = 0//To prevent spam
proc
Activate()//Called when this assembly is pulsed by another one
Process_cooldown()//Call this via spawn(10) to have it count down the cooldown var
Attach_Holder(var/obj/H, var/mob/user)//Called when an assembly holder attempts to attach, sets src's loc in here
Activate()
if(cooldown > 0)
return 0
cooldown = 2
spawn(10)
Process_cooldown()
//Rest of code here
return 0
Process_cooldown()
cooldown--
if(cooldown <= 0) return 0
spawn(10)
Process_cooldown()
return 1
Attach_Holder(var/obj/H, var/mob/user)
if(!H) return 0
if(!H.IsAssemblyHolder()) return 0
//Remember to have it set its loc somewhere in here
*/