mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
File standardisation (#13131)
* Adds the check components * Adds in trailing newlines * Converts all CRLF to LF * Post merge EOF * Post merge line endings * Final commit
This commit is contained in:
+150
-150
@@ -1,150 +1,150 @@
|
||||
/obj/item/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 = WEIGHT_CLASS_SMALL
|
||||
materials = list(MAT_METAL = 100)
|
||||
throwforce = 2
|
||||
throw_speed = 3
|
||||
throw_range = 10
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
toolspeed = 1
|
||||
usesound = 'sound/items/deconstruct.ogg'
|
||||
|
||||
var/bomb_name = "bomb" // used for naming bombs / mines
|
||||
|
||||
var/secured = TRUE
|
||||
var/list/attached_overlays = null
|
||||
var/obj/item/assembly_holder/holder = null
|
||||
var/cooldown = FALSE //To prevent spam
|
||||
var/wires = WIRE_RECEIVE | WIRE_PULSE
|
||||
var/datum/wires/connected = null // currently only used by timer/signaler
|
||||
|
||||
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
|
||||
|
||||
/obj/item/assembly/proc/activate() //What the device does when turned on
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/pulsed(radio = FALSE) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/pulse(radio = FALSE) //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/toggle_secure() //Code that has to happen when the assembly is un\secured goes here
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/attach_assembly(obj/A, mob/user) //Called when an assembly is attacked by another
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/process_cooldown() //Called via spawn(10) to have it count down the cooldown var
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/holder_movement() //Called when the holder is moved
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/describe() // Called by grenades to describe the state of the trigger (time left, etc)
|
||||
return "The trigger assembly looks broken!"
|
||||
|
||||
/obj/item/assembly/interact(mob/user) //Called when attack_self is called
|
||||
return
|
||||
|
||||
/obj/item/assembly/process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0)
|
||||
return FALSE
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/Destroy()
|
||||
if(istype(loc, /obj/item/assembly_holder) || istype(holder))
|
||||
var/obj/item/assembly_holder/A = loc
|
||||
if(A.a_left == src)
|
||||
A.a_left = null
|
||||
else if(A.a_right == src)
|
||||
A.a_right = null
|
||||
holder = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/pulsed(radio = FALSE)
|
||||
if(holder && (wires & WIRE_RECEIVE))
|
||||
activate()
|
||||
if(radio && (wires & WIRE_RADIO_RECEIVE))
|
||||
activate()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/pulse(radio = FALSE)
|
||||
if(holder && (wires & WIRE_PULSE))
|
||||
holder.process_activation(src, 1, 0)
|
||||
if(holder && (wires & WIRE_PULSE_SPECIAL))
|
||||
holder.process_activation(src, 0, 1)
|
||||
if(istype(loc, /obj/item/grenade)) // This is a hack. Todo: Manage this better -Sayu
|
||||
var/obj/item/grenade/G = loc
|
||||
G.prime() // Adios, muchachos
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/activate()
|
||||
if(!secured || cooldown > 0)
|
||||
return FALSE
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/attach_assembly(obj/item/assembly/A, mob/user)
|
||||
holder = new /obj/item/assembly_holder(get_turf(src))
|
||||
if(holder.attach(A, src, user))
|
||||
to_chat(user, "<span class='notice'>You attach [A] to [src]!</span>")
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/attackby(obj/item/W, mob/user, params)
|
||||
if(isassembly(W))
|
||||
var/obj/item/assembly/A = W
|
||||
if(!A.secured && !secured)
|
||||
attach_assembly(A, user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/screwdriver_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
if(toggle_secure())
|
||||
to_chat(user, "<span class='notice'>[src] is ready!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] can now be attached!</span>")
|
||||
|
||||
/obj/item/assembly/process()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/examine(mob/user)
|
||||
. = ..()
|
||||
if(in_range(src, user) || loc == user)
|
||||
if(secured)
|
||||
. += "[src] is ready!"
|
||||
else
|
||||
. += "[src] can be attached!"
|
||||
|
||||
/obj/item/assembly/attack_self(mob/user)
|
||||
if(!user)
|
||||
return
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/interact(mob/user)
|
||||
return
|
||||
/obj/item/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 = WEIGHT_CLASS_SMALL
|
||||
materials = list(MAT_METAL = 100)
|
||||
throwforce = 2
|
||||
throw_speed = 3
|
||||
throw_range = 10
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
toolspeed = 1
|
||||
usesound = 'sound/items/deconstruct.ogg'
|
||||
|
||||
var/bomb_name = "bomb" // used for naming bombs / mines
|
||||
|
||||
var/secured = TRUE
|
||||
var/list/attached_overlays = null
|
||||
var/obj/item/assembly_holder/holder = null
|
||||
var/cooldown = FALSE //To prevent spam
|
||||
var/wires = WIRE_RECEIVE | WIRE_PULSE
|
||||
var/datum/wires/connected = null // currently only used by timer/signaler
|
||||
|
||||
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
|
||||
|
||||
/obj/item/assembly/proc/activate() //What the device does when turned on
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/pulsed(radio = FALSE) //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/pulse(radio = FALSE) //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/toggle_secure() //Code that has to happen when the assembly is un\secured goes here
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/attach_assembly(obj/A, mob/user) //Called when an assembly is attacked by another
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/process_cooldown() //Called via spawn(10) to have it count down the cooldown var
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/holder_movement() //Called when the holder is moved
|
||||
return
|
||||
|
||||
/obj/item/assembly/proc/describe() // Called by grenades to describe the state of the trigger (time left, etc)
|
||||
return "The trigger assembly looks broken!"
|
||||
|
||||
/obj/item/assembly/interact(mob/user) //Called when attack_self is called
|
||||
return
|
||||
|
||||
/obj/item/assembly/process_cooldown()
|
||||
cooldown--
|
||||
if(cooldown <= 0)
|
||||
return FALSE
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/Destroy()
|
||||
if(istype(loc, /obj/item/assembly_holder) || istype(holder))
|
||||
var/obj/item/assembly_holder/A = loc
|
||||
if(A.a_left == src)
|
||||
A.a_left = null
|
||||
else if(A.a_right == src)
|
||||
A.a_right = null
|
||||
holder = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/pulsed(radio = FALSE)
|
||||
if(holder && (wires & WIRE_RECEIVE))
|
||||
activate()
|
||||
if(radio && (wires & WIRE_RADIO_RECEIVE))
|
||||
activate()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/pulse(radio = FALSE)
|
||||
if(holder && (wires & WIRE_PULSE))
|
||||
holder.process_activation(src, 1, 0)
|
||||
if(holder && (wires & WIRE_PULSE_SPECIAL))
|
||||
holder.process_activation(src, 0, 1)
|
||||
if(istype(loc, /obj/item/grenade)) // This is a hack. Todo: Manage this better -Sayu
|
||||
var/obj/item/grenade/G = loc
|
||||
G.prime() // Adios, muchachos
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/activate()
|
||||
if(!secured || cooldown > 0)
|
||||
return FALSE
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/attach_assembly(obj/item/assembly/A, mob/user)
|
||||
holder = new /obj/item/assembly_holder(get_turf(src))
|
||||
if(holder.attach(A, src, user))
|
||||
to_chat(user, "<span class='notice'>You attach [A] to [src]!</span>")
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/attackby(obj/item/W, mob/user, params)
|
||||
if(isassembly(W))
|
||||
var/obj/item/assembly/A = W
|
||||
if(!A.secured && !secured)
|
||||
attach_assembly(A, user)
|
||||
return
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/screwdriver_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
if(toggle_secure())
|
||||
to_chat(user, "<span class='notice'>[src] is ready!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] can now be attached!</span>")
|
||||
|
||||
/obj/item/assembly/process()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/examine(mob/user)
|
||||
. = ..()
|
||||
if(in_range(src, user) || loc == user)
|
||||
if(secured)
|
||||
. += "[src] is ready!"
|
||||
else
|
||||
. += "[src] can be attached!"
|
||||
|
||||
/obj/item/assembly/attack_self(mob/user)
|
||||
if(!user)
|
||||
return
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/interact(mob/user)
|
||||
return
|
||||
|
||||
+180
-180
@@ -1,180 +1,180 @@
|
||||
/obj/item/onetankbomb
|
||||
name = "bomb"
|
||||
icon = 'icons/obj/tank.dmi'
|
||||
item_state = "assembly"
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
throw_speed = 2
|
||||
throw_range = 4
|
||||
flags = CONDUCT //Copied this from old code, so this may or may not be necessary
|
||||
var/status = 0 //0 - not readied //1 - bomb finished with welder
|
||||
var/obj/item/assembly_holder/bombassembly = null //The first part of the bomb is an assembly holder, holding an igniter+some device
|
||||
var/obj/item/tank/bombtank = null //the second part of the bomb is a plasma tank
|
||||
origin_tech = "materials=1;engineering=1"
|
||||
|
||||
/obj/item/onetankbomb/examine(mob/user)
|
||||
. = ..()
|
||||
. += bombtank.examine(user)
|
||||
|
||||
/obj/item/onetankbomb/update_icon()
|
||||
if(bombtank)
|
||||
icon_state = bombtank.icon_state
|
||||
if(bombassembly)
|
||||
overlays += bombassembly.icon_state
|
||||
overlays += bombassembly.overlays
|
||||
overlays += "bomb_assembly"
|
||||
|
||||
/obj/item/onetankbomb/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/analyzer))
|
||||
bombtank.attackby(W, user, params)
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/onetankbomb/wrench_act(mob/user, obj/item/I) //This is basically bomb assembly code inverted. apparently it works.
|
||||
if(status)
|
||||
return
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You disassemble [src].</span>")
|
||||
bombassembly.loc = user.loc
|
||||
bombassembly.master = null
|
||||
bombassembly = null
|
||||
bombtank.loc = user.loc
|
||||
bombtank.master = null
|
||||
bombtank = null
|
||||
qdel(src)
|
||||
|
||||
/obj/item/onetankbomb/welder_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, volume = I.tool_volume))
|
||||
return
|
||||
if(!status)
|
||||
status = TRUE
|
||||
investigate_log("[key_name(user)] welded a single tank bomb. Temperature: [bombtank.air_contents.temperature-T0C]", INVESTIGATE_BOMB)
|
||||
msg_admin_attack("[key_name_admin(user)] welded a single tank bomb. Temperature: [bombtank.air_contents.temperature-T0C]", ATKLOG_FEW)
|
||||
log_game("[key_name(user)] welded a single tank bomb. Temperature: [bombtank.air_contents.temperature - T0C]")
|
||||
to_chat(user, "<span class='notice'>A pressure hole has been bored to [bombtank] valve. [bombtank] can now be ignited.</span>")
|
||||
else
|
||||
status = FALSE
|
||||
investigate_log("[key_name(user)] unwelded a single tank bomb. Temperature: [bombtank.air_contents.temperature-T0C]", INVESTIGATE_BOMB)
|
||||
to_chat(user, "<span class='notice'>The hole has been closed.</span>")
|
||||
|
||||
|
||||
/obj/item/onetankbomb/attack_self(mob/user) //pressing the bomb accesses its assembly
|
||||
bombassembly.attack_self(user, 1)
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/onetankbomb/receive_signal() //This is mainly called by the sensor through sense() to the holder, and from the holder to here.
|
||||
visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*")
|
||||
sleep(10)
|
||||
if(!src)
|
||||
return
|
||||
if(status)
|
||||
bombtank.detonate() //if its not a dud, boom (or not boom if you made shitty mix) the ignite proc is below, in this file
|
||||
else
|
||||
bombtank.release()
|
||||
|
||||
/obj/item/onetankbomb/HasProximity(atom/movable/AM)
|
||||
if(bombassembly)
|
||||
bombassembly.HasProximity(AM)
|
||||
|
||||
/obj/item/onetankbomb/Crossed(atom/movable/AM, oldloc) //for mousetraps
|
||||
if(bombassembly)
|
||||
bombassembly.Crossed(AM, oldloc)
|
||||
|
||||
/obj/item/onetankbomb/on_found(mob/finder) //for mousetraps
|
||||
if(bombassembly)
|
||||
bombassembly.on_found(finder)
|
||||
|
||||
/obj/item/onetankbomb/hear_talk(mob/living/M, list/message_pieces)
|
||||
if(bombassembly)
|
||||
bombassembly.hear_talk(M, message_pieces)
|
||||
|
||||
/obj/item/onetankbomb/hear_message(mob/living/M, msg)
|
||||
if(bombassembly)
|
||||
bombassembly.hear_message(M, msg)
|
||||
|
||||
// ---------- Procs below are for tanks that are used exclusively in 1-tank bombs ----------
|
||||
|
||||
/obj/item/tank/proc/bomb_assemble(W,user) //Bomb assembly proc. This turns assembly+tank into a bomb
|
||||
var/obj/item/assembly_holder/S = W
|
||||
var/mob/M = user
|
||||
if(!S.secured) //Check if the assembly is secured
|
||||
return
|
||||
if(isigniter(S.a_left) == isigniter(S.a_right)) //Check if either part of the assembly has an igniter, but if both parts are igniters, then fuck it
|
||||
return
|
||||
|
||||
var/obj/item/onetankbomb/R = new /obj/item/onetankbomb(loc)
|
||||
|
||||
M.drop_item() //Remove the assembly from your hands
|
||||
M.remove_from_mob(src) //Remove the tank from your character,in case you were holding it
|
||||
M.put_in_hands(R) //Equips the bomb if possible, or puts it on the floor.
|
||||
|
||||
R.bombassembly = S //Tell the bomb about its assembly part
|
||||
S.master = R //Tell the assembly about its new owner
|
||||
S.loc = R //Move the assembly out of the fucking way
|
||||
|
||||
R.bombtank = src //Same for tank
|
||||
master = R
|
||||
loc = R
|
||||
R.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/tank/proc/detonate() //This happens when a bomb is told to explode
|
||||
var/fuel_moles = air_contents.toxins + air_contents.oxygen/6
|
||||
var/strength = 1
|
||||
|
||||
var/turf/ground_zero = get_turf(loc)
|
||||
loc = null
|
||||
|
||||
if(air_contents.temperature > (T0C + 400))
|
||||
strength = (fuel_moles/15)
|
||||
|
||||
if(strength >=1)
|
||||
explosion(ground_zero, round(strength,1), round(strength*2,1), round(strength*3,1), round(strength*4,1))
|
||||
else if(strength >=0.5)
|
||||
explosion(ground_zero, 0, 1, 2, 4)
|
||||
else if(strength >=0.2)
|
||||
explosion(ground_zero, -1, 0, 1, 2)
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(air_contents.temperature > (T0C + 250))
|
||||
strength = (fuel_moles/20)
|
||||
|
||||
if(strength >=1)
|
||||
explosion(ground_zero, 0, round(strength,1), round(strength*2,1), round(strength*3,1))
|
||||
else if(strength >=0.5)
|
||||
explosion(ground_zero, -1, 0, 1, 2)
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(air_contents.temperature > (T0C + 100))
|
||||
strength = (fuel_moles/25)
|
||||
|
||||
if(strength >=1)
|
||||
explosion(ground_zero, -1, 0, round(strength,1), round(strength*3,1))
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
air_update_turf()
|
||||
if(master)
|
||||
qdel(master)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out.
|
||||
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles())
|
||||
var/turf/simulated/T = get_turf(src)
|
||||
if(!T)
|
||||
return
|
||||
T.assume_air(removed)
|
||||
air_update_turf()
|
||||
/obj/item/onetankbomb
|
||||
name = "bomb"
|
||||
icon = 'icons/obj/tank.dmi'
|
||||
item_state = "assembly"
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
throw_speed = 2
|
||||
throw_range = 4
|
||||
flags = CONDUCT //Copied this from old code, so this may or may not be necessary
|
||||
var/status = 0 //0 - not readied //1 - bomb finished with welder
|
||||
var/obj/item/assembly_holder/bombassembly = null //The first part of the bomb is an assembly holder, holding an igniter+some device
|
||||
var/obj/item/tank/bombtank = null //the second part of the bomb is a plasma tank
|
||||
origin_tech = "materials=1;engineering=1"
|
||||
|
||||
/obj/item/onetankbomb/examine(mob/user)
|
||||
. = ..()
|
||||
. += bombtank.examine(user)
|
||||
|
||||
/obj/item/onetankbomb/update_icon()
|
||||
if(bombtank)
|
||||
icon_state = bombtank.icon_state
|
||||
if(bombassembly)
|
||||
overlays += bombassembly.icon_state
|
||||
overlays += bombassembly.overlays
|
||||
overlays += "bomb_assembly"
|
||||
|
||||
/obj/item/onetankbomb/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/analyzer))
|
||||
bombtank.attackby(W, user, params)
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/item/onetankbomb/wrench_act(mob/user, obj/item/I) //This is basically bomb assembly code inverted. apparently it works.
|
||||
if(status)
|
||||
return
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You disassemble [src].</span>")
|
||||
bombassembly.loc = user.loc
|
||||
bombassembly.master = null
|
||||
bombassembly = null
|
||||
bombtank.loc = user.loc
|
||||
bombtank.master = null
|
||||
bombtank = null
|
||||
qdel(src)
|
||||
|
||||
/obj/item/onetankbomb/welder_act(mob/user, obj/item/I)
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, volume = I.tool_volume))
|
||||
return
|
||||
if(!status)
|
||||
status = TRUE
|
||||
investigate_log("[key_name(user)] welded a single tank bomb. Temperature: [bombtank.air_contents.temperature-T0C]", INVESTIGATE_BOMB)
|
||||
msg_admin_attack("[key_name_admin(user)] welded a single tank bomb. Temperature: [bombtank.air_contents.temperature-T0C]", ATKLOG_FEW)
|
||||
log_game("[key_name(user)] welded a single tank bomb. Temperature: [bombtank.air_contents.temperature - T0C]")
|
||||
to_chat(user, "<span class='notice'>A pressure hole has been bored to [bombtank] valve. [bombtank] can now be ignited.</span>")
|
||||
else
|
||||
status = FALSE
|
||||
investigate_log("[key_name(user)] unwelded a single tank bomb. Temperature: [bombtank.air_contents.temperature-T0C]", INVESTIGATE_BOMB)
|
||||
to_chat(user, "<span class='notice'>The hole has been closed.</span>")
|
||||
|
||||
|
||||
/obj/item/onetankbomb/attack_self(mob/user) //pressing the bomb accesses its assembly
|
||||
bombassembly.attack_self(user, 1)
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/onetankbomb/receive_signal() //This is mainly called by the sensor through sense() to the holder, and from the holder to here.
|
||||
visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*")
|
||||
sleep(10)
|
||||
if(!src)
|
||||
return
|
||||
if(status)
|
||||
bombtank.detonate() //if its not a dud, boom (or not boom if you made shitty mix) the ignite proc is below, in this file
|
||||
else
|
||||
bombtank.release()
|
||||
|
||||
/obj/item/onetankbomb/HasProximity(atom/movable/AM)
|
||||
if(bombassembly)
|
||||
bombassembly.HasProximity(AM)
|
||||
|
||||
/obj/item/onetankbomb/Crossed(atom/movable/AM, oldloc) //for mousetraps
|
||||
if(bombassembly)
|
||||
bombassembly.Crossed(AM, oldloc)
|
||||
|
||||
/obj/item/onetankbomb/on_found(mob/finder) //for mousetraps
|
||||
if(bombassembly)
|
||||
bombassembly.on_found(finder)
|
||||
|
||||
/obj/item/onetankbomb/hear_talk(mob/living/M, list/message_pieces)
|
||||
if(bombassembly)
|
||||
bombassembly.hear_talk(M, message_pieces)
|
||||
|
||||
/obj/item/onetankbomb/hear_message(mob/living/M, msg)
|
||||
if(bombassembly)
|
||||
bombassembly.hear_message(M, msg)
|
||||
|
||||
// ---------- Procs below are for tanks that are used exclusively in 1-tank bombs ----------
|
||||
|
||||
/obj/item/tank/proc/bomb_assemble(W,user) //Bomb assembly proc. This turns assembly+tank into a bomb
|
||||
var/obj/item/assembly_holder/S = W
|
||||
var/mob/M = user
|
||||
if(!S.secured) //Check if the assembly is secured
|
||||
return
|
||||
if(isigniter(S.a_left) == isigniter(S.a_right)) //Check if either part of the assembly has an igniter, but if both parts are igniters, then fuck it
|
||||
return
|
||||
|
||||
var/obj/item/onetankbomb/R = new /obj/item/onetankbomb(loc)
|
||||
|
||||
M.drop_item() //Remove the assembly from your hands
|
||||
M.remove_from_mob(src) //Remove the tank from your character,in case you were holding it
|
||||
M.put_in_hands(R) //Equips the bomb if possible, or puts it on the floor.
|
||||
|
||||
R.bombassembly = S //Tell the bomb about its assembly part
|
||||
S.master = R //Tell the assembly about its new owner
|
||||
S.loc = R //Move the assembly out of the fucking way
|
||||
|
||||
R.bombtank = src //Same for tank
|
||||
master = R
|
||||
loc = R
|
||||
R.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/tank/proc/detonate() //This happens when a bomb is told to explode
|
||||
var/fuel_moles = air_contents.toxins + air_contents.oxygen/6
|
||||
var/strength = 1
|
||||
|
||||
var/turf/ground_zero = get_turf(loc)
|
||||
loc = null
|
||||
|
||||
if(air_contents.temperature > (T0C + 400))
|
||||
strength = (fuel_moles/15)
|
||||
|
||||
if(strength >=1)
|
||||
explosion(ground_zero, round(strength,1), round(strength*2,1), round(strength*3,1), round(strength*4,1))
|
||||
else if(strength >=0.5)
|
||||
explosion(ground_zero, 0, 1, 2, 4)
|
||||
else if(strength >=0.2)
|
||||
explosion(ground_zero, -1, 0, 1, 2)
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(air_contents.temperature > (T0C + 250))
|
||||
strength = (fuel_moles/20)
|
||||
|
||||
if(strength >=1)
|
||||
explosion(ground_zero, 0, round(strength,1), round(strength*2,1), round(strength*3,1))
|
||||
else if(strength >=0.5)
|
||||
explosion(ground_zero, -1, 0, 1, 2)
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(air_contents.temperature > (T0C + 100))
|
||||
strength = (fuel_moles/25)
|
||||
|
||||
if(strength >=1)
|
||||
explosion(ground_zero, -1, 0, round(strength,1), round(strength*3,1))
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else
|
||||
ground_zero.assume_air(air_contents)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
air_update_turf()
|
||||
if(master)
|
||||
qdel(master)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out.
|
||||
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles())
|
||||
var/turf/simulated/T = get_turf(src)
|
||||
if(!T)
|
||||
return
|
||||
T.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
@@ -104,4 +104,4 @@
|
||||
return
|
||||
|
||||
attack_self(user)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/proc/isassembly(O)
|
||||
if(istype(O, /obj/item/assembly))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isigniter(O)
|
||||
if(istype(O, /obj/item/assembly/igniter))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isinfared(O)
|
||||
if(istype(O, /obj/item/assembly/infra))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isprox(O)
|
||||
if(istype(O, /obj/item/assembly/prox_sensor))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/issignaler(O)
|
||||
if(istype(O, /obj/item/assembly/signaler))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/istimer(O)
|
||||
if(istype(O, /obj/item/assembly/timer))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/*
|
||||
Name: IsSpecialAssembly
|
||||
Desc: If true is an object that can be attached to an assembly holder but is a special thing like a plasma can or door
|
||||
*/
|
||||
|
||||
/obj/proc/IsSpecialAssembly()
|
||||
return 0
|
||||
|
||||
/*
|
||||
Name: IsAssemblyHolder
|
||||
Desc: If true is an object that can hold an assemblyholder object
|
||||
*/
|
||||
/obj/proc/IsAssemblyHolder()
|
||||
return 0
|
||||
/proc/isassembly(O)
|
||||
if(istype(O, /obj/item/assembly))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isigniter(O)
|
||||
if(istype(O, /obj/item/assembly/igniter))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isinfared(O)
|
||||
if(istype(O, /obj/item/assembly/infra))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/isprox(O)
|
||||
if(istype(O, /obj/item/assembly/prox_sensor))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/issignaler(O)
|
||||
if(istype(O, /obj/item/assembly/signaler))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/proc/istimer(O)
|
||||
if(istype(O, /obj/item/assembly/timer))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/*
|
||||
Name: IsSpecialAssembly
|
||||
Desc: If true is an object that can be attached to an assembly holder but is a special thing like a plasma can or door
|
||||
*/
|
||||
|
||||
/obj/proc/IsSpecialAssembly()
|
||||
return 0
|
||||
|
||||
/*
|
||||
Name: IsAssemblyHolder
|
||||
Desc: If true is an object that can hold an assemblyholder object
|
||||
*/
|
||||
/obj/proc/IsAssemblyHolder()
|
||||
return 0
|
||||
|
||||
+197
-197
@@ -1,197 +1,197 @@
|
||||
/obj/item/assembly_holder
|
||||
name = "Assembly"
|
||||
icon = 'icons/obj/assemblies/new_assemblies.dmi'
|
||||
icon_state = "holder"
|
||||
item_state = "assembly"
|
||||
flags = CONDUCT
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
throw_speed = 3
|
||||
throw_range = 10
|
||||
|
||||
var/secured = FALSE
|
||||
var/obj/item/assembly/a_left = null
|
||||
var/obj/item/assembly/a_right = null
|
||||
|
||||
/obj/item/assembly_holder/proc/attach(obj/item/D, obj/item/D2, mob/user)
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/proc/process_activation(var/obj/item/D)
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/IsAssemblyHolder()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly_holder/Destroy()
|
||||
if(a_left)
|
||||
a_left.holder = null
|
||||
if(a_right)
|
||||
a_right.holder = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly_holder/attach(obj/item/D, obj/item/D2, mob/user)
|
||||
if(!D || !D2)
|
||||
return FALSE
|
||||
if(!isassembly(D) || !isassembly(D2))
|
||||
return FALSE
|
||||
var/obj/item/assembly/A1 = D
|
||||
var/obj/item/assembly/A2 = D2
|
||||
if(A1.secured || A2.secured)
|
||||
return FALSE
|
||||
if(!A1.remove_item_from_storage(src))
|
||||
if(user)
|
||||
user.remove_from_mob(A1)
|
||||
A1.loc = src
|
||||
if(!A2.remove_item_from_storage(src))
|
||||
if(user)
|
||||
user.remove_from_mob(A2)
|
||||
A2.loc = src
|
||||
A1.holder = src
|
||||
A2.holder = src
|
||||
a_left = A1
|
||||
a_right = A2
|
||||
name = "[A1.name]-[A2.name] assembly"
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly_holder/update_icon()
|
||||
overlays.Cut()
|
||||
if(a_left)
|
||||
overlays += "[a_left.icon_state]_left"
|
||||
for(var/O in a_left.attached_overlays)
|
||||
overlays += "[O]_l"
|
||||
if(a_right)
|
||||
overlays += "[a_right.icon_state]_right"
|
||||
for(var/O in a_right.attached_overlays)
|
||||
overlays += "[O]_r"
|
||||
if(master)
|
||||
master.update_icon()
|
||||
|
||||
|
||||
/obj/item/assembly_holder/examine(mob/user)
|
||||
. = ..()
|
||||
if(in_range(src, user) || loc == user)
|
||||
if(secured)
|
||||
. += "[src] is ready!"
|
||||
else
|
||||
. += "[src] can be attached!"
|
||||
|
||||
|
||||
/obj/item/assembly_holder/HasProximity(atom/movable/AM)
|
||||
if(a_left)
|
||||
a_left.HasProximity(AM)
|
||||
if(a_right)
|
||||
a_right.HasProximity(AM)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/Crossed(atom/movable/AM, oldloc)
|
||||
if(a_left)
|
||||
a_left.Crossed(AM, oldloc)
|
||||
if(a_right)
|
||||
a_right.Crossed(AM, oldloc)
|
||||
|
||||
/obj/item/assembly_holder/on_found(mob/finder)
|
||||
if(a_left)
|
||||
a_left.on_found(finder)
|
||||
if(a_right)
|
||||
a_right.on_found(finder)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/hear_talk(mob/living/M, list/message_pieces)
|
||||
if(a_left)
|
||||
a_left.hear_talk(M, message_pieces)
|
||||
if(a_right)
|
||||
a_right.hear_talk(M, message_pieces)
|
||||
|
||||
/obj/item/assembly_holder/hear_message(mob/living/M, msg)
|
||||
if(a_left)
|
||||
a_left.hear_message(M, msg)
|
||||
if(a_right)
|
||||
a_right.hear_message(M, msg)
|
||||
|
||||
/obj/item/assembly_holder/proc/process_movement() // infrared beams and prox sensors
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
|
||||
/obj/item/assembly_holder/Move()
|
||||
. = ..()
|
||||
process_movement()
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/pickup()
|
||||
. = ..()
|
||||
process_movement()
|
||||
|
||||
/obj/item/assembly_holder/Bump()
|
||||
..()
|
||||
process_movement()
|
||||
|
||||
/obj/item/assembly_holder/throw_impact() // called when a throw stops
|
||||
..()
|
||||
process_movement()
|
||||
|
||||
/obj/item/assembly_holder/attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/screwdriver_act(mob/user, obj/item/I)
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='warning'>BUG:Assembly part missing, please report this!</span>")
|
||||
return
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
a_left.toggle_secure()
|
||||
a_right.toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
to_chat(user, "<span class='notice'>[src] is ready!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] can now be taken apart!</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/item/assembly_holder/attack_self(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(secured)
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='warning'>Assembly part missing!</span>")
|
||||
return
|
||||
if(istype(a_left, a_right.type))//If they are the same type it causes issues due to window code
|
||||
switch(alert("Which side would you like to use?",,"Left","Right"))
|
||||
if("Left")
|
||||
a_left.attack_self(user)
|
||||
if("Right")
|
||||
a_right.attack_self(user)
|
||||
return
|
||||
else
|
||||
a_left.attack_self(user)
|
||||
a_right.attack_self(user)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return FALSE
|
||||
if(a_left)
|
||||
a_left.holder = null
|
||||
a_left.loc = T
|
||||
if(a_right)
|
||||
a_right.holder = null
|
||||
a_right.loc = T
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/process_activation(obj/D, normal = TRUE, special = TRUE)
|
||||
if(!D)
|
||||
return FALSE
|
||||
if(normal && a_right && a_left)
|
||||
if(a_right != D)
|
||||
a_right.pulsed(0)
|
||||
if(a_left != D)
|
||||
a_left.pulsed(0)
|
||||
if(master)
|
||||
master.receive_signal()
|
||||
return TRUE
|
||||
/obj/item/assembly_holder
|
||||
name = "Assembly"
|
||||
icon = 'icons/obj/assemblies/new_assemblies.dmi'
|
||||
icon_state = "holder"
|
||||
item_state = "assembly"
|
||||
flags = CONDUCT
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
throw_speed = 3
|
||||
throw_range = 10
|
||||
|
||||
var/secured = FALSE
|
||||
var/obj/item/assembly/a_left = null
|
||||
var/obj/item/assembly/a_right = null
|
||||
|
||||
/obj/item/assembly_holder/proc/attach(obj/item/D, obj/item/D2, mob/user)
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/proc/process_activation(var/obj/item/D)
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/IsAssemblyHolder()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly_holder/Destroy()
|
||||
if(a_left)
|
||||
a_left.holder = null
|
||||
if(a_right)
|
||||
a_right.holder = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly_holder/attach(obj/item/D, obj/item/D2, mob/user)
|
||||
if(!D || !D2)
|
||||
return FALSE
|
||||
if(!isassembly(D) || !isassembly(D2))
|
||||
return FALSE
|
||||
var/obj/item/assembly/A1 = D
|
||||
var/obj/item/assembly/A2 = D2
|
||||
if(A1.secured || A2.secured)
|
||||
return FALSE
|
||||
if(!A1.remove_item_from_storage(src))
|
||||
if(user)
|
||||
user.remove_from_mob(A1)
|
||||
A1.loc = src
|
||||
if(!A2.remove_item_from_storage(src))
|
||||
if(user)
|
||||
user.remove_from_mob(A2)
|
||||
A2.loc = src
|
||||
A1.holder = src
|
||||
A2.holder = src
|
||||
a_left = A1
|
||||
a_right = A2
|
||||
name = "[A1.name]-[A2.name] assembly"
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly_holder/update_icon()
|
||||
overlays.Cut()
|
||||
if(a_left)
|
||||
overlays += "[a_left.icon_state]_left"
|
||||
for(var/O in a_left.attached_overlays)
|
||||
overlays += "[O]_l"
|
||||
if(a_right)
|
||||
overlays += "[a_right.icon_state]_right"
|
||||
for(var/O in a_right.attached_overlays)
|
||||
overlays += "[O]_r"
|
||||
if(master)
|
||||
master.update_icon()
|
||||
|
||||
|
||||
/obj/item/assembly_holder/examine(mob/user)
|
||||
. = ..()
|
||||
if(in_range(src, user) || loc == user)
|
||||
if(secured)
|
||||
. += "[src] is ready!"
|
||||
else
|
||||
. += "[src] can be attached!"
|
||||
|
||||
|
||||
/obj/item/assembly_holder/HasProximity(atom/movable/AM)
|
||||
if(a_left)
|
||||
a_left.HasProximity(AM)
|
||||
if(a_right)
|
||||
a_right.HasProximity(AM)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/Crossed(atom/movable/AM, oldloc)
|
||||
if(a_left)
|
||||
a_left.Crossed(AM, oldloc)
|
||||
if(a_right)
|
||||
a_right.Crossed(AM, oldloc)
|
||||
|
||||
/obj/item/assembly_holder/on_found(mob/finder)
|
||||
if(a_left)
|
||||
a_left.on_found(finder)
|
||||
if(a_right)
|
||||
a_right.on_found(finder)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/hear_talk(mob/living/M, list/message_pieces)
|
||||
if(a_left)
|
||||
a_left.hear_talk(M, message_pieces)
|
||||
if(a_right)
|
||||
a_right.hear_talk(M, message_pieces)
|
||||
|
||||
/obj/item/assembly_holder/hear_message(mob/living/M, msg)
|
||||
if(a_left)
|
||||
a_left.hear_message(M, msg)
|
||||
if(a_right)
|
||||
a_right.hear_message(M, msg)
|
||||
|
||||
/obj/item/assembly_holder/proc/process_movement() // infrared beams and prox sensors
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
|
||||
/obj/item/assembly_holder/Move()
|
||||
. = ..()
|
||||
process_movement()
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/pickup()
|
||||
. = ..()
|
||||
process_movement()
|
||||
|
||||
/obj/item/assembly_holder/Bump()
|
||||
..()
|
||||
process_movement()
|
||||
|
||||
/obj/item/assembly_holder/throw_impact() // called when a throw stops
|
||||
..()
|
||||
process_movement()
|
||||
|
||||
/obj/item/assembly_holder/attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
|
||||
if(a_left && a_right)
|
||||
a_left.holder_movement()
|
||||
a_right.holder_movement()
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/item/assembly_holder/screwdriver_act(mob/user, obj/item/I)
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='warning'>BUG:Assembly part missing, please report this!</span>")
|
||||
return
|
||||
. = TRUE
|
||||
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
|
||||
return
|
||||
a_left.toggle_secure()
|
||||
a_right.toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
to_chat(user, "<span class='notice'>[src] is ready!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] can now be taken apart!</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/item/assembly_holder/attack_self(mob/user)
|
||||
add_fingerprint(user)
|
||||
if(secured)
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='warning'>Assembly part missing!</span>")
|
||||
return
|
||||
if(istype(a_left, a_right.type))//If they are the same type it causes issues due to window code
|
||||
switch(alert("Which side would you like to use?",,"Left","Right"))
|
||||
if("Left")
|
||||
a_left.attack_self(user)
|
||||
if("Right")
|
||||
a_right.attack_self(user)
|
||||
return
|
||||
else
|
||||
a_left.attack_self(user)
|
||||
a_right.attack_self(user)
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T)
|
||||
return FALSE
|
||||
if(a_left)
|
||||
a_left.holder = null
|
||||
a_left.loc = T
|
||||
if(a_right)
|
||||
a_right.holder = null
|
||||
a_right.loc = T
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/process_activation(obj/D, normal = TRUE, special = TRUE)
|
||||
if(!D)
|
||||
return FALSE
|
||||
if(normal && a_right && a_left)
|
||||
if(a_right != D)
|
||||
a_right.pulsed(0)
|
||||
if(a_left != D)
|
||||
a_left.pulsed(0)
|
||||
if(master)
|
||||
master.receive_signal()
|
||||
return TRUE
|
||||
|
||||
@@ -1,45 +1,45 @@
|
||||
/obj/item/assembly/igniter
|
||||
name = "igniter"
|
||||
desc = "A small electronic device able to ignite combustable substances."
|
||||
icon_state = "igniter"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
origin_tech = "magnets=1"
|
||||
var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
|
||||
|
||||
/obj/item/assembly/igniter/New()
|
||||
..()
|
||||
sparks.set_up(2, 0, src)
|
||||
sparks.attach(src)
|
||||
|
||||
/obj/item/assembly/igniter/Destroy()
|
||||
QDEL_NULL(sparks)
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/assembly/igniter/describe()
|
||||
return "The igniter is [secured ? "secured." : "unsecured."]"
|
||||
|
||||
|
||||
/obj/item/assembly/igniter/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
var/turf/location = get_turf(loc)
|
||||
if(location)
|
||||
location.hotspot_expose(1000,1000)
|
||||
if(istype(loc, /obj/item/assembly_holder))
|
||||
if(istype(loc.loc, /obj/structure/reagent_dispensers/fueltank))
|
||||
var/obj/structure/reagent_dispensers/fueltank/tank = loc.loc
|
||||
if(tank)
|
||||
tank.boom(TRUE)
|
||||
if(istype(loc.loc, /obj/item/reagent_containers/glass/beaker))
|
||||
var/obj/item/reagent_containers/glass/beaker/beakerbomb = loc.loc
|
||||
if(beakerbomb)
|
||||
beakerbomb.heat_beaker()
|
||||
sparks.start()
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/igniter/attack_self(mob/user)
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
return
|
||||
/obj/item/assembly/igniter
|
||||
name = "igniter"
|
||||
desc = "A small electronic device able to ignite combustable substances."
|
||||
icon_state = "igniter"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
origin_tech = "magnets=1"
|
||||
var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
|
||||
|
||||
/obj/item/assembly/igniter/New()
|
||||
..()
|
||||
sparks.set_up(2, 0, src)
|
||||
sparks.attach(src)
|
||||
|
||||
/obj/item/assembly/igniter/Destroy()
|
||||
QDEL_NULL(sparks)
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/assembly/igniter/describe()
|
||||
return "The igniter is [secured ? "secured." : "unsecured."]"
|
||||
|
||||
|
||||
/obj/item/assembly/igniter/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
var/turf/location = get_turf(loc)
|
||||
if(location)
|
||||
location.hotspot_expose(1000,1000)
|
||||
if(istype(loc, /obj/item/assembly_holder))
|
||||
if(istype(loc.loc, /obj/structure/reagent_dispensers/fueltank))
|
||||
var/obj/structure/reagent_dispensers/fueltank/tank = loc.loc
|
||||
if(tank)
|
||||
tank.boom(TRUE)
|
||||
if(istype(loc.loc, /obj/item/reagent_containers/glass/beaker))
|
||||
var/obj/item/reagent_containers/glass/beaker/beakerbomb = loc.loc
|
||||
if(beakerbomb)
|
||||
beakerbomb.heat_beaker()
|
||||
sparks.start()
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/igniter/attack_self(mob/user)
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
+286
-286
@@ -1,286 +1,286 @@
|
||||
/obj/item/assembly/infra
|
||||
name = "infrared emitter"
|
||||
desc = "Emits a visible or invisible beam and is triggered when the beam is interrupted."
|
||||
icon_state = "infrared"
|
||||
materials = list(MAT_METAL=1000, MAT_GLASS=500)
|
||||
origin_tech = "magnets=2;materials=2"
|
||||
|
||||
bomb_name = "tripwire mine"
|
||||
|
||||
secured = FALSE // toggle_secure()'ed in New() for correct adding to processing_objects, won't work otherwise
|
||||
dir = EAST
|
||||
var/on = FALSE
|
||||
var/visible = TRUE
|
||||
var/obj/effect/beam/i_beam/first = null
|
||||
var/obj/effect/beam/i_beam/last = null
|
||||
var/max_nesting_level = 10
|
||||
var/turf/fire_location
|
||||
var/emission_cycles = 0
|
||||
var/emission_cap = 20
|
||||
|
||||
/obj/item/assembly/infra/Destroy()
|
||||
if(first)
|
||||
QDEL_NULL(first)
|
||||
last = null
|
||||
fire_location = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/infra/describe()
|
||||
return "The assembly is [secured ? "secure" : "not secure"]. The infrared trigger is [on ? "on" : "off"]."
|
||||
|
||||
/obj/item/assembly/infra/examine(mob/user)
|
||||
. = ..()
|
||||
. += describe()
|
||||
|
||||
/obj/item/assembly/infra/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
on = !on
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/infra/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
on = FALSE
|
||||
if(first)
|
||||
qdel(first)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/infra/New()
|
||||
..()
|
||||
if(!secured)
|
||||
toggle_secure()
|
||||
|
||||
/obj/item/assembly/infra/proc/arm() // Forces the device to arm no matter its current state.
|
||||
if(!secured) // Checked because arm() might be called sometime after the object is spawned.
|
||||
toggle_secure()
|
||||
on = 1
|
||||
|
||||
/obj/item/assembly/infra/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(on)
|
||||
overlays += "infrared_on"
|
||||
attached_overlays += "infrared_on"
|
||||
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/infra/process()
|
||||
var/turf/T = get_turf(src)
|
||||
if(first && (!on || !fire_location || fire_location != T || emission_cycles >= emission_cap))
|
||||
qdel(first)
|
||||
return
|
||||
if(!on)
|
||||
return
|
||||
if(!secured)
|
||||
return
|
||||
if(first && last)
|
||||
last.process()
|
||||
emission_cycles++
|
||||
return
|
||||
if(T)
|
||||
fire_location = T
|
||||
emission_cycles = 0
|
||||
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam(T)
|
||||
I.master = src
|
||||
I.density = 1
|
||||
I.dir = dir
|
||||
I.update_icon()
|
||||
first = I
|
||||
step(I, I.dir)
|
||||
if(first)
|
||||
I.density = FALSE
|
||||
I.vis_spread(visible)
|
||||
I.limit = 8
|
||||
I.process()
|
||||
|
||||
/obj/item/assembly/infra/attack_hand()
|
||||
qdel(first)
|
||||
..()
|
||||
|
||||
/obj/item/assembly/infra/Move()
|
||||
var/t = dir
|
||||
. = ..()
|
||||
dir = t
|
||||
qdel(first)
|
||||
|
||||
/obj/item/assembly/infra/holder_movement()
|
||||
if(!holder)
|
||||
return FALSE
|
||||
qdel(first)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/infra/equipped(var/mob/user, var/slot)
|
||||
qdel(first)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/infra/pickup(mob/user)
|
||||
qdel(first)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/infra/proc/trigger_beam()
|
||||
if(!secured || !on || cooldown > 0)
|
||||
return FALSE
|
||||
pulse(0)
|
||||
audible_message("[bicon(src)] *beep* *beep*", null, 3)
|
||||
if(first)
|
||||
qdel(first)
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
/obj/item/assembly/infra/interact(mob/user)//TODO: change this this to the wire control panel
|
||||
if(!secured) return
|
||||
user.set_machine(src)
|
||||
var/dat = {"<TT><B>Infrared Laser</B>
|
||||
<B>Status</B>: [on ? "<A href='?src=[UID()];state=0'>On</A>" : "<A href='?src=[UID()];state=1'>Off</A>"]<BR>
|
||||
<B>Visibility</B>: [visible ? "<A href='?src=[UID()];visible=0'>Visible</A>" : "<A href='?src=[UID()];visible=1'>Invisible</A>"]<BR>
|
||||
<B>Current Direction</B>: <A href='?src=[UID()];rotate=1'>[capitalize(dir2text(dir))]</A><BR>
|
||||
</TT>
|
||||
<BR><BR><A href='?src=[UID()];refresh=1'>Refresh</A>
|
||||
<BR><BR><A href='?src=[UID()];close=1'>Close</A>"}
|
||||
var/datum/browser/popup = new(user, "infra", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "infra")
|
||||
|
||||
/obj/item/assembly/infra/Topic(href, href_list)
|
||||
..()
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=infra")
|
||||
onclose(usr, "infra")
|
||||
return
|
||||
if(href_list["state"])
|
||||
on = !(on)
|
||||
update_icon()
|
||||
if(href_list["visible"])
|
||||
visible = !(visible)
|
||||
if(first)
|
||||
first.vis_spread(visible)
|
||||
if(href_list["rotate"])
|
||||
rotate()
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/assembly/infra/verb/rotate()//This could likely be better
|
||||
set name = "Rotate Infrared Laser"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
|
||||
dir = turn(dir, 90)
|
||||
|
||||
if(usr.machine == src)
|
||||
interact(usr)
|
||||
|
||||
if(first)
|
||||
qdel(first)
|
||||
|
||||
|
||||
|
||||
/obj/item/assembly/infra/armed/New()
|
||||
..()
|
||||
spawn(3)
|
||||
if(holder)
|
||||
if(holder.master)
|
||||
dir = holder.master.dir
|
||||
arm()
|
||||
|
||||
/obj/item/assembly/infra/armed/stealth
|
||||
visible = FALSE
|
||||
|
||||
|
||||
/***************************IBeam*********************************/
|
||||
|
||||
/obj/effect/beam/i_beam
|
||||
name = "i beam"
|
||||
icon = 'icons/obj/projectiles.dmi'
|
||||
icon_state = "ibeam"
|
||||
var/obj/effect/beam/i_beam/next = null
|
||||
var/obj/effect/beam/i_beam/previous = null
|
||||
var/obj/item/assembly/infra/master = null
|
||||
var/limit = null
|
||||
var/visible = FALSE
|
||||
var/left = null
|
||||
var/life_cycles = 0
|
||||
var/life_cap = 20
|
||||
anchored = TRUE
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
|
||||
|
||||
/obj/effect/beam/i_beam/proc/hit()
|
||||
if(master)
|
||||
master.trigger_beam()
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/beam/i_beam/proc/vis_spread(v)
|
||||
visible = v
|
||||
if(next)
|
||||
next.vis_spread(v)
|
||||
|
||||
/obj/effect/beam/i_beam/update_icon()
|
||||
transform = turn(matrix(), dir2angle(dir))
|
||||
|
||||
/obj/effect/beam/i_beam/process()
|
||||
life_cycles++
|
||||
if(loc.density || !master || life_cycles >= life_cap)
|
||||
qdel(src)
|
||||
return
|
||||
if(left > 0)
|
||||
left--
|
||||
if(left < 1)
|
||||
if(!(visible))
|
||||
invisibility = 101
|
||||
else
|
||||
invisibility = FALSE
|
||||
else
|
||||
invisibility = FALSE
|
||||
|
||||
if(!next && (limit > 0))
|
||||
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam(loc)
|
||||
I.master = master
|
||||
I.density = 1
|
||||
I.dir = dir
|
||||
I.update_icon()
|
||||
I.previous = src
|
||||
next = I
|
||||
step(I, I.dir)
|
||||
if(next)
|
||||
I.density = FALSE
|
||||
I.vis_spread(visible)
|
||||
I.limit = limit - 1
|
||||
master.last = I
|
||||
I.process()
|
||||
|
||||
/obj/effect/beam/i_beam/Bump()
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/beam/i_beam/Bumped()
|
||||
hit()
|
||||
|
||||
/obj/effect/beam/i_beam/Crossed(atom/movable/AM, oldloc)
|
||||
if(!isobj(AM) && !isliving(AM))
|
||||
return
|
||||
if(istype(AM, /obj/effect))
|
||||
return
|
||||
hit()
|
||||
|
||||
/obj/effect/beam/i_beam/Destroy()
|
||||
if(master.first == src)
|
||||
master.first = null
|
||||
QDEL_NULL(next)
|
||||
if(previous)
|
||||
previous.next = null
|
||||
master.last = previous
|
||||
return ..()
|
||||
/obj/item/assembly/infra
|
||||
name = "infrared emitter"
|
||||
desc = "Emits a visible or invisible beam and is triggered when the beam is interrupted."
|
||||
icon_state = "infrared"
|
||||
materials = list(MAT_METAL=1000, MAT_GLASS=500)
|
||||
origin_tech = "magnets=2;materials=2"
|
||||
|
||||
bomb_name = "tripwire mine"
|
||||
|
||||
secured = FALSE // toggle_secure()'ed in New() for correct adding to processing_objects, won't work otherwise
|
||||
dir = EAST
|
||||
var/on = FALSE
|
||||
var/visible = TRUE
|
||||
var/obj/effect/beam/i_beam/first = null
|
||||
var/obj/effect/beam/i_beam/last = null
|
||||
var/max_nesting_level = 10
|
||||
var/turf/fire_location
|
||||
var/emission_cycles = 0
|
||||
var/emission_cap = 20
|
||||
|
||||
/obj/item/assembly/infra/Destroy()
|
||||
if(first)
|
||||
QDEL_NULL(first)
|
||||
last = null
|
||||
fire_location = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/infra/describe()
|
||||
return "The assembly is [secured ? "secure" : "not secure"]. The infrared trigger is [on ? "on" : "off"]."
|
||||
|
||||
/obj/item/assembly/infra/examine(mob/user)
|
||||
. = ..()
|
||||
. += describe()
|
||||
|
||||
/obj/item/assembly/infra/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
on = !on
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/infra/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
on = FALSE
|
||||
if(first)
|
||||
qdel(first)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/infra/New()
|
||||
..()
|
||||
if(!secured)
|
||||
toggle_secure()
|
||||
|
||||
/obj/item/assembly/infra/proc/arm() // Forces the device to arm no matter its current state.
|
||||
if(!secured) // Checked because arm() might be called sometime after the object is spawned.
|
||||
toggle_secure()
|
||||
on = 1
|
||||
|
||||
/obj/item/assembly/infra/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(on)
|
||||
overlays += "infrared_on"
|
||||
attached_overlays += "infrared_on"
|
||||
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/infra/process()
|
||||
var/turf/T = get_turf(src)
|
||||
if(first && (!on || !fire_location || fire_location != T || emission_cycles >= emission_cap))
|
||||
qdel(first)
|
||||
return
|
||||
if(!on)
|
||||
return
|
||||
if(!secured)
|
||||
return
|
||||
if(first && last)
|
||||
last.process()
|
||||
emission_cycles++
|
||||
return
|
||||
if(T)
|
||||
fire_location = T
|
||||
emission_cycles = 0
|
||||
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam(T)
|
||||
I.master = src
|
||||
I.density = 1
|
||||
I.dir = dir
|
||||
I.update_icon()
|
||||
first = I
|
||||
step(I, I.dir)
|
||||
if(first)
|
||||
I.density = FALSE
|
||||
I.vis_spread(visible)
|
||||
I.limit = 8
|
||||
I.process()
|
||||
|
||||
/obj/item/assembly/infra/attack_hand()
|
||||
qdel(first)
|
||||
..()
|
||||
|
||||
/obj/item/assembly/infra/Move()
|
||||
var/t = dir
|
||||
. = ..()
|
||||
dir = t
|
||||
qdel(first)
|
||||
|
||||
/obj/item/assembly/infra/holder_movement()
|
||||
if(!holder)
|
||||
return FALSE
|
||||
qdel(first)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/infra/equipped(var/mob/user, var/slot)
|
||||
qdel(first)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/infra/pickup(mob/user)
|
||||
qdel(first)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/infra/proc/trigger_beam()
|
||||
if(!secured || !on || cooldown > 0)
|
||||
return FALSE
|
||||
pulse(0)
|
||||
audible_message("[bicon(src)] *beep* *beep*", null, 3)
|
||||
if(first)
|
||||
qdel(first)
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
/obj/item/assembly/infra/interact(mob/user)//TODO: change this this to the wire control panel
|
||||
if(!secured) return
|
||||
user.set_machine(src)
|
||||
var/dat = {"<TT><B>Infrared Laser</B>
|
||||
<B>Status</B>: [on ? "<A href='?src=[UID()];state=0'>On</A>" : "<A href='?src=[UID()];state=1'>Off</A>"]<BR>
|
||||
<B>Visibility</B>: [visible ? "<A href='?src=[UID()];visible=0'>Visible</A>" : "<A href='?src=[UID()];visible=1'>Invisible</A>"]<BR>
|
||||
<B>Current Direction</B>: <A href='?src=[UID()];rotate=1'>[capitalize(dir2text(dir))]</A><BR>
|
||||
</TT>
|
||||
<BR><BR><A href='?src=[UID()];refresh=1'>Refresh</A>
|
||||
<BR><BR><A href='?src=[UID()];close=1'>Close</A>"}
|
||||
var/datum/browser/popup = new(user, "infra", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "infra")
|
||||
|
||||
/obj/item/assembly/infra/Topic(href, href_list)
|
||||
..()
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=infra")
|
||||
onclose(usr, "infra")
|
||||
return
|
||||
if(href_list["state"])
|
||||
on = !(on)
|
||||
update_icon()
|
||||
if(href_list["visible"])
|
||||
visible = !(visible)
|
||||
if(first)
|
||||
first.vis_spread(visible)
|
||||
if(href_list["rotate"])
|
||||
rotate()
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/assembly/infra/verb/rotate()//This could likely be better
|
||||
set name = "Rotate Infrared Laser"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
|
||||
dir = turn(dir, 90)
|
||||
|
||||
if(usr.machine == src)
|
||||
interact(usr)
|
||||
|
||||
if(first)
|
||||
qdel(first)
|
||||
|
||||
|
||||
|
||||
/obj/item/assembly/infra/armed/New()
|
||||
..()
|
||||
spawn(3)
|
||||
if(holder)
|
||||
if(holder.master)
|
||||
dir = holder.master.dir
|
||||
arm()
|
||||
|
||||
/obj/item/assembly/infra/armed/stealth
|
||||
visible = FALSE
|
||||
|
||||
|
||||
/***************************IBeam*********************************/
|
||||
|
||||
/obj/effect/beam/i_beam
|
||||
name = "i beam"
|
||||
icon = 'icons/obj/projectiles.dmi'
|
||||
icon_state = "ibeam"
|
||||
var/obj/effect/beam/i_beam/next = null
|
||||
var/obj/effect/beam/i_beam/previous = null
|
||||
var/obj/item/assembly/infra/master = null
|
||||
var/limit = null
|
||||
var/visible = FALSE
|
||||
var/left = null
|
||||
var/life_cycles = 0
|
||||
var/life_cap = 20
|
||||
anchored = TRUE
|
||||
pass_flags = PASSTABLE | PASSGLASS | PASSGRILLE
|
||||
|
||||
|
||||
/obj/effect/beam/i_beam/proc/hit()
|
||||
if(master)
|
||||
master.trigger_beam()
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/beam/i_beam/proc/vis_spread(v)
|
||||
visible = v
|
||||
if(next)
|
||||
next.vis_spread(v)
|
||||
|
||||
/obj/effect/beam/i_beam/update_icon()
|
||||
transform = turn(matrix(), dir2angle(dir))
|
||||
|
||||
/obj/effect/beam/i_beam/process()
|
||||
life_cycles++
|
||||
if(loc.density || !master || life_cycles >= life_cap)
|
||||
qdel(src)
|
||||
return
|
||||
if(left > 0)
|
||||
left--
|
||||
if(left < 1)
|
||||
if(!(visible))
|
||||
invisibility = 101
|
||||
else
|
||||
invisibility = FALSE
|
||||
else
|
||||
invisibility = FALSE
|
||||
|
||||
if(!next && (limit > 0))
|
||||
var/obj/effect/beam/i_beam/I = new /obj/effect/beam/i_beam(loc)
|
||||
I.master = master
|
||||
I.density = 1
|
||||
I.dir = dir
|
||||
I.update_icon()
|
||||
I.previous = src
|
||||
next = I
|
||||
step(I, I.dir)
|
||||
if(next)
|
||||
I.density = FALSE
|
||||
I.vis_spread(visible)
|
||||
I.limit = limit - 1
|
||||
master.last = I
|
||||
I.process()
|
||||
|
||||
/obj/effect/beam/i_beam/Bump()
|
||||
qdel(src)
|
||||
|
||||
/obj/effect/beam/i_beam/Bumped()
|
||||
hit()
|
||||
|
||||
/obj/effect/beam/i_beam/Crossed(atom/movable/AM, oldloc)
|
||||
if(!isobj(AM) && !isliving(AM))
|
||||
return
|
||||
if(istype(AM, /obj/effect))
|
||||
return
|
||||
hit()
|
||||
|
||||
/obj/effect/beam/i_beam/Destroy()
|
||||
if(master.first == src)
|
||||
master.first = null
|
||||
QDEL_NULL(next)
|
||||
if(previous)
|
||||
previous.next = null
|
||||
master.last = previous
|
||||
return ..()
|
||||
|
||||
+144
-144
@@ -1,144 +1,144 @@
|
||||
/obj/item/assembly/mousetrap
|
||||
name = "mousetrap"
|
||||
desc = "A handy little spring-loaded trap for catching pesty rodents."
|
||||
icon_state = "mousetrap"
|
||||
materials = list(MAT_METAL=100)
|
||||
origin_tech = "combat=1;materials=2;engineering=1"
|
||||
var/armed = FALSE
|
||||
|
||||
bomb_name = "contact mine"
|
||||
|
||||
/obj/item/assembly/mousetrap/examine(mob/user)
|
||||
. = ..()
|
||||
if(armed)
|
||||
. += "It looks like it's armed."
|
||||
|
||||
/obj/item/assembly/mousetrap/activate()
|
||||
if(..())
|
||||
armed = !armed
|
||||
if(!armed)
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/user = usr
|
||||
if((user.getBrainLoss() >= 60 || (CLUMSY in user.mutations)) && prob(50))
|
||||
to_chat(user, "Your hand slips, setting off the trigger.")
|
||||
pulse(0)
|
||||
update_icon()
|
||||
if(usr)
|
||||
playsound(usr.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
|
||||
/obj/item/assembly/mousetrap/describe()
|
||||
return "The pressure switch is [armed ? "primed" : "safe"]."
|
||||
|
||||
/obj/item/assembly/mousetrap/update_icon()
|
||||
if(armed)
|
||||
icon_state = "mousetraparmed"
|
||||
else
|
||||
icon_state = "mousetrap"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/mousetrap/proc/triggered(mob/target, type = "feet")
|
||||
if(!armed)
|
||||
return
|
||||
var/obj/item/organ/external/affecting = null
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
if(PIERCEIMMUNE in H.dna.species.species_traits)
|
||||
playsound(src, 'sound/effects/snap.ogg', 50, TRUE)
|
||||
armed = FALSE
|
||||
update_icon()
|
||||
pulse(FALSE)
|
||||
return FALSE
|
||||
switch(type)
|
||||
if("feet")
|
||||
if(!H.shoes)
|
||||
affecting = H.get_organ(pick("l_leg", "r_leg"))
|
||||
H.Weaken(3)
|
||||
if("l_hand", "r_hand")
|
||||
if(!H.gloves)
|
||||
affecting = H.get_organ(type)
|
||||
H.Stun(3)
|
||||
if(affecting)
|
||||
affecting.receive_damage(1, 0)
|
||||
else if(ismouse(target))
|
||||
var/mob/living/simple_animal/mouse/M = target
|
||||
visible_message("<span class='danger'>SPLAT!</span>")
|
||||
M.splat()
|
||||
playsound(loc, 'sound/effects/snap.ogg', 50, 1)
|
||||
layer = MOB_LAYER - 0.2
|
||||
armed = FALSE
|
||||
update_icon()
|
||||
pulse(0)
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_self(mob/living/user)
|
||||
if(!armed)
|
||||
to_chat(user, "<span class='notice'>You arm [src].</span>")
|
||||
else
|
||||
if((user.getBrainLoss() >= 60 || (CLUMSY in user.mutations)) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking [user.p_their()] fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You disarm [src].</span>")
|
||||
armed = !armed
|
||||
update_icon()
|
||||
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_hand(mob/living/user)
|
||||
if(armed)
|
||||
if((user.getBrainLoss() >= 60 || CLUMSY in user.mutations) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking [user.p_their()] fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/assembly/mousetrap/Crossed(atom/movable/AM, oldloc)
|
||||
if(armed)
|
||||
if(ishuman(AM))
|
||||
var/mob/living/carbon/H = AM
|
||||
if(H.m_intent == MOVE_INTENT_RUN)
|
||||
triggered(H)
|
||||
H.visible_message("<span class='warning'>[H] accidentally steps on [src].</span>", \
|
||||
"<span class='warning'>You accidentally step on [src]</span>")
|
||||
else if(ismouse(AM))
|
||||
triggered(AM)
|
||||
else if(AM.density) // For mousetrap grenades, set off by anything heavy
|
||||
triggered(AM)
|
||||
..()
|
||||
|
||||
/obj/item/assembly/mousetrap/on_found(mob/finder)
|
||||
if(armed)
|
||||
finder.visible_message("<span class='warning'>[finder] accidentally sets off [src], breaking [finder.p_their()] fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
triggered(finder, finder.hand ? "l_hand" : "r_hand")
|
||||
return TRUE //end the search!
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/mousetrap/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
|
||||
if(!armed)
|
||||
return ..()
|
||||
visible_message("<span class='warning'>[src] is triggered by [AM].</span>")
|
||||
triggered(null)
|
||||
|
||||
/obj/item/assembly/mousetrap/armed
|
||||
icon_state = "mousetraparmed"
|
||||
armed = 1
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/verb/hide_under()
|
||||
set src in oview(1)
|
||||
set name = "Hide"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
layer = TURF_LAYER+0.2
|
||||
to_chat(usr, "<span class='notice'>You hide [src].</span>")
|
||||
/obj/item/assembly/mousetrap
|
||||
name = "mousetrap"
|
||||
desc = "A handy little spring-loaded trap for catching pesty rodents."
|
||||
icon_state = "mousetrap"
|
||||
materials = list(MAT_METAL=100)
|
||||
origin_tech = "combat=1;materials=2;engineering=1"
|
||||
var/armed = FALSE
|
||||
|
||||
bomb_name = "contact mine"
|
||||
|
||||
/obj/item/assembly/mousetrap/examine(mob/user)
|
||||
. = ..()
|
||||
if(armed)
|
||||
. += "It looks like it's armed."
|
||||
|
||||
/obj/item/assembly/mousetrap/activate()
|
||||
if(..())
|
||||
armed = !armed
|
||||
if(!armed)
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/user = usr
|
||||
if((user.getBrainLoss() >= 60 || (CLUMSY in user.mutations)) && prob(50))
|
||||
to_chat(user, "Your hand slips, setting off the trigger.")
|
||||
pulse(0)
|
||||
update_icon()
|
||||
if(usr)
|
||||
playsound(usr.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
|
||||
/obj/item/assembly/mousetrap/describe()
|
||||
return "The pressure switch is [armed ? "primed" : "safe"]."
|
||||
|
||||
/obj/item/assembly/mousetrap/update_icon()
|
||||
if(armed)
|
||||
icon_state = "mousetraparmed"
|
||||
else
|
||||
icon_state = "mousetrap"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/mousetrap/proc/triggered(mob/target, type = "feet")
|
||||
if(!armed)
|
||||
return
|
||||
var/obj/item/organ/external/affecting = null
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
if(PIERCEIMMUNE in H.dna.species.species_traits)
|
||||
playsound(src, 'sound/effects/snap.ogg', 50, TRUE)
|
||||
armed = FALSE
|
||||
update_icon()
|
||||
pulse(FALSE)
|
||||
return FALSE
|
||||
switch(type)
|
||||
if("feet")
|
||||
if(!H.shoes)
|
||||
affecting = H.get_organ(pick("l_leg", "r_leg"))
|
||||
H.Weaken(3)
|
||||
if("l_hand", "r_hand")
|
||||
if(!H.gloves)
|
||||
affecting = H.get_organ(type)
|
||||
H.Stun(3)
|
||||
if(affecting)
|
||||
affecting.receive_damage(1, 0)
|
||||
else if(ismouse(target))
|
||||
var/mob/living/simple_animal/mouse/M = target
|
||||
visible_message("<span class='danger'>SPLAT!</span>")
|
||||
M.splat()
|
||||
playsound(loc, 'sound/effects/snap.ogg', 50, 1)
|
||||
layer = MOB_LAYER - 0.2
|
||||
armed = FALSE
|
||||
update_icon()
|
||||
pulse(0)
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_self(mob/living/user)
|
||||
if(!armed)
|
||||
to_chat(user, "<span class='notice'>You arm [src].</span>")
|
||||
else
|
||||
if((user.getBrainLoss() >= 60 || (CLUMSY in user.mutations)) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking [user.p_their()] fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You disarm [src].</span>")
|
||||
armed = !armed
|
||||
update_icon()
|
||||
playsound(user.loc, 'sound/weapons/handcuffs.ogg', 30, 1, -3)
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_hand(mob/living/user)
|
||||
if(armed)
|
||||
if((user.getBrainLoss() >= 60 || CLUMSY in user.mutations) && prob(50))
|
||||
var/which_hand = "l_hand"
|
||||
if(!user.hand)
|
||||
which_hand = "r_hand"
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking [user.p_their()] fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/assembly/mousetrap/Crossed(atom/movable/AM, oldloc)
|
||||
if(armed)
|
||||
if(ishuman(AM))
|
||||
var/mob/living/carbon/H = AM
|
||||
if(H.m_intent == MOVE_INTENT_RUN)
|
||||
triggered(H)
|
||||
H.visible_message("<span class='warning'>[H] accidentally steps on [src].</span>", \
|
||||
"<span class='warning'>You accidentally step on [src]</span>")
|
||||
else if(ismouse(AM))
|
||||
triggered(AM)
|
||||
else if(AM.density) // For mousetrap grenades, set off by anything heavy
|
||||
triggered(AM)
|
||||
..()
|
||||
|
||||
/obj/item/assembly/mousetrap/on_found(mob/finder)
|
||||
if(armed)
|
||||
finder.visible_message("<span class='warning'>[finder] accidentally sets off [src], breaking [finder.p_their()] fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
triggered(finder, finder.hand ? "l_hand" : "r_hand")
|
||||
return TRUE //end the search!
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/mousetrap/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
|
||||
if(!armed)
|
||||
return ..()
|
||||
visible_message("<span class='warning'>[src] is triggered by [AM].</span>")
|
||||
triggered(null)
|
||||
|
||||
/obj/item/assembly/mousetrap/armed
|
||||
icon_state = "mousetraparmed"
|
||||
armed = 1
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/verb/hide_under()
|
||||
set src in oview(1)
|
||||
set name = "Hide"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
|
||||
layer = TURF_LAYER+0.2
|
||||
to_chat(usr, "<span class='notice'>You hide [src].</span>")
|
||||
|
||||
+134
-134
@@ -1,134 +1,134 @@
|
||||
/obj/item/assembly/prox_sensor
|
||||
name = "proximity sensor"
|
||||
desc = "Used for scanning and alerting when someone enters a certain proximity."
|
||||
icon_state = "prox"
|
||||
materials = list(MAT_METAL = 800, MAT_GLASS = 200)
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
|
||||
secured = 0
|
||||
|
||||
bomb_name = "proximity mine"
|
||||
|
||||
var/scanning = 0
|
||||
var/timing = 0
|
||||
var/time = 10
|
||||
|
||||
/obj/item/assembly/prox_sensor/describe()
|
||||
if(timing)
|
||||
return "<span class='notice'>The proximity sensor is arming.</span>"
|
||||
return "The proximity sensor is [scanning ? "armed" : "disarmed"]."
|
||||
|
||||
/obj/item/assembly/prox_sensor/activate()
|
||||
if(!..())
|
||||
return FALSE //Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/prox_sensor/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
scanning = 0
|
||||
timing = 0
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/prox_sensor/HasProximity(atom/movable/AM)
|
||||
if(!isobj(AM) && !isliving(AM))
|
||||
return
|
||||
if(istype(AM, /obj/effect))
|
||||
return
|
||||
if(AM.move_speed < 12)
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/sense()
|
||||
if(!secured || !scanning || cooldown > 0)
|
||||
return FALSE
|
||||
pulse(0)
|
||||
visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
/obj/item/assembly/prox_sensor/process()
|
||||
if(timing && (time >= 0))
|
||||
time--
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
toggle_scan()
|
||||
time = 10
|
||||
|
||||
/obj/item/assembly/prox_sensor/dropped()
|
||||
..()
|
||||
spawn(0)
|
||||
sense()
|
||||
return
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/toggle_scan()
|
||||
if(!secured)
|
||||
return FALSE
|
||||
scanning = !scanning
|
||||
update_icon()
|
||||
|
||||
/obj/item/assembly/prox_sensor/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "prox_timing"
|
||||
attached_overlays += "prox_timing"
|
||||
if(scanning)
|
||||
overlays += "prox_scanning"
|
||||
attached_overlays += "prox_scanning"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/prox_sensor/Move()
|
||||
..()
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/holder_movement()
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/interact(mob/user)//TODO: Change this to the wires thingy
|
||||
if(!secured)
|
||||
user.show_message("<span class='warning'>The [name] is unsecured!</span>")
|
||||
return FALSE
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = text("<TT><B>Proximity Sensor</B>\n[] []:[]\n<A href='?src=[UID()];tp=-30'>-</A> <A href='?src=[UID()];tp=-1'>-</A> <A href='?src=[UID()];tp=1'>+</A> <A href='?src=[UID()];tp=30'>+</A>\n</TT>", (timing ? "<A href='?src=[UID()];time=0'>Arming</A>" : "<A href='?src=[UID()];time=1'>Not Arming</A>"), minute, second)
|
||||
dat += "<BR><A href='?src=[UID()];scanning=1'>[scanning?"Armed":"Unarmed"]</A> (Movement sensor active when armed!)"
|
||||
dat += "<BR><BR><A href='?src=[UID()];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[UID()];close=1'>Close</A>"
|
||||
var/datum/browser/popup = new(user, "prox", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "prox")
|
||||
|
||||
/obj/item/assembly/prox_sensor/Topic(href, href_list)
|
||||
..()
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=prox")
|
||||
onclose(usr, "prox")
|
||||
return
|
||||
|
||||
if(href_list["scanning"])
|
||||
toggle_scan()
|
||||
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
time += tp
|
||||
time = min(max(round(time), 0), 600)
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=prox")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
/obj/item/assembly/prox_sensor
|
||||
name = "proximity sensor"
|
||||
desc = "Used for scanning and alerting when someone enters a certain proximity."
|
||||
icon_state = "prox"
|
||||
materials = list(MAT_METAL = 800, MAT_GLASS = 200)
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
|
||||
secured = 0
|
||||
|
||||
bomb_name = "proximity mine"
|
||||
|
||||
var/scanning = 0
|
||||
var/timing = 0
|
||||
var/time = 10
|
||||
|
||||
/obj/item/assembly/prox_sensor/describe()
|
||||
if(timing)
|
||||
return "<span class='notice'>The proximity sensor is arming.</span>"
|
||||
return "The proximity sensor is [scanning ? "armed" : "disarmed"]."
|
||||
|
||||
/obj/item/assembly/prox_sensor/activate()
|
||||
if(!..())
|
||||
return FALSE //Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/prox_sensor/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
scanning = 0
|
||||
timing = 0
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/prox_sensor/HasProximity(atom/movable/AM)
|
||||
if(!isobj(AM) && !isliving(AM))
|
||||
return
|
||||
if(istype(AM, /obj/effect))
|
||||
return
|
||||
if(AM.move_speed < 12)
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/sense()
|
||||
if(!secured || !scanning || cooldown > 0)
|
||||
return FALSE
|
||||
pulse(0)
|
||||
visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
/obj/item/assembly/prox_sensor/process()
|
||||
if(timing && (time >= 0))
|
||||
time--
|
||||
if(timing && time <= 0)
|
||||
timing = 0
|
||||
toggle_scan()
|
||||
time = 10
|
||||
|
||||
/obj/item/assembly/prox_sensor/dropped()
|
||||
..()
|
||||
spawn(0)
|
||||
sense()
|
||||
return
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/toggle_scan()
|
||||
if(!secured)
|
||||
return FALSE
|
||||
scanning = !scanning
|
||||
update_icon()
|
||||
|
||||
/obj/item/assembly/prox_sensor/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "prox_timing"
|
||||
attached_overlays += "prox_timing"
|
||||
if(scanning)
|
||||
overlays += "prox_scanning"
|
||||
attached_overlays += "prox_scanning"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/prox_sensor/Move()
|
||||
..()
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/holder_movement()
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/interact(mob/user)//TODO: Change this to the wires thingy
|
||||
if(!secured)
|
||||
user.show_message("<span class='warning'>The [name] is unsecured!</span>")
|
||||
return FALSE
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = text("<TT><B>Proximity Sensor</B>\n[] []:[]\n<A href='?src=[UID()];tp=-30'>-</A> <A href='?src=[UID()];tp=-1'>-</A> <A href='?src=[UID()];tp=1'>+</A> <A href='?src=[UID()];tp=30'>+</A>\n</TT>", (timing ? "<A href='?src=[UID()];time=0'>Arming</A>" : "<A href='?src=[UID()];time=1'>Not Arming</A>"), minute, second)
|
||||
dat += "<BR><A href='?src=[UID()];scanning=1'>[scanning?"Armed":"Unarmed"]</A> (Movement sensor active when armed!)"
|
||||
dat += "<BR><BR><A href='?src=[UID()];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[UID()];close=1'>Close</A>"
|
||||
var/datum/browser/popup = new(user, "prox", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "prox")
|
||||
|
||||
/obj/item/assembly/prox_sensor/Topic(href, href_list)
|
||||
..()
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=prox")
|
||||
onclose(usr, "prox")
|
||||
return
|
||||
|
||||
if(href_list["scanning"])
|
||||
toggle_scan()
|
||||
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
update_icon()
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
time += tp
|
||||
time = min(max(round(time), 0), 600)
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=prox")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
/obj/item/assembly/shock_kit
|
||||
name = "electrohelmet assembly"
|
||||
desc = "This appears to be made from both an electropack and a helmet."
|
||||
icon = 'icons/obj/assemblies.dmi'
|
||||
icon_state = "shock_kit"
|
||||
var/obj/item/clothing/head/helmet/part1 = null
|
||||
var/obj/item/radio/electropack/part2 = null
|
||||
var/status = 0
|
||||
w_class = WEIGHT_CLASS_HUGE
|
||||
flags = CONDUCT
|
||||
|
||||
/obj/item/assembly/shock_kit/Destroy()
|
||||
QDEL_NULL(part1)
|
||||
QDEL_NULL(part2)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/shock_kit/attackby(obj/item/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/wrench) && !status)
|
||||
var/turf/T = loc
|
||||
if(ismob(T))
|
||||
T = T.loc
|
||||
part1.loc = T
|
||||
part2.loc = T
|
||||
part1.master = null
|
||||
part2.master = null
|
||||
part1 = null
|
||||
part2 = null
|
||||
qdel(src)
|
||||
return
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
status = !status
|
||||
to_chat(user, "<span class='notice'>[src] is now [status ? "secured" : "unsecured"]!</span>")
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/shock_kit/attack_self(mob/user as mob)
|
||||
part1.attack_self(user, status)
|
||||
part2.attack_self(user, status)
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/shock_kit/receive_signal()
|
||||
if(istype(loc, /obj/structure/chair/e_chair))
|
||||
var/obj/structure/chair/e_chair/C = loc
|
||||
C.shock()
|
||||
return
|
||||
/obj/item/assembly/shock_kit
|
||||
name = "electrohelmet assembly"
|
||||
desc = "This appears to be made from both an electropack and a helmet."
|
||||
icon = 'icons/obj/assemblies.dmi'
|
||||
icon_state = "shock_kit"
|
||||
var/obj/item/clothing/head/helmet/part1 = null
|
||||
var/obj/item/radio/electropack/part2 = null
|
||||
var/status = 0
|
||||
w_class = WEIGHT_CLASS_HUGE
|
||||
flags = CONDUCT
|
||||
|
||||
/obj/item/assembly/shock_kit/Destroy()
|
||||
QDEL_NULL(part1)
|
||||
QDEL_NULL(part2)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/shock_kit/attackby(obj/item/W as obj, mob/user as mob, params)
|
||||
if(istype(W, /obj/item/wrench) && !status)
|
||||
var/turf/T = loc
|
||||
if(ismob(T))
|
||||
T = T.loc
|
||||
part1.loc = T
|
||||
part2.loc = T
|
||||
part1.master = null
|
||||
part2.master = null
|
||||
part1 = null
|
||||
part2 = null
|
||||
qdel(src)
|
||||
return
|
||||
if(istype(W, /obj/item/screwdriver))
|
||||
status = !status
|
||||
to_chat(user, "<span class='notice'>[src] is now [status ? "secured" : "unsecured"]!</span>")
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/shock_kit/attack_self(mob/user as mob)
|
||||
part1.attack_self(user, status)
|
||||
part2.attack_self(user, status)
|
||||
add_fingerprint(user)
|
||||
return
|
||||
|
||||
/obj/item/assembly/shock_kit/receive_signal()
|
||||
if(istype(loc, /obj/structure/chair/e_chair))
|
||||
var/obj/structure/chair/e_chair/C = loc
|
||||
C.shock()
|
||||
return
|
||||
|
||||
+177
-177
@@ -1,177 +1,177 @@
|
||||
/obj/item/assembly/signaler
|
||||
name = "remote signaling device"
|
||||
desc = "Used to remotely activate devices."
|
||||
icon_state = "signaller"
|
||||
item_state = "signaler"
|
||||
materials = list(MAT_METAL=400, MAT_GLASS=120)
|
||||
origin_tech = "magnets=1;bluespace=1"
|
||||
wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE
|
||||
|
||||
secured = 1
|
||||
var/receiving = FALSE
|
||||
|
||||
bomb_name = "remote-control bomb"
|
||||
|
||||
var/code = 30
|
||||
var/frequency = RSD_FREQ
|
||||
var/delay = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
var/airlock_wire = null
|
||||
|
||||
/obj/item/assembly/signaler/New()
|
||||
..()
|
||||
if(SSradio)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/item/assembly/signaler/Initialize()
|
||||
..()
|
||||
if(SSradio)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/item/assembly/signaler/Destroy()
|
||||
if(SSradio)
|
||||
SSradio.remove_object(src, frequency)
|
||||
radio_connection = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/signaler/describe()
|
||||
return "[src]'s power light is [receiving ? "on" : "off"]"
|
||||
|
||||
/obj/item/assembly/signaler/activate()
|
||||
if(cooldown > 0)
|
||||
return FALSE
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
signal()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/update_icon()
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/interact(mob/user, flag1)
|
||||
var/t1 = "-------"
|
||||
var/dat = {"
|
||||
<TT>
|
||||
"}
|
||||
if(!flag1)
|
||||
dat += {"
|
||||
<A href='byond://?src=[UID()];send=1'>Send Signal</A><BR>
|
||||
Receiver is <A href='byond://?src=[UID()];receive=1'>[receiving?"on":"off"]</A><BR>
|
||||
"}
|
||||
dat += {"
|
||||
<B>Frequency/Code</B> for signaler:<BR>
|
||||
Frequency:
|
||||
<A href='byond://?src=[UID()];freq=-10'>-</A>
|
||||
<A href='byond://?src=[UID()];freq=-2'>-</A>
|
||||
[format_frequency(frequency)]
|
||||
<A href='byond://?src=[UID()];freq=2'>+</A>
|
||||
<A href='byond://?src=[UID()];freq=10'>+</A><BR>
|
||||
|
||||
Code:
|
||||
<A href='byond://?src=[UID()];code=-5'>-</A>
|
||||
<A href='byond://?src=[UID()];code=-1'>-</A>
|
||||
[code]
|
||||
<A href='byond://?src=[UID()];code=1'>+</A>
|
||||
<A href='byond://?src=[UID()];code=5'>+</A><BR>
|
||||
[t1]
|
||||
</TT>
|
||||
"}
|
||||
var/datum/browser/popup = new(user, "radio", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "radio")
|
||||
|
||||
/obj/item/assembly/signaler/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=radio")
|
||||
onclose(usr, "radio")
|
||||
return
|
||||
|
||||
if(href_list["freq"])
|
||||
var/new_frequency = (frequency + text2num(href_list["freq"]))
|
||||
if(new_frequency < RADIO_LOW_FREQ || new_frequency > RADIO_HIGH_FREQ)
|
||||
new_frequency = sanitize_frequency(new_frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ)
|
||||
set_frequency(new_frequency)
|
||||
|
||||
if(href_list["code"])
|
||||
code += text2num(href_list["code"])
|
||||
code = round(code)
|
||||
code = min(100, code)
|
||||
code = max(1, code)
|
||||
if(href_list["receive"])
|
||||
receiving = !receiving
|
||||
|
||||
if(href_list["send"])
|
||||
spawn( 0 )
|
||||
signal()
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/assembly/signaler/proc/signal()
|
||||
if(!radio_connection)
|
||||
return
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.source = src
|
||||
signal.encryption = code
|
||||
signal.data["message"] = "ACTIVATE"
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
var/time = time2text(world.realtime,"hh:mm:ss")
|
||||
var/turf/T = get_turf(src)
|
||||
if(usr)
|
||||
lastsignalers.Add("[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(frequency)]/[code]")
|
||||
|
||||
/obj/item/assembly/signaler/pulse(var/radio = FALSE)
|
||||
if(connected && wires)
|
||||
connected.Pulse(src)
|
||||
else
|
||||
return ..(radio)
|
||||
|
||||
/obj/item/assembly/signaler/receive_signal(datum/signal/signal)
|
||||
if(!receiving || !signal)
|
||||
return FALSE
|
||||
|
||||
if(signal.encryption != code)
|
||||
return FALSE
|
||||
|
||||
if(!(wires & WIRE_RADIO_RECEIVE))
|
||||
return FALSE
|
||||
pulse(1)
|
||||
|
||||
for(var/mob/O in hearers(1, loc))
|
||||
O.show_message("[bicon(src)] *beep* *beep*", 3, "*beep* *beep*", 2)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/proc/set_frequency(new_frequency)
|
||||
if(!SSradio)
|
||||
sleep(20)
|
||||
if(!SSradio)
|
||||
return
|
||||
SSradio.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = SSradio.add_object(src, frequency, RADIO_CHAT)
|
||||
|
||||
// Embedded signaller used in anomalies.
|
||||
/obj/item/assembly/signaler/anomaly
|
||||
name = "anomaly core"
|
||||
desc = "The neutralized core of an anomaly. It'd probably be valuable for research."
|
||||
icon_state = "anomaly core"
|
||||
item_state = "electronic"
|
||||
resistance_flags = FIRE_PROOF
|
||||
receiving = TRUE
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/receive_signal(datum/signal/signal)
|
||||
if(..())
|
||||
for(var/obj/effect/anomaly/A in orange(0, src))
|
||||
A.anomalyNeutralize()
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/attack_self()
|
||||
return
|
||||
/obj/item/assembly/signaler
|
||||
name = "remote signaling device"
|
||||
desc = "Used to remotely activate devices."
|
||||
icon_state = "signaller"
|
||||
item_state = "signaler"
|
||||
materials = list(MAT_METAL=400, MAT_GLASS=120)
|
||||
origin_tech = "magnets=1;bluespace=1"
|
||||
wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE
|
||||
|
||||
secured = 1
|
||||
var/receiving = FALSE
|
||||
|
||||
bomb_name = "remote-control bomb"
|
||||
|
||||
var/code = 30
|
||||
var/frequency = RSD_FREQ
|
||||
var/delay = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
var/airlock_wire = null
|
||||
|
||||
/obj/item/assembly/signaler/New()
|
||||
..()
|
||||
if(SSradio)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/item/assembly/signaler/Initialize()
|
||||
..()
|
||||
if(SSradio)
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/item/assembly/signaler/Destroy()
|
||||
if(SSradio)
|
||||
SSradio.remove_object(src, frequency)
|
||||
radio_connection = null
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/signaler/describe()
|
||||
return "[src]'s power light is [receiving ? "on" : "off"]"
|
||||
|
||||
/obj/item/assembly/signaler/activate()
|
||||
if(cooldown > 0)
|
||||
return FALSE
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
signal()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/update_icon()
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/interact(mob/user, flag1)
|
||||
var/t1 = "-------"
|
||||
var/dat = {"
|
||||
<TT>
|
||||
"}
|
||||
if(!flag1)
|
||||
dat += {"
|
||||
<A href='byond://?src=[UID()];send=1'>Send Signal</A><BR>
|
||||
Receiver is <A href='byond://?src=[UID()];receive=1'>[receiving?"on":"off"]</A><BR>
|
||||
"}
|
||||
dat += {"
|
||||
<B>Frequency/Code</B> for signaler:<BR>
|
||||
Frequency:
|
||||
<A href='byond://?src=[UID()];freq=-10'>-</A>
|
||||
<A href='byond://?src=[UID()];freq=-2'>-</A>
|
||||
[format_frequency(frequency)]
|
||||
<A href='byond://?src=[UID()];freq=2'>+</A>
|
||||
<A href='byond://?src=[UID()];freq=10'>+</A><BR>
|
||||
|
||||
Code:
|
||||
<A href='byond://?src=[UID()];code=-5'>-</A>
|
||||
<A href='byond://?src=[UID()];code=-1'>-</A>
|
||||
[code]
|
||||
<A href='byond://?src=[UID()];code=1'>+</A>
|
||||
<A href='byond://?src=[UID()];code=5'>+</A><BR>
|
||||
[t1]
|
||||
</TT>
|
||||
"}
|
||||
var/datum/browser/popup = new(user, "radio", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "radio")
|
||||
|
||||
/obj/item/assembly/signaler/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if(!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=radio")
|
||||
onclose(usr, "radio")
|
||||
return
|
||||
|
||||
if(href_list["freq"])
|
||||
var/new_frequency = (frequency + text2num(href_list["freq"]))
|
||||
if(new_frequency < RADIO_LOW_FREQ || new_frequency > RADIO_HIGH_FREQ)
|
||||
new_frequency = sanitize_frequency(new_frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ)
|
||||
set_frequency(new_frequency)
|
||||
|
||||
if(href_list["code"])
|
||||
code += text2num(href_list["code"])
|
||||
code = round(code)
|
||||
code = min(100, code)
|
||||
code = max(1, code)
|
||||
if(href_list["receive"])
|
||||
receiving = !receiving
|
||||
|
||||
if(href_list["send"])
|
||||
spawn( 0 )
|
||||
signal()
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/assembly/signaler/proc/signal()
|
||||
if(!radio_connection)
|
||||
return
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.source = src
|
||||
signal.encryption = code
|
||||
signal.data["message"] = "ACTIVATE"
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
var/time = time2text(world.realtime,"hh:mm:ss")
|
||||
var/turf/T = get_turf(src)
|
||||
if(usr)
|
||||
lastsignalers.Add("[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(frequency)]/[code]")
|
||||
|
||||
/obj/item/assembly/signaler/pulse(var/radio = FALSE)
|
||||
if(connected && wires)
|
||||
connected.Pulse(src)
|
||||
else
|
||||
return ..(radio)
|
||||
|
||||
/obj/item/assembly/signaler/receive_signal(datum/signal/signal)
|
||||
if(!receiving || !signal)
|
||||
return FALSE
|
||||
|
||||
if(signal.encryption != code)
|
||||
return FALSE
|
||||
|
||||
if(!(wires & WIRE_RADIO_RECEIVE))
|
||||
return FALSE
|
||||
pulse(1)
|
||||
|
||||
for(var/mob/O in hearers(1, loc))
|
||||
O.show_message("[bicon(src)] *beep* *beep*", 3, "*beep* *beep*", 2)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/proc/set_frequency(new_frequency)
|
||||
if(!SSradio)
|
||||
sleep(20)
|
||||
if(!SSradio)
|
||||
return
|
||||
SSradio.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = SSradio.add_object(src, frequency, RADIO_CHAT)
|
||||
|
||||
// Embedded signaller used in anomalies.
|
||||
/obj/item/assembly/signaler/anomaly
|
||||
name = "anomaly core"
|
||||
desc = "The neutralized core of an anomaly. It'd probably be valuable for research."
|
||||
icon_state = "anomaly core"
|
||||
item_state = "electronic"
|
||||
resistance_flags = FIRE_PROOF
|
||||
receiving = TRUE
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/receive_signal(datum/signal/signal)
|
||||
if(..())
|
||||
for(var/obj/effect/anomaly/A in orange(0, src))
|
||||
A.anomalyNeutralize()
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/attack_self()
|
||||
return
|
||||
|
||||
+127
-127
@@ -1,127 +1,127 @@
|
||||
/obj/item/assembly/timer
|
||||
name = "timer"
|
||||
desc = "Used to time things. Works well with contraptions which has to count down. Tick tock."
|
||||
icon_state = "timer"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
|
||||
secured = FALSE
|
||||
|
||||
bomb_name = "time bomb"
|
||||
|
||||
var/timing = FALSE
|
||||
var/time = 10
|
||||
var/repeat = FALSE
|
||||
var/set_time = 10
|
||||
|
||||
/obj/item/assembly/timer/describe()
|
||||
if(timing)
|
||||
return "The timer is counting down from [time]!"
|
||||
return "The timer is set for [time] seconds."
|
||||
|
||||
/obj/item/assembly/timer/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/timer/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
timing = FALSE
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/timer/proc/timer_end()
|
||||
if(!secured || cooldown > 0)
|
||||
return FALSE
|
||||
pulse(0)
|
||||
if(loc)
|
||||
loc.visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
/obj/item/assembly/timer/process()
|
||||
if(timing && (time > 0))
|
||||
time -= 2 // 2 seconds per process()
|
||||
if(timing && time <= 0)
|
||||
timing = repeat
|
||||
timer_end()
|
||||
time = set_time
|
||||
|
||||
/obj/item/assembly/timer/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "timer_timing"
|
||||
attached_overlays += "timer_timing"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/timer/interact(mob/user as mob)//TODO: Have this use the wires
|
||||
if(!secured)
|
||||
user.show_message("<span class='warning'>The [name] is unsecured!</span>")
|
||||
return FALSE
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/set_second = set_time % 60
|
||||
var/set_minute = (set_time - set_second) / 60
|
||||
if(second < 10) second = "0[second]"
|
||||
if(set_second < 10) set_second = "0[set_second]"
|
||||
|
||||
var/dat = {"
|
||||
<TT>
|
||||
<center><h2>Timing Unit</h2>
|
||||
[minute]:[second] <a href='?src=[UID()];time=1'>[timing?"Stop":"Start"]</a> <a href='?src=[UID()];reset=1'>Reset</a><br>
|
||||
Repeat: <a href='?src=[UID()];repeat=1'>[repeat?"On":"Off"]</a><br>
|
||||
Timer set for
|
||||
<A href='?src=[UID()];tp=-30'>-</A> <A href='?src=[UID()];tp=-1'>-</A> [set_minute]:[set_second] <A href='?src=[UID()];tp=1'>+</A> <A href='?src=[UID()];tp=30'>+</A>
|
||||
</center>
|
||||
</TT>
|
||||
<BR><BR>
|
||||
<A href='?src=[UID()];refresh=1'>Refresh</A>
|
||||
<BR><BR>
|
||||
<A href='?src=[UID()];close=1'>Close</A>"}
|
||||
var/datum/browser/popup = new(user, "timer", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "timer")
|
||||
|
||||
/obj/item/assembly/timer/Topic(href, href_list)
|
||||
..()
|
||||
if(usr.incapacitated() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=timer")
|
||||
onclose(usr, "timer")
|
||||
return
|
||||
|
||||
if(href_list["time"])
|
||||
timing = !timing
|
||||
if(timing && istype(holder, /obj/item/transfer_valve))
|
||||
message_admins("[key_name_admin(usr)] activated [src] attachment on [holder].")
|
||||
investigate_log("[key_name(usr)] activated [src] attachment for [loc]", INVESTIGATE_BOMB)
|
||||
log_game("[key_name(usr)] activated [src] attachment for [loc]")
|
||||
update_icon()
|
||||
if(href_list["reset"])
|
||||
time = set_time
|
||||
|
||||
if(href_list["repeat"])
|
||||
repeat = !repeat
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
set_time += tp
|
||||
set_time = min(max(round(set_time), 6), 600)
|
||||
if(!timing)
|
||||
time = set_time
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=timer")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
/obj/item/assembly/timer
|
||||
name = "timer"
|
||||
desc = "Used to time things. Works well with contraptions which has to count down. Tick tock."
|
||||
icon_state = "timer"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
|
||||
secured = FALSE
|
||||
|
||||
bomb_name = "time bomb"
|
||||
|
||||
var/timing = FALSE
|
||||
var/time = 10
|
||||
var/repeat = FALSE
|
||||
var/set_time = 10
|
||||
|
||||
/obj/item/assembly/timer/describe()
|
||||
if(timing)
|
||||
return "The timer is counting down from [time]!"
|
||||
return "The timer is set for [time] seconds."
|
||||
|
||||
/obj/item/assembly/timer/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return FALSE
|
||||
|
||||
/obj/item/assembly/timer/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
else
|
||||
timing = FALSE
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/timer/proc/timer_end()
|
||||
if(!secured || cooldown > 0)
|
||||
return FALSE
|
||||
pulse(0)
|
||||
if(loc)
|
||||
loc.visible_message("[bicon(src)] *beep* *beep*", "*beep* *beep*")
|
||||
cooldown = 2
|
||||
spawn(10)
|
||||
process_cooldown()
|
||||
|
||||
/obj/item/assembly/timer/process()
|
||||
if(timing && (time > 0))
|
||||
time -= 2 // 2 seconds per process()
|
||||
if(timing && time <= 0)
|
||||
timing = repeat
|
||||
timer_end()
|
||||
time = set_time
|
||||
|
||||
/obj/item/assembly/timer/update_icon()
|
||||
overlays.Cut()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
overlays += "timer_timing"
|
||||
attached_overlays += "timer_timing"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/timer/interact(mob/user as mob)//TODO: Have this use the wires
|
||||
if(!secured)
|
||||
user.show_message("<span class='warning'>The [name] is unsecured!</span>")
|
||||
return FALSE
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/set_second = set_time % 60
|
||||
var/set_minute = (set_time - set_second) / 60
|
||||
if(second < 10) second = "0[second]"
|
||||
if(set_second < 10) set_second = "0[set_second]"
|
||||
|
||||
var/dat = {"
|
||||
<TT>
|
||||
<center><h2>Timing Unit</h2>
|
||||
[minute]:[second] <a href='?src=[UID()];time=1'>[timing?"Stop":"Start"]</a> <a href='?src=[UID()];reset=1'>Reset</a><br>
|
||||
Repeat: <a href='?src=[UID()];repeat=1'>[repeat?"On":"Off"]</a><br>
|
||||
Timer set for
|
||||
<A href='?src=[UID()];tp=-30'>-</A> <A href='?src=[UID()];tp=-1'>-</A> [set_minute]:[set_second] <A href='?src=[UID()];tp=1'>+</A> <A href='?src=[UID()];tp=30'>+</A>
|
||||
</center>
|
||||
</TT>
|
||||
<BR><BR>
|
||||
<A href='?src=[UID()];refresh=1'>Refresh</A>
|
||||
<BR><BR>
|
||||
<A href='?src=[UID()];close=1'>Close</A>"}
|
||||
var/datum/browser/popup = new(user, "timer", name, 400, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
onclose(user, "timer")
|
||||
|
||||
/obj/item/assembly/timer/Topic(href, href_list)
|
||||
..()
|
||||
if(usr.incapacitated() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=timer")
|
||||
onclose(usr, "timer")
|
||||
return
|
||||
|
||||
if(href_list["time"])
|
||||
timing = !timing
|
||||
if(timing && istype(holder, /obj/item/transfer_valve))
|
||||
message_admins("[key_name_admin(usr)] activated [src] attachment on [holder].")
|
||||
investigate_log("[key_name(usr)] activated [src] attachment for [loc]", INVESTIGATE_BOMB)
|
||||
log_game("[key_name(usr)] activated [src] attachment for [loc]")
|
||||
update_icon()
|
||||
if(href_list["reset"])
|
||||
time = set_time
|
||||
|
||||
if(href_list["repeat"])
|
||||
repeat = !repeat
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
set_time += tp
|
||||
set_time = min(max(round(set_time), 6), 600)
|
||||
if(!timing)
|
||||
time = set_time
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=timer")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
@@ -74,4 +74,4 @@
|
||||
/obj/item/assembly/voice/noise/hear_message(mob/living/M as mob, msg)
|
||||
pulse(0)
|
||||
var/turf/T = get_turf(src) //otherwise it won't work in hand
|
||||
T.visible_message("<span class='warning'>[bicon(src)] beeps!</span>")
|
||||
T.visible_message("<span class='warning'>[bicon(src)] beeps!</span>")
|
||||
|
||||
Reference in New Issue
Block a user