Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into Ghommie-cit265
This commit is contained in:
+127
-127
@@ -1,127 +1,127 @@
|
||||
#define WIRE_RECEIVE (1<<0)
|
||||
#define WIRE_PULSE (1<<1)
|
||||
#define WIRE_PULSE_SPECIAL (1<<2)
|
||||
#define WIRE_RADIO_RECEIVE (1<<3)
|
||||
#define WIRE_RADIO_PULSE (1<<4)
|
||||
#define ASSEMBLY_BEEP_VOLUME 5
|
||||
|
||||
/obj/item/assembly
|
||||
name = "assembly"
|
||||
desc = "A small electronic device that should never exist."
|
||||
icon = 'icons/obj/assemblies/new_assemblies.dmi'
|
||||
icon_state = ""
|
||||
flags_1 = CONDUCT_1
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
materials = list(MAT_METAL=100)
|
||||
throwforce = 2
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
|
||||
var/is_position_sensitive = FALSE //set to true if the device has different icons for each position.
|
||||
//This will prevent things such as visible lasers from facing the incorrect direction when transformed by assembly_holder's update_icon()
|
||||
var/secured = TRUE
|
||||
var/list/attached_overlays = null
|
||||
var/obj/item/assembly_holder/holder = null
|
||||
var/wire_type = WIRE_RECEIVE | WIRE_PULSE
|
||||
var/attachable = FALSE // can this be attached to wires
|
||||
var/datum/wires/connected = null
|
||||
|
||||
var/next_activate = 0 //When we're next allowed to activate - for spam control
|
||||
var/activate_cooldown = 3 SECONDS
|
||||
|
||||
/obj/item/assembly/get_part_rating()
|
||||
return 1
|
||||
|
||||
/obj/item/assembly/proc/on_attach()
|
||||
|
||||
/obj/item/assembly/proc/on_detach() //call this when detaching it from a device. handles any special functions that need to be updated ex post facto
|
||||
if(!holder)
|
||||
return FALSE
|
||||
forceMove(holder.drop_location())
|
||||
holder = null
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/proc/holder_movement() //Called when the holder is moved
|
||||
if(!holder)
|
||||
return FALSE
|
||||
setDir(holder.dir)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/proc/is_secured(mob/user)
|
||||
if(!secured)
|
||||
to_chat(user, "<span class='warning'>The [name] is unsecured!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
//Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
/obj/item/assembly/proc/pulsed(radio = FALSE)
|
||||
if(wire_type & WIRE_RECEIVE)
|
||||
INVOKE_ASYNC(src, .proc/activate)
|
||||
if(radio && (wire_type & WIRE_RADIO_RECEIVE))
|
||||
INVOKE_ASYNC(src, .proc/activate)
|
||||
return TRUE
|
||||
|
||||
|
||||
//Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
|
||||
/obj/item/assembly/proc/pulse(radio = FALSE)
|
||||
if(connected && wire_type)
|
||||
connected.pulse_assembly(src)
|
||||
return TRUE
|
||||
if(holder && (wire_type & WIRE_PULSE))
|
||||
holder.process_activation(src, 1, 0)
|
||||
if(holder && (wire_type & WIRE_PULSE_SPECIAL))
|
||||
holder.process_activation(src, 0, 1)
|
||||
return TRUE
|
||||
|
||||
|
||||
// What the device does when turned on
|
||||
/obj/item/assembly/proc/activate()
|
||||
if(QDELETED(src) || !secured || (next_activate > world.time))
|
||||
return FALSE
|
||||
next_activate = world.time + activate_cooldown
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/proc/toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/assembly/attackby(obj/item/W, mob/user, params)
|
||||
if(isassembly(W))
|
||||
var/obj/item/assembly/A = W
|
||||
if((!A.secured) && (!secured))
|
||||
holder = new/obj/item/assembly_holder(get_turf(src))
|
||||
holder.assemble(src,A,user)
|
||||
to_chat(user, "<span class='notice'>You attach and secure \the [A] to \the [src]!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Both devices must be in attachable mode to be attached together.</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/assembly/screwdriver_act(mob/living/user, obj/item/I)
|
||||
if(..())
|
||||
return TRUE
|
||||
if(toggle_secure())
|
||||
to_chat(user, "<span class='notice'>\The [src] is ready!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>\The [src] can now be attached!</span>")
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>\The [src] [secured? "is secured and ready to be used!" : "can be attached to other things."]</span>"
|
||||
|
||||
|
||||
/obj/item/assembly/attack_self(mob/user)
|
||||
if(!user)
|
||||
return FALSE
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/interact(mob/user)
|
||||
return ui_interact(user)
|
||||
#define WIRE_RECEIVE (1<<0)
|
||||
#define WIRE_PULSE (1<<1)
|
||||
#define WIRE_PULSE_SPECIAL (1<<2)
|
||||
#define WIRE_RADIO_RECEIVE (1<<3)
|
||||
#define WIRE_RADIO_PULSE (1<<4)
|
||||
#define ASSEMBLY_BEEP_VOLUME 5
|
||||
|
||||
/obj/item/assembly
|
||||
name = "assembly"
|
||||
desc = "A small electronic device that should never exist."
|
||||
icon = 'icons/obj/assemblies/new_assemblies.dmi'
|
||||
icon_state = ""
|
||||
flags_1 = CONDUCT_1
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
materials = list(MAT_METAL=100)
|
||||
throwforce = 2
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
|
||||
var/is_position_sensitive = FALSE //set to true if the device has different icons for each position.
|
||||
//This will prevent things such as visible lasers from facing the incorrect direction when transformed by assembly_holder's update_icon()
|
||||
var/secured = TRUE
|
||||
var/list/attached_overlays = null
|
||||
var/obj/item/assembly_holder/holder = null
|
||||
var/wire_type = WIRE_RECEIVE | WIRE_PULSE
|
||||
var/attachable = FALSE // can this be attached to wires
|
||||
var/datum/wires/connected = null
|
||||
|
||||
var/next_activate = 0 //When we're next allowed to activate - for spam control
|
||||
var/activate_cooldown = 3 SECONDS
|
||||
|
||||
/obj/item/assembly/get_part_rating()
|
||||
return 1
|
||||
|
||||
/obj/item/assembly/proc/on_attach()
|
||||
|
||||
/obj/item/assembly/proc/on_detach() //call this when detaching it from a device. handles any special functions that need to be updated ex post facto
|
||||
if(!holder)
|
||||
return FALSE
|
||||
forceMove(holder.drop_location())
|
||||
holder = null
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/proc/holder_movement() //Called when the holder is moved
|
||||
if(!holder)
|
||||
return FALSE
|
||||
setDir(holder.dir)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/proc/is_secured(mob/user)
|
||||
if(!secured)
|
||||
to_chat(user, "<span class='warning'>The [name] is unsecured!</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
|
||||
//Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs
|
||||
/obj/item/assembly/proc/pulsed(radio = FALSE)
|
||||
if(wire_type & WIRE_RECEIVE)
|
||||
INVOKE_ASYNC(src, .proc/activate)
|
||||
if(radio && (wire_type & WIRE_RADIO_RECEIVE))
|
||||
INVOKE_ASYNC(src, .proc/activate)
|
||||
return TRUE
|
||||
|
||||
|
||||
//Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct
|
||||
/obj/item/assembly/proc/pulse(radio = FALSE)
|
||||
if(connected && wire_type)
|
||||
connected.pulse_assembly(src)
|
||||
return TRUE
|
||||
if(holder && (wire_type & WIRE_PULSE))
|
||||
holder.process_activation(src, 1, 0)
|
||||
if(holder && (wire_type & WIRE_PULSE_SPECIAL))
|
||||
holder.process_activation(src, 0, 1)
|
||||
return TRUE
|
||||
|
||||
|
||||
// What the device does when turned on
|
||||
/obj/item/assembly/proc/activate()
|
||||
if(QDELETED(src) || !secured || (next_activate > world.time))
|
||||
return FALSE
|
||||
next_activate = world.time + activate_cooldown
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/proc/toggle_secure()
|
||||
secured = !secured
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
/obj/item/assembly/attackby(obj/item/W, mob/user, params)
|
||||
if(isassembly(W))
|
||||
var/obj/item/assembly/A = W
|
||||
if((!A.secured) && (!secured))
|
||||
holder = new/obj/item/assembly_holder(get_turf(src))
|
||||
holder.assemble(src,A,user)
|
||||
to_chat(user, "<span class='notice'>You attach and secure \the [A] to \the [src]!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>Both devices must be in attachable mode to be attached together.</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/assembly/screwdriver_act(mob/living/user, obj/item/I)
|
||||
if(..())
|
||||
return TRUE
|
||||
if(toggle_secure())
|
||||
to_chat(user, "<span class='notice'>\The [src] is ready!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>\The [src] can now be attached!</span>")
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>\The [src] [secured? "is secured and ready to be used!" : "can be attached to other things."]</span>"
|
||||
|
||||
|
||||
/obj/item/assembly/attack_self(mob/user)
|
||||
if(!user)
|
||||
return FALSE
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/interact(mob/user)
|
||||
return ui_interact(user)
|
||||
|
||||
+202
-202
@@ -1,202 +1,202 @@
|
||||
/obj/item/onetankbomb
|
||||
name = "bomb"
|
||||
icon = 'icons/obj/tank.dmi'
|
||||
item_state = "assembly"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
throw_speed = 2
|
||||
throw_range = 4
|
||||
flags_1 = CONDUCT_1
|
||||
var/status = FALSE //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
|
||||
|
||||
/obj/item/onetankbomb/IsSpecialAssembly()
|
||||
return TRUE
|
||||
|
||||
/obj/item/onetankbomb/examine(mob/user)
|
||||
bombtank.examine(user)
|
||||
|
||||
/obj/item/onetankbomb/update_icon()
|
||||
cut_overlays()
|
||||
if(bombtank)
|
||||
icon = bombtank.icon
|
||||
icon_state = bombtank.icon_state
|
||||
if(bombassembly)
|
||||
add_overlay(bombassembly.icon_state)
|
||||
copy_overlays(bombassembly)
|
||||
add_overlay("bomb_assembly")
|
||||
|
||||
/obj/item/onetankbomb/wrench_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='notice'>You disassemble [src]!</span>")
|
||||
if(bombassembly)
|
||||
bombassembly.forceMove(drop_location())
|
||||
bombassembly.master = null
|
||||
bombassembly = null
|
||||
if(bombtank)
|
||||
bombtank.forceMove(drop_location())
|
||||
bombtank.master = null
|
||||
bombtank = null
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/item/onetankbomb/welder_act(mob/living/user, obj/item/I)
|
||||
. = FALSE
|
||||
if(status)
|
||||
to_chat(user, "<span class='notice'>[bombtank] already has a pressure hole!</span>")
|
||||
return
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return
|
||||
if(I.use_tool(src, user, 0, volume=40))
|
||||
status = TRUE
|
||||
GLOB.bombers += "[key_name(user)] welded a single tank bomb. Temp: [bombtank.air_contents.temperature-T0C]"
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] welded a single tank bomb. Temp: [bombtank.air_contents.temperature-T0C]")
|
||||
to_chat(user, "<span class='notice'>A pressure hole has been bored to [bombtank] valve. \The [bombtank] can now be ignited.</span>")
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/onetankbomb/analyzer_act(mob/living/user, obj/item/I)
|
||||
bombtank.analyzer_act(user, I)
|
||||
|
||||
/obj/item/onetankbomb/attack_self(mob/user) //pressing the bomb accesses its assembly
|
||||
bombassembly.attack_self(user, TRUE)
|
||||
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.
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*")
|
||||
playsound(src, 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
sleep(10)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
if(status)
|
||||
bombtank.ignite() //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()
|
||||
|
||||
//Assembly / attached device memes
|
||||
|
||||
/obj/item/onetankbomb/Crossed(atom/movable/AM as mob|obj) //for mousetraps
|
||||
. = ..()
|
||||
if(bombassembly)
|
||||
bombassembly.Crossed(AM)
|
||||
|
||||
/obj/item/onetankbomb/on_found(mob/finder) //for mousetraps
|
||||
if(bombassembly)
|
||||
bombassembly.on_found(finder)
|
||||
|
||||
/obj/item/onetankbomb/attack_hand() //also for mousetraps
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(bombassembly)
|
||||
bombassembly.attack_hand()
|
||||
|
||||
/obj/item/onetankbomb/Move()
|
||||
. = ..()
|
||||
if(bombassembly)
|
||||
bombassembly.setDir(dir)
|
||||
bombassembly.Move()
|
||||
|
||||
/obj/item/onetankbomb/dropped()
|
||||
. = ..()
|
||||
if(bombassembly)
|
||||
bombassembly.dropped()
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------- Procs below are for tanks that are used exclusively in 1-tank bombs ----------
|
||||
|
||||
//Bomb assembly proc. This turns assembly+tank into a bomb
|
||||
/obj/item/tank/proc/bomb_assemble(obj/item/assembly_holder/assembly, mob/living/user)
|
||||
//Check if either part of the assembly has an igniter, but if both parts are igniters, then fuck it
|
||||
if(isigniter(assembly.a_left) == isigniter(assembly.a_right))
|
||||
return
|
||||
|
||||
if((src in user.get_equipped_items(TRUE)) && !user.canUnEquip(src))
|
||||
to_chat(user, "<span class='warning'>[src] is stuck to you!</span>")
|
||||
return
|
||||
|
||||
if(!user.canUnEquip(assembly))
|
||||
to_chat(user, "<span class='warning'>[assembly] is stuck to your hand!</span>")
|
||||
return
|
||||
|
||||
var/obj/item/onetankbomb/bomb = new
|
||||
user.transferItemToLoc(src, bomb)
|
||||
user.transferItemToLoc(assembly, bomb)
|
||||
|
||||
bomb.bombassembly = assembly //Tell the bomb about its assembly part
|
||||
assembly.master = bomb //Tell the assembly about its new owner
|
||||
|
||||
bomb.bombtank = src //Same for tank
|
||||
master = bomb
|
||||
|
||||
forceMove(bomb)
|
||||
bomb.update_icon()
|
||||
|
||||
user.put_in_hands(bomb) //Equips the bomb if possible, or puts it on the floor.
|
||||
to_chat(user, "<span class='notice'>You attach [assembly] to [src].</span>")
|
||||
return
|
||||
|
||||
/obj/item/tank/proc/ignite() //This happens when a bomb is told to explode
|
||||
var/fuel_moles = air_contents.gases[/datum/gas/plasma] + air_contents.gases[/datum/gas/oxygen]/6
|
||||
GAS_GARBAGE_COLLECT(air_contents.gases)
|
||||
var/datum/gas_mixture/bomb_mixture = air_contents.copy()
|
||||
var/strength = 1
|
||||
|
||||
var/turf/ground_zero = get_turf(loc)
|
||||
|
||||
if(master)
|
||||
qdel(master)
|
||||
qdel(src)
|
||||
|
||||
if(bomb_mixture.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(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(bomb_mixture.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(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(bomb_mixture.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(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else
|
||||
ground_zero.assume_air(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
ground_zero.air_update_turf()
|
||||
|
||||
/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/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"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
throw_speed = 2
|
||||
throw_range = 4
|
||||
flags_1 = CONDUCT_1
|
||||
var/status = FALSE //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
|
||||
|
||||
/obj/item/onetankbomb/IsSpecialAssembly()
|
||||
return TRUE
|
||||
|
||||
/obj/item/onetankbomb/examine(mob/user)
|
||||
bombtank.examine(user)
|
||||
|
||||
/obj/item/onetankbomb/update_icon()
|
||||
cut_overlays()
|
||||
if(bombtank)
|
||||
icon = bombtank.icon
|
||||
icon_state = bombtank.icon_state
|
||||
if(bombassembly)
|
||||
add_overlay(bombassembly.icon_state)
|
||||
copy_overlays(bombassembly)
|
||||
add_overlay("bomb_assembly")
|
||||
|
||||
/obj/item/onetankbomb/wrench_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='notice'>You disassemble [src]!</span>")
|
||||
if(bombassembly)
|
||||
bombassembly.forceMove(drop_location())
|
||||
bombassembly.master = null
|
||||
bombassembly = null
|
||||
if(bombtank)
|
||||
bombtank.forceMove(drop_location())
|
||||
bombtank.master = null
|
||||
bombtank = null
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/item/onetankbomb/welder_act(mob/living/user, obj/item/I)
|
||||
. = FALSE
|
||||
if(status)
|
||||
to_chat(user, "<span class='notice'>[bombtank] already has a pressure hole!</span>")
|
||||
return
|
||||
if(!I.tool_start_check(user, amount=0))
|
||||
return
|
||||
if(I.use_tool(src, user, 0, volume=40))
|
||||
status = TRUE
|
||||
GLOB.bombers += "[key_name(user)] welded a single tank bomb. Temp: [bombtank.air_contents.temperature-T0C]"
|
||||
message_admins("[ADMIN_LOOKUPFLW(user)] welded a single tank bomb. Temp: [bombtank.air_contents.temperature-T0C]")
|
||||
to_chat(user, "<span class='notice'>A pressure hole has been bored to [bombtank] valve. \The [bombtank] can now be ignited.</span>")
|
||||
add_fingerprint(user)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/onetankbomb/analyzer_act(mob/living/user, obj/item/I)
|
||||
bombtank.analyzer_act(user, I)
|
||||
|
||||
/obj/item/onetankbomb/attack_self(mob/user) //pressing the bomb accesses its assembly
|
||||
bombassembly.attack_self(user, TRUE)
|
||||
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.
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*")
|
||||
playsound(src, 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
sleep(10)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
if(status)
|
||||
bombtank.ignite() //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()
|
||||
|
||||
//Assembly / attached device memes
|
||||
|
||||
/obj/item/onetankbomb/Crossed(atom/movable/AM as mob|obj) //for mousetraps
|
||||
. = ..()
|
||||
if(bombassembly)
|
||||
bombassembly.Crossed(AM)
|
||||
|
||||
/obj/item/onetankbomb/on_found(mob/finder) //for mousetraps
|
||||
if(bombassembly)
|
||||
bombassembly.on_found(finder)
|
||||
|
||||
/obj/item/onetankbomb/attack_hand() //also for mousetraps
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(bombassembly)
|
||||
bombassembly.attack_hand()
|
||||
|
||||
/obj/item/onetankbomb/Move()
|
||||
. = ..()
|
||||
if(bombassembly)
|
||||
bombassembly.setDir(dir)
|
||||
bombassembly.Move()
|
||||
|
||||
/obj/item/onetankbomb/dropped()
|
||||
. = ..()
|
||||
if(bombassembly)
|
||||
bombassembly.dropped()
|
||||
|
||||
|
||||
|
||||
|
||||
// ---------- Procs below are for tanks that are used exclusively in 1-tank bombs ----------
|
||||
|
||||
//Bomb assembly proc. This turns assembly+tank into a bomb
|
||||
/obj/item/tank/proc/bomb_assemble(obj/item/assembly_holder/assembly, mob/living/user)
|
||||
//Check if either part of the assembly has an igniter, but if both parts are igniters, then fuck it
|
||||
if(isigniter(assembly.a_left) == isigniter(assembly.a_right))
|
||||
return
|
||||
|
||||
if((src in user.get_equipped_items(TRUE)) && !user.canUnEquip(src))
|
||||
to_chat(user, "<span class='warning'>[src] is stuck to you!</span>")
|
||||
return
|
||||
|
||||
if(!user.canUnEquip(assembly))
|
||||
to_chat(user, "<span class='warning'>[assembly] is stuck to your hand!</span>")
|
||||
return
|
||||
|
||||
var/obj/item/onetankbomb/bomb = new
|
||||
user.transferItemToLoc(src, bomb)
|
||||
user.transferItemToLoc(assembly, bomb)
|
||||
|
||||
bomb.bombassembly = assembly //Tell the bomb about its assembly part
|
||||
assembly.master = bomb //Tell the assembly about its new owner
|
||||
|
||||
bomb.bombtank = src //Same for tank
|
||||
master = bomb
|
||||
|
||||
forceMove(bomb)
|
||||
bomb.update_icon()
|
||||
|
||||
user.put_in_hands(bomb) //Equips the bomb if possible, or puts it on the floor.
|
||||
to_chat(user, "<span class='notice'>You attach [assembly] to [src].</span>")
|
||||
return
|
||||
|
||||
/obj/item/tank/proc/ignite() //This happens when a bomb is told to explode
|
||||
var/fuel_moles = air_contents.gases[/datum/gas/plasma] + air_contents.gases[/datum/gas/oxygen]/6
|
||||
GAS_GARBAGE_COLLECT(air_contents.gases)
|
||||
var/datum/gas_mixture/bomb_mixture = air_contents.copy()
|
||||
var/strength = 1
|
||||
|
||||
var/turf/ground_zero = get_turf(loc)
|
||||
|
||||
if(master)
|
||||
qdel(master)
|
||||
qdel(src)
|
||||
|
||||
if(bomb_mixture.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(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(bomb_mixture.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(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else if(bomb_mixture.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(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
else
|
||||
ground_zero.assume_air(bomb_mixture)
|
||||
ground_zero.hotspot_expose(1000, 125)
|
||||
|
||||
ground_zero.air_update_turf()
|
||||
|
||||
/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/T = get_turf(src)
|
||||
if(!T)
|
||||
return
|
||||
T.assume_air(removed)
|
||||
air_update_turf()
|
||||
|
||||
+365
-365
@@ -1,365 +1,365 @@
|
||||
#define CONFUSION_STACK_MAX_MULTIPLIER 2
|
||||
/obj/item/assembly/flash
|
||||
name = "flash"
|
||||
desc = "A powerful and versatile flashbulb device, with applications ranging from disorienting attackers to acting as visual receptors in robot production."
|
||||
icon_state = "flash"
|
||||
item_state = "flashtool"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'
|
||||
throwforce = 0
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
materials = list(MAT_METAL = 300, MAT_GLASS = 300)
|
||||
crit_fail = FALSE //Is the flash burnt out?
|
||||
light_color = LIGHT_COLOR_WHITE
|
||||
light_power = FLASH_LIGHT_POWER
|
||||
var/flashing_overlay = "flash-f"
|
||||
var/times_used = 0 //Number of times it's been used.
|
||||
var/burnout_resistance = 0
|
||||
var/last_used = 0 //last world.time it was used.
|
||||
var/cooldown = 0
|
||||
var/last_trigger = 0 //Last time it was successfully triggered.
|
||||
|
||||
/obj/item/assembly/flash/suicide_act(mob/living/user)
|
||||
if (crit_fail)
|
||||
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but its burnt out!</span>")
|
||||
return SHAME
|
||||
else if (user.eye_blind)
|
||||
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but [user.p_theyre()] blind!</span>")
|
||||
return SHAME
|
||||
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
attack(user,user)
|
||||
return FIRELOSS
|
||||
|
||||
/obj/item/assembly/flash/update_icon(flash = FALSE)
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(crit_fail)
|
||||
add_overlay("flashburnt")
|
||||
attached_overlays += "flashburnt"
|
||||
if(flash)
|
||||
add_overlay(flashing_overlay)
|
||||
attached_overlays += flashing_overlay
|
||||
addtimer(CALLBACK(src, /atom/.proc/update_icon), 5)
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/flash/proc/clown_check(mob/living/carbon/human/user)
|
||||
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
|
||||
flash_carbon(user, user, 15, 0)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/proc/burn_out() //Made so you can override it if you want to have an invincible flash from R&D or something.
|
||||
if(!crit_fail)
|
||||
crit_fail = TRUE
|
||||
update_icon()
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.visible_message("<span class='danger'>[src] burns out!</span>","<span class='userdanger'>[src] burns out!</span>")
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
T.visible_message("<span class='danger'>[src] burns out!</span>")
|
||||
|
||||
/obj/item/assembly/flash/proc/flash_recharge(interval = 10)
|
||||
var/deciseconds_passed = world.time - last_used
|
||||
for(var/seconds = deciseconds_passed / 10, seconds >= interval, seconds -= interval) //get 1 charge every interval
|
||||
times_used--
|
||||
last_used = world.time
|
||||
times_used = max(0, times_used) //sanity
|
||||
if(max(0, prob(times_used * 3) - burnout_resistance)) //The more often it's used in a short span of time the more likely it will burn out
|
||||
burn_out()
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
//BYPASS CHECKS ALSO PREVENTS BURNOUT!
|
||||
/obj/item/assembly/flash/proc/AOE_flash(bypass_checks = FALSE, range = 3, power = 5, targeted = FALSE, mob/user)
|
||||
if(!bypass_checks && !try_use_flash())
|
||||
return FALSE
|
||||
var/list/mob/targets = get_flash_targets(get_turf(src), range, FALSE)
|
||||
if(user)
|
||||
targets -= user
|
||||
for(var/mob/living/carbon/C in targets)
|
||||
flash_carbon(C, user, power, targeted, TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/proc/get_flash_targets(atom/target_loc, range = 3, override_vision_checks = FALSE)
|
||||
if(!target_loc)
|
||||
target_loc = loc
|
||||
if(override_vision_checks)
|
||||
return get_hearers_in_view(range, get_turf(target_loc))
|
||||
if(isturf(target_loc) || (ismob(target_loc) && isturf(target_loc.loc)))
|
||||
return viewers(range, get_turf(target_loc))
|
||||
else
|
||||
return typecache_filter_list(target_loc.GetAllContents(), GLOB.typecache_living)
|
||||
|
||||
/obj/item/assembly/flash/proc/try_use_flash(mob/user = null)
|
||||
if(crit_fail || (world.time < last_trigger + cooldown))
|
||||
return FALSE
|
||||
last_trigger = world.time
|
||||
playsound(src, 'sound/weapons/flash.ogg', 100, TRUE)
|
||||
flash_lighting_fx(FLASH_LIGHT_RANGE, light_power, light_color)
|
||||
times_used++
|
||||
flash_recharge()
|
||||
update_icon(TRUE)
|
||||
if(user && !clown_check(user))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/proc/flash_carbon(mob/living/carbon/M, mob/user, power = 15, targeted = TRUE, generic_message = FALSE)
|
||||
if(!istype(M))
|
||||
return
|
||||
if(user)
|
||||
log_combat(user, M, "[targeted? "flashed(targeted)" : "flashed(AOE)"]", src)
|
||||
else //caused by emp/remote signal
|
||||
M.log_message("was [targeted? "flashed(targeted)" : "flashed(AOE)"]",LOG_ATTACK)
|
||||
if(generic_message && M != user)
|
||||
to_chat(M, "<span class='disarm'>[src] emits a blinding light!</span>")
|
||||
if(targeted)
|
||||
if(M.flash_act(1, 1))
|
||||
if(M.confused < power)
|
||||
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
|
||||
M.confused += min(power, diff)
|
||||
if(user)
|
||||
terrible_conversion_proc(M, user)
|
||||
visible_message("<span class='disarm'>[user] blinds [M] with the flash!</span>")
|
||||
to_chat(user, "<span class='danger'>You blind [M] with the flash!</span>")
|
||||
to_chat(M, "<span class='userdanger'>[user] blinds you with the flash!</span>")
|
||||
else
|
||||
to_chat(M, "<span class='userdanger'>You are blinded by [src]!</span>")
|
||||
var/toblur = 20 - M.eye_blurry
|
||||
if(toblur > 0)
|
||||
M.blur_eyes(toblur)
|
||||
else if(user)
|
||||
visible_message("<span class='disarm'>[user] fails to blind [M] with the flash!</span>")
|
||||
to_chat(user, "<span class='warning'>You fail to blind [M] with the flash!</span>")
|
||||
to_chat(M, "<span class='danger'>[user] fails to blind you with the flash!</span>")
|
||||
else
|
||||
to_chat(M, "<span class='danger'>[src] fails to blind you!</span>")
|
||||
else
|
||||
if(M.flash_act())
|
||||
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
|
||||
M.confused += min(power, diff)
|
||||
|
||||
/obj/item/assembly/flash/attack(mob/living/M, mob/user)
|
||||
if(!try_use_flash(user))
|
||||
return FALSE
|
||||
if(iscarbon(M))
|
||||
flash_carbon(M, user, 20, 1)
|
||||
return TRUE
|
||||
else if(issilicon(M))
|
||||
var/mob/living/silicon/robot/R = M
|
||||
log_combat(user, R, "flashed", src)
|
||||
update_icon(1)
|
||||
R.Knockdown(rand(80,120))
|
||||
var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
|
||||
R.confused += min(5, diff)
|
||||
R.flash_act(affect_silicon = 1)
|
||||
user.visible_message("<span class='disarm'>[user] overloads [R]'s sensors with the flash!</span>", "<span class='danger'>You overload [R]'s sensors with the flash!</span>")
|
||||
return TRUE
|
||||
|
||||
user.visible_message("<span class='disarm'>[user] fails to blind [M] with the flash!</span>", "<span class='warning'>You fail to blind [M] with the flash!</span>")
|
||||
|
||||
/obj/item/assembly/flash/attack_self(mob/living/carbon/user, flag = 0, emp = 0)
|
||||
if(holder)
|
||||
return FALSE
|
||||
if(!AOE_flash(FALSE, 3, 5, FALSE, user))
|
||||
return FALSE
|
||||
to_chat(user, "<span class='danger'>[src] emits a blinding light!</span>")
|
||||
|
||||
/obj/item/assembly/flash/emp_act(severity)
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
if(!try_use_flash())
|
||||
return
|
||||
AOE_flash()
|
||||
burn_out()
|
||||
|
||||
/obj/item/assembly/flash/activate()//AOE flash on signal received
|
||||
if(!..())
|
||||
return
|
||||
AOE_flash()
|
||||
|
||||
/obj/item/assembly/flash/proc/terrible_conversion_proc(mob/living/carbon/human/H, mob/user)
|
||||
if(istype(H) && ishuman(user) && H.stat != DEAD)
|
||||
if(user.mind)
|
||||
var/datum/antagonist/rev/head/converter = user.mind.has_antag_datum(/datum/antagonist/rev/head)
|
||||
if(!converter)
|
||||
return
|
||||
if(!H.client)
|
||||
to_chat(user, "<span class='warning'>This mind is so vacant that it is not susceptible to influence!</span>")
|
||||
return
|
||||
if(H.stat != CONSCIOUS)
|
||||
to_chat(user, "<span class='warning'>They must be conscious before you can convert [H.p_them()]!</span>")
|
||||
return
|
||||
if(converter.add_revolutionary(H.mind))
|
||||
times_used -- //Flashes less likely to burn out for headrevs when used for conversion
|
||||
else
|
||||
to_chat(user, "<span class='warning'>This mind seems resistant to the flash!</span>")
|
||||
|
||||
|
||||
/obj/item/assembly/flash/cyborg
|
||||
|
||||
/obj/item/assembly/flash/cyborg/attack(mob/living/M, mob/user)
|
||||
. = ..()
|
||||
new /obj/effect/temp_visual/borgflash(get_turf(src))
|
||||
if(. && !CONFIG_GET(flag/disable_borg_flash_knockdown) && iscarbon(M) && !M.resting && !M.get_eye_protection())
|
||||
M.Knockdown(80)
|
||||
|
||||
/obj/item/assembly/flash/cyborg/attack_self(mob/user)
|
||||
..()
|
||||
new /obj/effect/temp_visual/borgflash(get_turf(src))
|
||||
|
||||
/obj/item/assembly/flash/cyborg/attackby(obj/item/W, mob/user, params)
|
||||
return
|
||||
/obj/item/assembly/flash/cyborg/screwdriver_act(mob/living/user, obj/item/I)
|
||||
return
|
||||
|
||||
/obj/item/assembly/flash/memorizer
|
||||
name = "memorizer"
|
||||
desc = "If you see this, you're not likely to remember it any time soon."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "memorizer"
|
||||
item_state = "nullrod"
|
||||
|
||||
/obj/item/assembly/flash/handheld //this is now the regular pocket flashes
|
||||
|
||||
/obj/item/assembly/flash/armimplant
|
||||
name = "photon projector"
|
||||
desc = "A high-powered photon projector implant normally used for lighting purposes, but also doubles as a flashbulb weapon. Self-repair protocols fix the flashbulb if it ever burns out."
|
||||
var/flashcd = 20
|
||||
var/overheat = 0
|
||||
var/obj/item/organ/cyberimp/arm/flash/I = null
|
||||
|
||||
/obj/item/assembly/flash/armimplant/burn_out()
|
||||
if(I && I.owner)
|
||||
to_chat(I.owner, "<span class='warning'>Your photon projector implant overheats and deactivates!</span>")
|
||||
I.Retract()
|
||||
overheat = TRUE
|
||||
addtimer(CALLBACK(src, .proc/cooldown), flashcd * 2)
|
||||
|
||||
/obj/item/assembly/flash/armimplant/try_use_flash(mob/user = null)
|
||||
if(overheat)
|
||||
if(I && I.owner)
|
||||
to_chat(I.owner, "<span class='warning'>Your photon projector is running too hot to be used again so quickly!</span>")
|
||||
return FALSE
|
||||
overheat = TRUE
|
||||
addtimer(CALLBACK(src, .proc/cooldown), flashcd)
|
||||
playsound(src, 'sound/weapons/flash.ogg', 100, TRUE)
|
||||
update_icon(1)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/flash/armimplant/proc/cooldown()
|
||||
overheat = FALSE
|
||||
|
||||
/obj/item/assembly/flash/shield
|
||||
name = "strobe shield"
|
||||
desc = "A shield with a built in, high intensity light capable of blinding and disorienting suspects. Takes regular handheld flashes as bulbs."
|
||||
icon = 'icons/obj/items_and_weapons.dmi'
|
||||
icon_state = "flashshield"
|
||||
item_state = "flashshield"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi'
|
||||
slot_flags = ITEM_SLOT_BACK
|
||||
force = 10
|
||||
throwforce = 5
|
||||
throw_speed = 2
|
||||
throw_range = 3
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
materials = list(MAT_GLASS=7500, MAT_METAL=1000)
|
||||
attack_verb = list("shoved", "bashed")
|
||||
block_chance = 50
|
||||
armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 0, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 70)
|
||||
|
||||
/obj/item/assembly/flash/shield/flash_recharge(interval=10)
|
||||
if(times_used >= 4)
|
||||
burn_out()
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/shield/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/assembly/flash/handheld))
|
||||
var/obj/item/assembly/flash/handheld/flash = W
|
||||
if(flash.crit_fail)
|
||||
to_chat(user, "No sense replacing it with a broken bulb.")
|
||||
return
|
||||
else
|
||||
to_chat(user, "You begin to replace the bulb.")
|
||||
if(do_after(user, 20, target = src))
|
||||
if(flash.crit_fail || !flash || QDELETED(flash))
|
||||
return
|
||||
crit_fail = FALSE
|
||||
times_used = 0
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
update_icon()
|
||||
flash.crit_fail = TRUE
|
||||
flash.update_icon()
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/assembly/flash/shield/update_icon(flash = FALSE)
|
||||
icon_state = "flashshield"
|
||||
item_state = "flashshield"
|
||||
|
||||
if(crit_fail)
|
||||
icon_state = "riot"
|
||||
item_state = "riot"
|
||||
else if(flash)
|
||||
icon_state = "flashshield_flash"
|
||||
item_state = "flashshield_flash"
|
||||
addtimer(CALLBACK(src, /atom/.proc/update_icon), 5)
|
||||
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/flash/shield/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
|
||||
activate()
|
||||
return ..()
|
||||
|
||||
//ported from tg - check to make sure it can't appear where it's not supposed to.
|
||||
/obj/item/assembly/flash/hypnotic
|
||||
desc = "A modified flash device, programmed to emit a sequence of subliminal flashes that can send a vulnerable target into a hypnotic trance."
|
||||
flashing_overlay = "flash-hypno" //I cannot find this icon no matter how hard I look in tg, so I might just make my own.
|
||||
light_color = LIGHT_COLOR_PINK
|
||||
cooldown = 20
|
||||
|
||||
/obj/item/assembly/flash/hypnotic/burn_out()
|
||||
return
|
||||
|
||||
/obj/item/assembly/flash/hypnotic/flash_carbon(mob/living/carbon/M, mob/user, power = 15, targeted = TRUE, generic_message = FALSE)
|
||||
if(!istype(M))
|
||||
return
|
||||
if(user)
|
||||
log_combat(user, M, "[targeted? "hypno-flashed(targeted)" : "hypno-flashed(AOE)"]", src)
|
||||
else //caused by emp/remote signal
|
||||
M.log_message("was [targeted? "hypno-flashed(targeted)" : "hypno-flashed(AOE)"]",LOG_ATTACK)
|
||||
if(generic_message && M != user)
|
||||
to_chat(M, "<span class='disarm'>[src] emits a soothing light...</span>")
|
||||
if(targeted)
|
||||
if(M.flash_act(1, 1))
|
||||
var/hypnosis = FALSE
|
||||
if(M.hypnosis_vulnerable())
|
||||
hypnosis = TRUE
|
||||
if(user)
|
||||
user.visible_message("<span class='disarm'>[user] blinds [M] with the flash!</span>", "<span class='danger'>You hypno-flash [M]!</span>")
|
||||
|
||||
if(!hypnosis)
|
||||
to_chat(M, "<span class='notice'>The light makes you feel oddly relaxed...</span>")
|
||||
M.confused += min(M.confused + 10, 20)
|
||||
M.dizziness += min(M.dizziness + 10, 20)
|
||||
M.drowsyness += min(M.drowsyness + 10, 20)
|
||||
M.apply_status_effect(STATUS_EFFECT_PACIFY, 100)
|
||||
else
|
||||
M.apply_status_effect(/datum/status_effect/trance, 200, TRUE)
|
||||
|
||||
else if(user)
|
||||
user.visible_message("<span class='disarm'>[user] fails to blind [M] with the flash!</span>", "<span class='warning'>You fail to hypno-flash [M]!</span>")
|
||||
else
|
||||
to_chat(M, "<span class='danger'>[src] fails to blind you!</span>")
|
||||
|
||||
else if(M.flash_act())
|
||||
to_chat(M, "<span class='notice'>Such a pretty light...</span>")
|
||||
M.confused += min(M.confused + 4, 20)
|
||||
M.dizziness += min(M.dizziness + 4, 20)
|
||||
M.drowsyness += min(M.drowsyness + 4, 20)
|
||||
#define CONFUSION_STACK_MAX_MULTIPLIER 2
|
||||
/obj/item/assembly/flash
|
||||
name = "flash"
|
||||
desc = "A powerful and versatile flashbulb device, with applications ranging from disorienting attackers to acting as visual receptors in robot production."
|
||||
icon_state = "flash"
|
||||
item_state = "flashtool"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/security_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/security_righthand.dmi'
|
||||
throwforce = 0
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
materials = list(MAT_METAL = 300, MAT_GLASS = 300)
|
||||
crit_fail = FALSE //Is the flash burnt out?
|
||||
light_color = LIGHT_COLOR_WHITE
|
||||
light_power = FLASH_LIGHT_POWER
|
||||
var/flashing_overlay = "flash-f"
|
||||
var/times_used = 0 //Number of times it's been used.
|
||||
var/burnout_resistance = 0
|
||||
var/last_used = 0 //last world.time it was used.
|
||||
var/cooldown = 0
|
||||
var/last_trigger = 0 //Last time it was successfully triggered.
|
||||
|
||||
/obj/item/assembly/flash/suicide_act(mob/living/user)
|
||||
if (crit_fail)
|
||||
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but its burnt out!</span>")
|
||||
return SHAME
|
||||
else if (user.eye_blind)
|
||||
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it ... but [user.p_theyre()] blind!</span>")
|
||||
return SHAME
|
||||
user.visible_message("<span class='suicide'>[user] raises \the [src] up to [user.p_their()] eyes and activates it! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
attack(user,user)
|
||||
return FIRELOSS
|
||||
|
||||
/obj/item/assembly/flash/update_icon(flash = FALSE)
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(crit_fail)
|
||||
add_overlay("flashburnt")
|
||||
attached_overlays += "flashburnt"
|
||||
if(flash)
|
||||
add_overlay(flashing_overlay)
|
||||
attached_overlays += flashing_overlay
|
||||
addtimer(CALLBACK(src, /atom/.proc/update_icon), 5)
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/flash/proc/clown_check(mob/living/carbon/human/user)
|
||||
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
|
||||
flash_carbon(user, user, 15, 0)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/proc/burn_out() //Made so you can override it if you want to have an invincible flash from R&D or something.
|
||||
if(!crit_fail)
|
||||
crit_fail = TRUE
|
||||
update_icon()
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.visible_message("<span class='danger'>[src] burns out!</span>","<span class='userdanger'>[src] burns out!</span>")
|
||||
else
|
||||
var/turf/T = get_turf(src)
|
||||
T.visible_message("<span class='danger'>[src] burns out!</span>")
|
||||
|
||||
/obj/item/assembly/flash/proc/flash_recharge(interval = 10)
|
||||
var/deciseconds_passed = world.time - last_used
|
||||
for(var/seconds = deciseconds_passed / 10, seconds >= interval, seconds -= interval) //get 1 charge every interval
|
||||
times_used--
|
||||
last_used = world.time
|
||||
times_used = max(0, times_used) //sanity
|
||||
if(max(0, prob(times_used * 3) - burnout_resistance)) //The more often it's used in a short span of time the more likely it will burn out
|
||||
burn_out()
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
//BYPASS CHECKS ALSO PREVENTS BURNOUT!
|
||||
/obj/item/assembly/flash/proc/AOE_flash(bypass_checks = FALSE, range = 3, power = 5, targeted = FALSE, mob/user)
|
||||
if(!bypass_checks && !try_use_flash())
|
||||
return FALSE
|
||||
var/list/mob/targets = get_flash_targets(get_turf(src), range, FALSE)
|
||||
if(user)
|
||||
targets -= user
|
||||
for(var/mob/living/carbon/C in targets)
|
||||
flash_carbon(C, user, power, targeted, TRUE)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/proc/get_flash_targets(atom/target_loc, range = 3, override_vision_checks = FALSE)
|
||||
if(!target_loc)
|
||||
target_loc = loc
|
||||
if(override_vision_checks)
|
||||
return get_hearers_in_view(range, get_turf(target_loc))
|
||||
if(isturf(target_loc) || (ismob(target_loc) && isturf(target_loc.loc)))
|
||||
return viewers(range, get_turf(target_loc))
|
||||
else
|
||||
return typecache_filter_list(target_loc.GetAllContents(), GLOB.typecache_living)
|
||||
|
||||
/obj/item/assembly/flash/proc/try_use_flash(mob/user = null)
|
||||
if(crit_fail || (world.time < last_trigger + cooldown))
|
||||
return FALSE
|
||||
last_trigger = world.time
|
||||
playsound(src, 'sound/weapons/flash.ogg', 100, TRUE)
|
||||
flash_lighting_fx(FLASH_LIGHT_RANGE, light_power, light_color)
|
||||
times_used++
|
||||
flash_recharge()
|
||||
update_icon(TRUE)
|
||||
if(user && !clown_check(user))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/proc/flash_carbon(mob/living/carbon/M, mob/user, power = 15, targeted = TRUE, generic_message = FALSE)
|
||||
if(!istype(M))
|
||||
return
|
||||
if(user)
|
||||
log_combat(user, M, "[targeted? "flashed(targeted)" : "flashed(AOE)"]", src)
|
||||
else //caused by emp/remote signal
|
||||
M.log_message("was [targeted? "flashed(targeted)" : "flashed(AOE)"]",LOG_ATTACK)
|
||||
if(generic_message && M != user)
|
||||
to_chat(M, "<span class='disarm'>[src] emits a blinding light!</span>")
|
||||
if(targeted)
|
||||
if(M.flash_act(1, 1))
|
||||
if(M.confused < power)
|
||||
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
|
||||
M.confused += min(power, diff)
|
||||
if(user)
|
||||
terrible_conversion_proc(M, user)
|
||||
visible_message("<span class='disarm'>[user] blinds [M] with the flash!</span>")
|
||||
to_chat(user, "<span class='danger'>You blind [M] with the flash!</span>")
|
||||
to_chat(M, "<span class='userdanger'>[user] blinds you with the flash!</span>")
|
||||
else
|
||||
to_chat(M, "<span class='userdanger'>You are blinded by [src]!</span>")
|
||||
var/toblur = 20 - M.eye_blurry
|
||||
if(toblur > 0)
|
||||
M.blur_eyes(toblur)
|
||||
else if(user)
|
||||
visible_message("<span class='disarm'>[user] fails to blind [M] with the flash!</span>")
|
||||
to_chat(user, "<span class='warning'>You fail to blind [M] with the flash!</span>")
|
||||
to_chat(M, "<span class='danger'>[user] fails to blind you with the flash!</span>")
|
||||
else
|
||||
to_chat(M, "<span class='danger'>[src] fails to blind you!</span>")
|
||||
else
|
||||
if(M.flash_act())
|
||||
var/diff = power * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
|
||||
M.confused += min(power, diff)
|
||||
|
||||
/obj/item/assembly/flash/attack(mob/living/M, mob/user)
|
||||
if(!try_use_flash(user))
|
||||
return FALSE
|
||||
if(iscarbon(M))
|
||||
flash_carbon(M, user, 20, 1)
|
||||
return TRUE
|
||||
else if(issilicon(M))
|
||||
var/mob/living/silicon/robot/R = M
|
||||
log_combat(user, R, "flashed", src)
|
||||
update_icon(1)
|
||||
R.Knockdown(rand(80,120))
|
||||
var/diff = 5 * CONFUSION_STACK_MAX_MULTIPLIER - M.confused
|
||||
R.confused += min(5, diff)
|
||||
R.flash_act(affect_silicon = 1)
|
||||
user.visible_message("<span class='disarm'>[user] overloads [R]'s sensors with the flash!</span>", "<span class='danger'>You overload [R]'s sensors with the flash!</span>")
|
||||
return TRUE
|
||||
|
||||
user.visible_message("<span class='disarm'>[user] fails to blind [M] with the flash!</span>", "<span class='warning'>You fail to blind [M] with the flash!</span>")
|
||||
|
||||
/obj/item/assembly/flash/attack_self(mob/living/carbon/user, flag = 0, emp = 0)
|
||||
if(holder)
|
||||
return FALSE
|
||||
if(!AOE_flash(FALSE, 3, 5, FALSE, user))
|
||||
return FALSE
|
||||
to_chat(user, "<span class='danger'>[src] emits a blinding light!</span>")
|
||||
|
||||
/obj/item/assembly/flash/emp_act(severity)
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
if(!try_use_flash())
|
||||
return
|
||||
AOE_flash()
|
||||
burn_out()
|
||||
|
||||
/obj/item/assembly/flash/activate()//AOE flash on signal received
|
||||
if(!..())
|
||||
return
|
||||
AOE_flash()
|
||||
|
||||
/obj/item/assembly/flash/proc/terrible_conversion_proc(mob/living/carbon/human/H, mob/user)
|
||||
if(istype(H) && ishuman(user) && H.stat != DEAD)
|
||||
if(user.mind)
|
||||
var/datum/antagonist/rev/head/converter = user.mind.has_antag_datum(/datum/antagonist/rev/head)
|
||||
if(!converter)
|
||||
return
|
||||
if(!H.client)
|
||||
to_chat(user, "<span class='warning'>This mind is so vacant that it is not susceptible to influence!</span>")
|
||||
return
|
||||
if(H.stat != CONSCIOUS)
|
||||
to_chat(user, "<span class='warning'>They must be conscious before you can convert [H.p_them()]!</span>")
|
||||
return
|
||||
if(converter.add_revolutionary(H.mind))
|
||||
times_used -- //Flashes less likely to burn out for headrevs when used for conversion
|
||||
else
|
||||
to_chat(user, "<span class='warning'>This mind seems resistant to the flash!</span>")
|
||||
|
||||
|
||||
/obj/item/assembly/flash/cyborg
|
||||
|
||||
/obj/item/assembly/flash/cyborg/attack(mob/living/M, mob/user)
|
||||
. = ..()
|
||||
new /obj/effect/temp_visual/borgflash(get_turf(src))
|
||||
if(. && !CONFIG_GET(flag/disable_borg_flash_knockdown) && iscarbon(M) && !M.resting && !M.get_eye_protection())
|
||||
M.Knockdown(80)
|
||||
|
||||
/obj/item/assembly/flash/cyborg/attack_self(mob/user)
|
||||
..()
|
||||
new /obj/effect/temp_visual/borgflash(get_turf(src))
|
||||
|
||||
/obj/item/assembly/flash/cyborg/attackby(obj/item/W, mob/user, params)
|
||||
return
|
||||
/obj/item/assembly/flash/cyborg/screwdriver_act(mob/living/user, obj/item/I)
|
||||
return
|
||||
|
||||
/obj/item/assembly/flash/memorizer
|
||||
name = "memorizer"
|
||||
desc = "If you see this, you're not likely to remember it any time soon."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "memorizer"
|
||||
item_state = "nullrod"
|
||||
|
||||
/obj/item/assembly/flash/handheld //this is now the regular pocket flashes
|
||||
|
||||
/obj/item/assembly/flash/armimplant
|
||||
name = "photon projector"
|
||||
desc = "A high-powered photon projector implant normally used for lighting purposes, but also doubles as a flashbulb weapon. Self-repair protocols fix the flashbulb if it ever burns out."
|
||||
var/flashcd = 20
|
||||
var/overheat = 0
|
||||
var/obj/item/organ/cyberimp/arm/flash/I = null
|
||||
|
||||
/obj/item/assembly/flash/armimplant/burn_out()
|
||||
if(I && I.owner)
|
||||
to_chat(I.owner, "<span class='warning'>Your photon projector implant overheats and deactivates!</span>")
|
||||
I.Retract()
|
||||
overheat = TRUE
|
||||
addtimer(CALLBACK(src, .proc/cooldown), flashcd * 2)
|
||||
|
||||
/obj/item/assembly/flash/armimplant/try_use_flash(mob/user = null)
|
||||
if(overheat)
|
||||
if(I && I.owner)
|
||||
to_chat(I.owner, "<span class='warning'>Your photon projector is running too hot to be used again so quickly!</span>")
|
||||
return FALSE
|
||||
overheat = TRUE
|
||||
addtimer(CALLBACK(src, .proc/cooldown), flashcd)
|
||||
playsound(src, 'sound/weapons/flash.ogg', 100, TRUE)
|
||||
update_icon(1)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/flash/armimplant/proc/cooldown()
|
||||
overheat = FALSE
|
||||
|
||||
/obj/item/assembly/flash/shield
|
||||
name = "strobe shield"
|
||||
desc = "A shield with a built in, high intensity light capable of blinding and disorienting suspects. Takes regular handheld flashes as bulbs."
|
||||
icon = 'icons/obj/items_and_weapons.dmi'
|
||||
icon_state = "flashshield"
|
||||
item_state = "flashshield"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/shields_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/equipment/shields_righthand.dmi'
|
||||
slot_flags = ITEM_SLOT_BACK
|
||||
force = 10
|
||||
throwforce = 5
|
||||
throw_speed = 2
|
||||
throw_range = 3
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
materials = list(MAT_GLASS=7500, MAT_METAL=1000)
|
||||
attack_verb = list("shoved", "bashed")
|
||||
block_chance = 50
|
||||
armor = list("melee" = 50, "bullet" = 50, "laser" = 50, "energy" = 0, "bomb" = 30, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 70)
|
||||
|
||||
/obj/item/assembly/flash/shield/flash_recharge(interval=10)
|
||||
if(times_used >= 4)
|
||||
burn_out()
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/flash/shield/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/assembly/flash/handheld))
|
||||
var/obj/item/assembly/flash/handheld/flash = W
|
||||
if(flash.crit_fail)
|
||||
to_chat(user, "No sense replacing it with a broken bulb.")
|
||||
return
|
||||
else
|
||||
to_chat(user, "You begin to replace the bulb.")
|
||||
if(do_after(user, 20, target = src))
|
||||
if(flash.crit_fail || !flash || QDELETED(flash))
|
||||
return
|
||||
crit_fail = FALSE
|
||||
times_used = 0
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
update_icon()
|
||||
flash.crit_fail = TRUE
|
||||
flash.update_icon()
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/assembly/flash/shield/update_icon(flash = FALSE)
|
||||
icon_state = "flashshield"
|
||||
item_state = "flashshield"
|
||||
|
||||
if(crit_fail)
|
||||
icon_state = "riot"
|
||||
item_state = "riot"
|
||||
else if(flash)
|
||||
icon_state = "flashshield_flash"
|
||||
item_state = "flashshield_flash"
|
||||
addtimer(CALLBACK(src, /atom/.proc/update_icon), 5)
|
||||
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
/obj/item/assembly/flash/shield/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
|
||||
activate()
|
||||
return ..()
|
||||
|
||||
//ported from tg - check to make sure it can't appear where it's not supposed to.
|
||||
/obj/item/assembly/flash/hypnotic
|
||||
desc = "A modified flash device, programmed to emit a sequence of subliminal flashes that can send a vulnerable target into a hypnotic trance."
|
||||
flashing_overlay = "flash-hypno" //I cannot find this icon no matter how hard I look in tg, so I might just make my own.
|
||||
light_color = LIGHT_COLOR_PINK
|
||||
cooldown = 20
|
||||
|
||||
/obj/item/assembly/flash/hypnotic/burn_out()
|
||||
return
|
||||
|
||||
/obj/item/assembly/flash/hypnotic/flash_carbon(mob/living/carbon/M, mob/user, power = 15, targeted = TRUE, generic_message = FALSE)
|
||||
if(!istype(M))
|
||||
return
|
||||
if(user)
|
||||
log_combat(user, M, "[targeted? "hypno-flashed(targeted)" : "hypno-flashed(AOE)"]", src)
|
||||
else //caused by emp/remote signal
|
||||
M.log_message("was [targeted? "hypno-flashed(targeted)" : "hypno-flashed(AOE)"]",LOG_ATTACK)
|
||||
if(generic_message && M != user)
|
||||
to_chat(M, "<span class='disarm'>[src] emits a soothing light...</span>")
|
||||
if(targeted)
|
||||
if(M.flash_act(1, 1))
|
||||
var/hypnosis = FALSE
|
||||
if(M.hypnosis_vulnerable())
|
||||
hypnosis = TRUE
|
||||
if(user)
|
||||
user.visible_message("<span class='disarm'>[user] blinds [M] with the flash!</span>", "<span class='danger'>You hypno-flash [M]!</span>")
|
||||
|
||||
if(!hypnosis)
|
||||
to_chat(M, "<span class='notice'>The light makes you feel oddly relaxed...</span>")
|
||||
M.confused += min(M.confused + 10, 20)
|
||||
M.dizziness += min(M.dizziness + 10, 20)
|
||||
M.drowsyness += min(M.drowsyness + 10, 20)
|
||||
M.apply_status_effect(STATUS_EFFECT_PACIFY, 100)
|
||||
else
|
||||
M.apply_status_effect(/datum/status_effect/trance, 200, TRUE)
|
||||
|
||||
else if(user)
|
||||
user.visible_message("<span class='disarm'>[user] fails to blind [M] with the flash!</span>", "<span class='warning'>You fail to hypno-flash [M]!</span>")
|
||||
else
|
||||
to_chat(M, "<span class='danger'>[src] fails to blind you!</span>")
|
||||
|
||||
else if(M.flash_act())
|
||||
to_chat(M, "<span class='notice'>Such a pretty light...</span>")
|
||||
M.confused += min(M.confused + 4, 20)
|
||||
M.dizziness += min(M.dizziness + 4, 20)
|
||||
M.drowsyness += min(M.drowsyness + 4, 20)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// See _DEFINES/is_helpers.dm for type helpers
|
||||
|
||||
/*
|
||||
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 FALSE
|
||||
|
||||
/*
|
||||
Name: IsAssemblyHolder
|
||||
Desc: If true is an object that can hold an assemblyholder object
|
||||
*/
|
||||
/obj/proc/IsAssemblyHolder()
|
||||
// See _DEFINES/is_helpers.dm for type helpers
|
||||
|
||||
/*
|
||||
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 FALSE
|
||||
|
||||
/*
|
||||
Name: IsAssemblyHolder
|
||||
Desc: If true is an object that can hold an assemblyholder object
|
||||
*/
|
||||
/obj/proc/IsAssemblyHolder()
|
||||
return FALSE
|
||||
+139
-139
@@ -1,139 +1,139 @@
|
||||
/obj/item/assembly_holder
|
||||
name = "Assembly"
|
||||
icon = 'icons/obj/assemblies/new_assemblies.dmi'
|
||||
icon_state = "holder"
|
||||
item_state = "assembly"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
flags_1 = CONDUCT_1
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
throw_speed = 2
|
||||
throw_range = 7
|
||||
|
||||
var/obj/item/assembly/a_left = null
|
||||
var/obj/item/assembly/a_right = null
|
||||
|
||||
/obj/item/assembly_holder/IsAssemblyHolder()
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly_holder/proc/assemble(obj/item/assembly/A, obj/item/assembly/A2, mob/user)
|
||||
attach(A,user)
|
||||
attach(A2,user)
|
||||
name = "[A.name]-[A2.name] assembly"
|
||||
update_icon()
|
||||
SSblackbox.record_feedback("tally", "assembly_made", 1, "[initial(A.name)]-[initial(A2.name)]")
|
||||
|
||||
/obj/item/assembly_holder/proc/attach(obj/item/assembly/A, mob/user)
|
||||
if(!A.remove_item_from_storage(src))
|
||||
if(user)
|
||||
user.transferItemToLoc(A, src)
|
||||
else
|
||||
A.forceMove(src)
|
||||
A.holder = src
|
||||
A.toggle_secure()
|
||||
if(!a_left)
|
||||
a_left = A
|
||||
else
|
||||
a_right = A
|
||||
A.holder_movement()
|
||||
|
||||
/obj/item/assembly_holder/update_icon()
|
||||
cut_overlays()
|
||||
if(a_left)
|
||||
add_overlay("[a_left.icon_state]_left")
|
||||
for(var/O in a_left.attached_overlays)
|
||||
add_overlay("[O]_l")
|
||||
|
||||
if(a_right)
|
||||
if(a_right.is_position_sensitive)
|
||||
add_overlay("[a_right.icon_state]_right")
|
||||
for(var/O in a_right.attached_overlays)
|
||||
add_overlay("[O]_r")
|
||||
else
|
||||
var/mutable_appearance/right = mutable_appearance(icon, "[a_right.icon_state]_left")
|
||||
right.transform = matrix(-1, 0, 0, 0, 1, 0)
|
||||
for(var/O in a_right.attached_overlays)
|
||||
right.add_overlay("[O]_l")
|
||||
add_overlay(right)
|
||||
|
||||
if(master)
|
||||
master.update_icon()
|
||||
|
||||
/obj/item/assembly_holder/Crossed(atom/movable/AM as mob|obj)
|
||||
if(a_left)
|
||||
a_left.Crossed(AM)
|
||||
if(a_right)
|
||||
a_right.Crossed(AM)
|
||||
|
||||
/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/Move()
|
||||
. = ..()
|
||||
if(a_left)
|
||||
a_left.holder_movement()
|
||||
if(a_right)
|
||||
a_right.holder_movement()
|
||||
|
||||
/obj/item/assembly_holder/dropped(mob/user)
|
||||
. = ..()
|
||||
if(a_left)
|
||||
a_left.dropped()
|
||||
if(a_right)
|
||||
a_right.dropped()
|
||||
|
||||
/obj/item/assembly_holder/attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(a_left)
|
||||
a_left.attack_hand()
|
||||
if(a_right)
|
||||
a_right.attack_hand()
|
||||
|
||||
/obj/item/assembly_holder/screwdriver_act(mob/user, obj/item/tool)
|
||||
if(..())
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You disassemble [src]!</span>")
|
||||
if(a_left)
|
||||
a_left.on_detach()
|
||||
a_left = null
|
||||
if(a_right)
|
||||
a_right.on_detach()
|
||||
a_right = null
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly_holder/attack_self(mob/user)
|
||||
src.add_fingerprint(user)
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='danger'>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)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/proc/process_activation(obj/D, normal = 1, special = 1)
|
||||
if(!D)
|
||||
return FALSE
|
||||
if((normal) && (a_right) && (a_left))
|
||||
if(a_right != D)
|
||||
a_right.pulsed(FALSE)
|
||||
if(a_left != D)
|
||||
a_left.pulsed(FALSE)
|
||||
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"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
flags_1 = CONDUCT_1
|
||||
throwforce = 5
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
throw_speed = 2
|
||||
throw_range = 7
|
||||
|
||||
var/obj/item/assembly/a_left = null
|
||||
var/obj/item/assembly/a_right = null
|
||||
|
||||
/obj/item/assembly_holder/IsAssemblyHolder()
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly_holder/proc/assemble(obj/item/assembly/A, obj/item/assembly/A2, mob/user)
|
||||
attach(A,user)
|
||||
attach(A2,user)
|
||||
name = "[A.name]-[A2.name] assembly"
|
||||
update_icon()
|
||||
SSblackbox.record_feedback("tally", "assembly_made", 1, "[initial(A.name)]-[initial(A2.name)]")
|
||||
|
||||
/obj/item/assembly_holder/proc/attach(obj/item/assembly/A, mob/user)
|
||||
if(!A.remove_item_from_storage(src))
|
||||
if(user)
|
||||
user.transferItemToLoc(A, src)
|
||||
else
|
||||
A.forceMove(src)
|
||||
A.holder = src
|
||||
A.toggle_secure()
|
||||
if(!a_left)
|
||||
a_left = A
|
||||
else
|
||||
a_right = A
|
||||
A.holder_movement()
|
||||
|
||||
/obj/item/assembly_holder/update_icon()
|
||||
cut_overlays()
|
||||
if(a_left)
|
||||
add_overlay("[a_left.icon_state]_left")
|
||||
for(var/O in a_left.attached_overlays)
|
||||
add_overlay("[O]_l")
|
||||
|
||||
if(a_right)
|
||||
if(a_right.is_position_sensitive)
|
||||
add_overlay("[a_right.icon_state]_right")
|
||||
for(var/O in a_right.attached_overlays)
|
||||
add_overlay("[O]_r")
|
||||
else
|
||||
var/mutable_appearance/right = mutable_appearance(icon, "[a_right.icon_state]_left")
|
||||
right.transform = matrix(-1, 0, 0, 0, 1, 0)
|
||||
for(var/O in a_right.attached_overlays)
|
||||
right.add_overlay("[O]_l")
|
||||
add_overlay(right)
|
||||
|
||||
if(master)
|
||||
master.update_icon()
|
||||
|
||||
/obj/item/assembly_holder/Crossed(atom/movable/AM as mob|obj)
|
||||
if(a_left)
|
||||
a_left.Crossed(AM)
|
||||
if(a_right)
|
||||
a_right.Crossed(AM)
|
||||
|
||||
/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/Move()
|
||||
. = ..()
|
||||
if(a_left)
|
||||
a_left.holder_movement()
|
||||
if(a_right)
|
||||
a_right.holder_movement()
|
||||
|
||||
/obj/item/assembly_holder/dropped(mob/user)
|
||||
. = ..()
|
||||
if(a_left)
|
||||
a_left.dropped()
|
||||
if(a_right)
|
||||
a_right.dropped()
|
||||
|
||||
/obj/item/assembly_holder/attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(a_left)
|
||||
a_left.attack_hand()
|
||||
if(a_right)
|
||||
a_right.attack_hand()
|
||||
|
||||
/obj/item/assembly_holder/screwdriver_act(mob/user, obj/item/tool)
|
||||
if(..())
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You disassemble [src]!</span>")
|
||||
if(a_left)
|
||||
a_left.on_detach()
|
||||
a_left = null
|
||||
if(a_right)
|
||||
a_right.on_detach()
|
||||
a_right = null
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly_holder/attack_self(mob/user)
|
||||
src.add_fingerprint(user)
|
||||
if(!a_left || !a_right)
|
||||
to_chat(user, "<span class='danger'>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)
|
||||
|
||||
|
||||
/obj/item/assembly_holder/proc/process_activation(obj/D, normal = 1, special = 1)
|
||||
if(!D)
|
||||
return FALSE
|
||||
if((normal) && (a_right) && (a_left))
|
||||
if(a_right != D)
|
||||
a_right.pulsed(FALSE)
|
||||
if(a_left != D)
|
||||
a_left.pulsed(FALSE)
|
||||
if(master)
|
||||
master.receive_signal()
|
||||
return TRUE
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
/obj/item/assembly/igniter
|
||||
name = "igniter"
|
||||
desc = "A small electronic device able to ignite combustible substances."
|
||||
icon_state = "igniter"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
|
||||
heat = 1000
|
||||
|
||||
/obj/item/assembly/igniter/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] is trying to ignite [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.IgniteMob()
|
||||
return FIRELOSS
|
||||
|
||||
/obj/item/assembly/igniter/New()
|
||||
..()
|
||||
sparks.set_up(2, 0, src)
|
||||
sparks.attach(src)
|
||||
|
||||
/obj/item/assembly/igniter/Destroy()
|
||||
qdel(sparks)
|
||||
sparks = null
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/igniter/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
var/turf/location = get_turf(loc)
|
||||
if(location)
|
||||
location.hotspot_expose(700,10)
|
||||
sparks.start()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/igniter/attack_self(mob/user)
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/item/assembly/igniter/ignition_effect(atom/A, mob/user)
|
||||
. = "<span class='notice'>[user] fiddles with [src], and manages to \
|
||||
light [A].</span>"
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
/obj/item/assembly/igniter
|
||||
name = "igniter"
|
||||
desc = "A small electronic device able to ignite combustible substances."
|
||||
icon_state = "igniter"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
var/datum/effect_system/spark_spread/sparks = new /datum/effect_system/spark_spread
|
||||
heat = 1000
|
||||
|
||||
/obj/item/assembly/igniter/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] is trying to ignite [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
||||
user.IgniteMob()
|
||||
return FIRELOSS
|
||||
|
||||
/obj/item/assembly/igniter/New()
|
||||
..()
|
||||
sparks.set_up(2, 0, src)
|
||||
sparks.attach(src)
|
||||
|
||||
/obj/item/assembly/igniter/Destroy()
|
||||
qdel(sparks)
|
||||
sparks = null
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/igniter/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
var/turf/location = get_turf(loc)
|
||||
if(location)
|
||||
location.hotspot_expose(700,10)
|
||||
sparks.start()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/igniter/attack_self(mob/user)
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/item/assembly/igniter/ignition_effect(atom/A, mob/user)
|
||||
. = "<span class='notice'>[user] fiddles with [src], and manages to \
|
||||
light [A].</span>"
|
||||
activate()
|
||||
add_fingerprint(user)
|
||||
|
||||
+239
-239
@@ -1,239 +1,239 @@
|
||||
/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)
|
||||
is_position_sensitive = TRUE
|
||||
|
||||
var/on = FALSE
|
||||
var/visible = FALSE
|
||||
var/maxlength = 8
|
||||
var/list/obj/effect/beam/i_beam/beams
|
||||
var/olddir = 0
|
||||
var/turf/listeningTo
|
||||
var/hearing_range = 3
|
||||
|
||||
/obj/item/assembly/infra/Initialize()
|
||||
. = ..()
|
||||
beams = list()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/infra/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(
|
||||
/datum/component/simple_rotation,
|
||||
ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_FLIP | ROTATION_VERBS,
|
||||
null,
|
||||
null,
|
||||
CALLBACK(src,.proc/after_rotation)
|
||||
)
|
||||
|
||||
/obj/item/assembly/infra/proc/after_rotation()
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
listeningTo = null
|
||||
QDEL_LIST(beams)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/infra/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The infrared trigger is [on?"on":"off"].</span>"
|
||||
|
||||
/obj/item/assembly/infra/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
on = !on
|
||||
refreshBeam()
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/infra/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
refreshBeam()
|
||||
else
|
||||
QDEL_LIST(beams)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/infra/update_icon()
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(on)
|
||||
add_overlay("infrared_on")
|
||||
attached_overlays += "infrared_on"
|
||||
if(visible && secured)
|
||||
add_overlay("infrared_visible")
|
||||
attached_overlays += "infrared_visible"
|
||||
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/infra/dropped()
|
||||
. = ..()
|
||||
if(holder)
|
||||
holder_movement() //sync the dir of the device as well if it's contained in a TTV or an assembly holder
|
||||
else
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/process()
|
||||
if(!on || !secured)
|
||||
refreshBeam()
|
||||
return
|
||||
|
||||
/obj/item/assembly/infra/proc/refreshBeam()
|
||||
QDEL_LIST(beams)
|
||||
if(throwing || !on || !secured)
|
||||
return
|
||||
if(holder)
|
||||
if(holder.master) //incase the sensor is part of an assembly that's contained in another item, such as a single tank bomb
|
||||
if(!holder.master.IsSpecialAssembly() || !isturf(holder.master.loc))
|
||||
return
|
||||
else if(!isturf(holder.loc)) //else just check where the holder is
|
||||
return
|
||||
else if(!isturf(loc)) //or just where the fuck we are in general
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
var/_dir = dir
|
||||
var/turf/_T = get_step(T, _dir)
|
||||
if(_T)
|
||||
for(var/i in 1 to maxlength)
|
||||
var/obj/effect/beam/i_beam/I = new(T)
|
||||
if(istype(holder, /obj/item/assembly_holder))
|
||||
var/obj/item/assembly_holder/assembly_holder = holder
|
||||
I.icon_state = "[initial(I.icon_state)]_[(assembly_holder.a_left == src) ? "l":"r"]" //Sync the offset of the beam with the position of the sensor.
|
||||
else if(istype(holder, /obj/item/transfer_valve))
|
||||
I.icon_state = "[initial(I.icon_state)]_ttv"
|
||||
I.density = TRUE
|
||||
if(!I.Move(_T))
|
||||
qdel(I)
|
||||
switchListener(_T)
|
||||
break
|
||||
I.density = FALSE
|
||||
beams += I
|
||||
I.master = src
|
||||
I.setDir(_dir)
|
||||
I.invisibility = visible? 0 : INVISIBILITY_ABSTRACT
|
||||
T = _T
|
||||
_T = get_step(_T, _dir)
|
||||
CHECK_TICK
|
||||
|
||||
/obj/item/assembly/infra/on_detach()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/attack_hand()
|
||||
. = ..()
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/Moved()
|
||||
var/t = dir
|
||||
. = ..()
|
||||
setDir(t)
|
||||
|
||||
/obj/item/assembly/infra/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback)
|
||||
. = ..()
|
||||
olddir = dir
|
||||
|
||||
/obj/item/assembly/infra/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
||||
. = ..()
|
||||
if(!olddir)
|
||||
return
|
||||
setDir(olddir)
|
||||
olddir = null
|
||||
|
||||
/obj/item/assembly/infra/proc/trigger_beam(atom/movable/AM, turf/location)
|
||||
refreshBeam()
|
||||
switchListener(location)
|
||||
if(!secured || !on || next_activate > world.time)
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
next_activate = world.time + 30
|
||||
|
||||
/obj/item/assembly/infra/proc/switchListener(turf/newloc)
|
||||
if(listeningTo == newloc)
|
||||
return
|
||||
if(listeningTo)
|
||||
UnregisterSignal(listeningTo, COMSIG_ATOM_EXITED)
|
||||
RegisterSignal(newloc, COMSIG_ATOM_EXITED, .proc/check_exit)
|
||||
listeningTo = newloc
|
||||
|
||||
/obj/item/assembly/infra/proc/check_exit(datum/source, atom/movable/offender)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
if(offender == src || istype(offender,/obj/effect/beam/i_beam))
|
||||
return
|
||||
if (offender && isitem(offender))
|
||||
var/obj/item/I = offender
|
||||
if (I.item_flags & ABSTRACT)
|
||||
return
|
||||
return refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/ui_interact(mob/user)//TODO: change this this to the wire control panel
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
user.set_machine(src)
|
||||
var/dat = "<TT><B>Infrared Laser</B></TT>"
|
||||
dat += "<BR><B>Status</B>: [on ? "<A href='?src=[REF(src)];state=0'>On</A>" : "<A href='?src=[REF(src)];state=1'>Off</A>"]"
|
||||
dat += "<BR><B>Visibility</B>: [visible ? "<A href='?src=[REF(src)];visible=0'>Visible</A>" : "<A href='?src=[REF(src)];visible=1'>Invisible</A>"]"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
user << browse(dat, "window=infra")
|
||||
onclose(user, "infra")
|
||||
return
|
||||
|
||||
/obj/item/assembly/infra/Topic(href, href_list)
|
||||
..()
|
||||
if(usr.incapacitated() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=infra")
|
||||
onclose(usr, "infra")
|
||||
return
|
||||
if(href_list["state"])
|
||||
on = !(on)
|
||||
update_icon()
|
||||
refreshBeam()
|
||||
if(href_list["visible"])
|
||||
visible = !(visible)
|
||||
update_icon()
|
||||
refreshBeam()
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/assembly/infra/setDir()
|
||||
. = ..()
|
||||
refreshBeam()
|
||||
|
||||
/***************************IBeam*********************************/
|
||||
|
||||
/obj/effect/beam/i_beam
|
||||
name = "infrared beam"
|
||||
icon = 'icons/obj/projectiles.dmi'
|
||||
icon_state = "ibeam"
|
||||
var/obj/item/assembly/infra/master
|
||||
anchored = TRUE
|
||||
density = FALSE
|
||||
pass_flags = PASSTABLE|PASSGLASS|PASSGRILLE|LETPASSTHROW
|
||||
|
||||
/obj/effect/beam/i_beam/Crossed(atom/movable/AM as mob|obj)
|
||||
if(istype(AM, /obj/effect/beam))
|
||||
return
|
||||
if (isitem(AM))
|
||||
var/obj/item/I = AM
|
||||
if (I.item_flags & ABSTRACT)
|
||||
return
|
||||
master.trigger_beam(AM, get_turf(src))
|
||||
/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)
|
||||
is_position_sensitive = TRUE
|
||||
|
||||
var/on = FALSE
|
||||
var/visible = FALSE
|
||||
var/maxlength = 8
|
||||
var/list/obj/effect/beam/i_beam/beams
|
||||
var/olddir = 0
|
||||
var/turf/listeningTo
|
||||
var/hearing_range = 3
|
||||
|
||||
/obj/item/assembly/infra/Initialize()
|
||||
. = ..()
|
||||
beams = list()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/infra/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(
|
||||
/datum/component/simple_rotation,
|
||||
ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_FLIP | ROTATION_VERBS,
|
||||
null,
|
||||
null,
|
||||
CALLBACK(src,.proc/after_rotation)
|
||||
)
|
||||
|
||||
/obj/item/assembly/infra/proc/after_rotation()
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
listeningTo = null
|
||||
QDEL_LIST(beams)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/infra/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The infrared trigger is [on?"on":"off"].</span>"
|
||||
|
||||
/obj/item/assembly/infra/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
on = !on
|
||||
refreshBeam()
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/infra/toggle_secure()
|
||||
secured = !secured
|
||||
if(secured)
|
||||
START_PROCESSING(SSobj, src)
|
||||
refreshBeam()
|
||||
else
|
||||
QDEL_LIST(beams)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
/obj/item/assembly/infra/update_icon()
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(on)
|
||||
add_overlay("infrared_on")
|
||||
attached_overlays += "infrared_on"
|
||||
if(visible && secured)
|
||||
add_overlay("infrared_visible")
|
||||
attached_overlays += "infrared_visible"
|
||||
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/infra/dropped()
|
||||
. = ..()
|
||||
if(holder)
|
||||
holder_movement() //sync the dir of the device as well if it's contained in a TTV or an assembly holder
|
||||
else
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/process()
|
||||
if(!on || !secured)
|
||||
refreshBeam()
|
||||
return
|
||||
|
||||
/obj/item/assembly/infra/proc/refreshBeam()
|
||||
QDEL_LIST(beams)
|
||||
if(throwing || !on || !secured)
|
||||
return
|
||||
if(holder)
|
||||
if(holder.master) //incase the sensor is part of an assembly that's contained in another item, such as a single tank bomb
|
||||
if(!holder.master.IsSpecialAssembly() || !isturf(holder.master.loc))
|
||||
return
|
||||
else if(!isturf(holder.loc)) //else just check where the holder is
|
||||
return
|
||||
else if(!isturf(loc)) //or just where the fuck we are in general
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
var/_dir = dir
|
||||
var/turf/_T = get_step(T, _dir)
|
||||
if(_T)
|
||||
for(var/i in 1 to maxlength)
|
||||
var/obj/effect/beam/i_beam/I = new(T)
|
||||
if(istype(holder, /obj/item/assembly_holder))
|
||||
var/obj/item/assembly_holder/assembly_holder = holder
|
||||
I.icon_state = "[initial(I.icon_state)]_[(assembly_holder.a_left == src) ? "l":"r"]" //Sync the offset of the beam with the position of the sensor.
|
||||
else if(istype(holder, /obj/item/transfer_valve))
|
||||
I.icon_state = "[initial(I.icon_state)]_ttv"
|
||||
I.density = TRUE
|
||||
if(!I.Move(_T))
|
||||
qdel(I)
|
||||
switchListener(_T)
|
||||
break
|
||||
I.density = FALSE
|
||||
beams += I
|
||||
I.master = src
|
||||
I.setDir(_dir)
|
||||
I.invisibility = visible? 0 : INVISIBILITY_ABSTRACT
|
||||
T = _T
|
||||
_T = get_step(_T, _dir)
|
||||
CHECK_TICK
|
||||
|
||||
/obj/item/assembly/infra/on_detach()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/attack_hand()
|
||||
. = ..()
|
||||
refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/Moved()
|
||||
var/t = dir
|
||||
. = ..()
|
||||
setDir(t)
|
||||
|
||||
/obj/item/assembly/infra/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback)
|
||||
. = ..()
|
||||
olddir = dir
|
||||
|
||||
/obj/item/assembly/infra/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
||||
. = ..()
|
||||
if(!olddir)
|
||||
return
|
||||
setDir(olddir)
|
||||
olddir = null
|
||||
|
||||
/obj/item/assembly/infra/proc/trigger_beam(atom/movable/AM, turf/location)
|
||||
refreshBeam()
|
||||
switchListener(location)
|
||||
if(!secured || !on || next_activate > world.time)
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
next_activate = world.time + 30
|
||||
|
||||
/obj/item/assembly/infra/proc/switchListener(turf/newloc)
|
||||
if(listeningTo == newloc)
|
||||
return
|
||||
if(listeningTo)
|
||||
UnregisterSignal(listeningTo, COMSIG_ATOM_EXITED)
|
||||
RegisterSignal(newloc, COMSIG_ATOM_EXITED, .proc/check_exit)
|
||||
listeningTo = newloc
|
||||
|
||||
/obj/item/assembly/infra/proc/check_exit(datum/source, atom/movable/offender)
|
||||
if(QDELETED(src))
|
||||
return
|
||||
if(offender == src || istype(offender,/obj/effect/beam/i_beam))
|
||||
return
|
||||
if (offender && isitem(offender))
|
||||
var/obj/item/I = offender
|
||||
if (I.item_flags & ABSTRACT)
|
||||
return
|
||||
return refreshBeam()
|
||||
|
||||
/obj/item/assembly/infra/ui_interact(mob/user)//TODO: change this this to the wire control panel
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
user.set_machine(src)
|
||||
var/dat = "<TT><B>Infrared Laser</B></TT>"
|
||||
dat += "<BR><B>Status</B>: [on ? "<A href='?src=[REF(src)];state=0'>On</A>" : "<A href='?src=[REF(src)];state=1'>Off</A>"]"
|
||||
dat += "<BR><B>Visibility</B>: [visible ? "<A href='?src=[REF(src)];visible=0'>Visible</A>" : "<A href='?src=[REF(src)];visible=1'>Invisible</A>"]"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
user << browse(dat, "window=infra")
|
||||
onclose(user, "infra")
|
||||
return
|
||||
|
||||
/obj/item/assembly/infra/Topic(href, href_list)
|
||||
..()
|
||||
if(usr.incapacitated() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=infra")
|
||||
onclose(usr, "infra")
|
||||
return
|
||||
if(href_list["state"])
|
||||
on = !(on)
|
||||
update_icon()
|
||||
refreshBeam()
|
||||
if(href_list["visible"])
|
||||
visible = !(visible)
|
||||
update_icon()
|
||||
refreshBeam()
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=infra")
|
||||
return
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
/obj/item/assembly/infra/setDir()
|
||||
. = ..()
|
||||
refreshBeam()
|
||||
|
||||
/***************************IBeam*********************************/
|
||||
|
||||
/obj/effect/beam/i_beam
|
||||
name = "infrared beam"
|
||||
icon = 'icons/obj/projectiles.dmi'
|
||||
icon_state = "ibeam"
|
||||
var/obj/item/assembly/infra/master
|
||||
anchored = TRUE
|
||||
density = FALSE
|
||||
pass_flags = PASSTABLE|PASSGLASS|PASSGRILLE|LETPASSTHROW
|
||||
|
||||
/obj/effect/beam/i_beam/Crossed(atom/movable/AM as mob|obj)
|
||||
if(istype(AM, /obj/effect/beam))
|
||||
return
|
||||
if (isitem(AM))
|
||||
var/obj/item/I = AM
|
||||
if (I.item_flags & ABSTRACT)
|
||||
return
|
||||
master.trigger_beam(AM, get_turf(src))
|
||||
|
||||
+142
-142
@@ -1,142 +1,142 @@
|
||||
/obj/item/assembly/mousetrap
|
||||
name = "mousetrap"
|
||||
desc = "A handy little spring-loaded trap for catching pesty rodents."
|
||||
icon_state = "mousetrap"
|
||||
item_state = "mousetrap"
|
||||
materials = list(MAT_METAL=100)
|
||||
attachable = TRUE
|
||||
var/armed = FALSE
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The pressure plate is [armed?"primed":"safe"].</span>"
|
||||
|
||||
/obj/item/assembly/mousetrap/activate()
|
||||
if(..())
|
||||
armed = !armed
|
||||
if(!armed)
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/user = usr
|
||||
if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
|
||||
to_chat(user, "<span class='warning'>Your hand slips, setting off the trigger!</span>")
|
||||
pulse(FALSE)
|
||||
update_icon()
|
||||
playsound(src, 'sound/weapons/handcuffs.ogg', 30, TRUE, -3)
|
||||
|
||||
/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/bodypart/affecting = null
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
if(HAS_TRAIT(H, TRAIT_PIERCEIMMUNE))
|
||||
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_bodypart(pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
|
||||
H.Knockdown(60)
|
||||
if(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND)
|
||||
if(!H.gloves)
|
||||
affecting = H.get_bodypart(type)
|
||||
H.Stun(60)
|
||||
if(affecting)
|
||||
if(affecting.receive_damage(1, 0))
|
||||
H.update_damage_overlays()
|
||||
else if(ismouse(target))
|
||||
var/mob/living/simple_animal/mouse/M = target
|
||||
visible_message("<span class='boldannounce'>SPLAT!</span>")
|
||||
M.splat()
|
||||
playsound(src, 'sound/effects/snap.ogg', 50, TRUE)
|
||||
armed = FALSE
|
||||
update_icon()
|
||||
pulse(FALSE)
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_self(mob/living/carbon/human/user)
|
||||
if(!armed)
|
||||
to_chat(user, "<span class='notice'>You arm [src].</span>")
|
||||
else
|
||||
if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
|
||||
var/which_hand = BODY_ZONE_PRECISE_L_HAND
|
||||
if(!(user.active_hand_index % 2))
|
||||
which_hand = BODY_ZONE_PRECISE_R_HAND
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking 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(src, 'sound/weapons/handcuffs.ogg', 30, TRUE, -3)
|
||||
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/item/assembly/mousetrap/attack_hand(mob/living/carbon/human/user)
|
||||
if(armed)
|
||||
if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
|
||||
var/which_hand = BODY_ZONE_PRECISE_L_HAND
|
||||
if(!(user.active_hand_index % 2))
|
||||
which_hand = BODY_ZONE_PRECISE_R_HAND
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/Crossed(atom/movable/AM as mob|obj)
|
||||
if(armed)
|
||||
if(ismob(AM))
|
||||
var/mob/MM = AM
|
||||
if(!(MM.movement_type & FLYING))
|
||||
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(MM))
|
||||
triggered(MM)
|
||||
else if(AM.density) // For mousetrap grenades, set off by anything heavy
|
||||
triggered(AM)
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/on_found(mob/finder)
|
||||
if(armed)
|
||||
if(finder)
|
||||
finder.visible_message("<span class='warning'>[finder] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
triggered(finder, (finder.active_hand_index % 2 == 0) ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND)
|
||||
return TRUE //end the search!
|
||||
else
|
||||
visible_message("<span class='warning'>[src] snaps shut!</span>")
|
||||
triggered(loc)
|
||||
return FALSE
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/hitby(atom/hit_atom, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum)
|
||||
if(!armed)
|
||||
return ..()
|
||||
visible_message("<span class='warning'>[src] is triggered by [hit_atom].</span>")
|
||||
triggered(null)
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/armed
|
||||
icon_state = "mousetraparmed"
|
||||
armed = TRUE
|
||||
/obj/item/assembly/mousetrap
|
||||
name = "mousetrap"
|
||||
desc = "A handy little spring-loaded trap for catching pesty rodents."
|
||||
icon_state = "mousetrap"
|
||||
item_state = "mousetrap"
|
||||
materials = list(MAT_METAL=100)
|
||||
attachable = TRUE
|
||||
var/armed = FALSE
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The pressure plate is [armed?"primed":"safe"].</span>"
|
||||
|
||||
/obj/item/assembly/mousetrap/activate()
|
||||
if(..())
|
||||
armed = !armed
|
||||
if(!armed)
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/user = usr
|
||||
if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
|
||||
to_chat(user, "<span class='warning'>Your hand slips, setting off the trigger!</span>")
|
||||
pulse(FALSE)
|
||||
update_icon()
|
||||
playsound(src, 'sound/weapons/handcuffs.ogg', 30, TRUE, -3)
|
||||
|
||||
/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/bodypart/affecting = null
|
||||
if(ishuman(target))
|
||||
var/mob/living/carbon/human/H = target
|
||||
if(HAS_TRAIT(H, TRAIT_PIERCEIMMUNE))
|
||||
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_bodypart(pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
|
||||
H.Knockdown(60)
|
||||
if(BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND)
|
||||
if(!H.gloves)
|
||||
affecting = H.get_bodypart(type)
|
||||
H.Stun(60)
|
||||
if(affecting)
|
||||
if(affecting.receive_damage(1, 0))
|
||||
H.update_damage_overlays()
|
||||
else if(ismouse(target))
|
||||
var/mob/living/simple_animal/mouse/M = target
|
||||
visible_message("<span class='boldannounce'>SPLAT!</span>")
|
||||
M.splat()
|
||||
playsound(src, 'sound/effects/snap.ogg', 50, TRUE)
|
||||
armed = FALSE
|
||||
update_icon()
|
||||
pulse(FALSE)
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/attack_self(mob/living/carbon/human/user)
|
||||
if(!armed)
|
||||
to_chat(user, "<span class='notice'>You arm [src].</span>")
|
||||
else
|
||||
if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
|
||||
var/which_hand = BODY_ZONE_PRECISE_L_HAND
|
||||
if(!(user.active_hand_index % 2))
|
||||
which_hand = BODY_ZONE_PRECISE_R_HAND
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking 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(src, 'sound/weapons/handcuffs.ogg', 30, TRUE, -3)
|
||||
|
||||
|
||||
//ATTACK HAND IGNORING PARENT RETURN VALUE
|
||||
/obj/item/assembly/mousetrap/attack_hand(mob/living/carbon/human/user)
|
||||
if(armed)
|
||||
if((HAS_TRAIT(user, TRAIT_DUMB) || HAS_TRAIT(user, TRAIT_CLUMSY)) && prob(50))
|
||||
var/which_hand = BODY_ZONE_PRECISE_L_HAND
|
||||
if(!(user.active_hand_index % 2))
|
||||
which_hand = BODY_ZONE_PRECISE_R_HAND
|
||||
triggered(user, which_hand)
|
||||
user.visible_message("<span class='warning'>[user] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
return
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/Crossed(atom/movable/AM as mob|obj)
|
||||
if(armed)
|
||||
if(ismob(AM))
|
||||
var/mob/MM = AM
|
||||
if(!(MM.movement_type & FLYING))
|
||||
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(MM))
|
||||
triggered(MM)
|
||||
else if(AM.density) // For mousetrap grenades, set off by anything heavy
|
||||
triggered(AM)
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/on_found(mob/finder)
|
||||
if(armed)
|
||||
if(finder)
|
||||
finder.visible_message("<span class='warning'>[finder] accidentally sets off [src], breaking their fingers.</span>", \
|
||||
"<span class='warning'>You accidentally trigger [src]!</span>")
|
||||
triggered(finder, (finder.active_hand_index % 2 == 0) ? BODY_ZONE_PRECISE_R_HAND : BODY_ZONE_PRECISE_L_HAND)
|
||||
return TRUE //end the search!
|
||||
else
|
||||
visible_message("<span class='warning'>[src] snaps shut!</span>")
|
||||
triggered(loc)
|
||||
return FALSE
|
||||
return FALSE
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/hitby(atom/hit_atom, skipcatch = FALSE, hitpush = TRUE, blocked = FALSE, datum/thrownthing/throwingdatum)
|
||||
if(!armed)
|
||||
return ..()
|
||||
visible_message("<span class='warning'>[src] is triggered by [hit_atom].</span>")
|
||||
triggered(null)
|
||||
|
||||
|
||||
/obj/item/assembly/mousetrap/armed
|
||||
icon_state = "mousetraparmed"
|
||||
armed = TRUE
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/obj/item/assembly/playback
|
||||
name = "playback device"
|
||||
desc = "A small electronic device able to record a voice sample, and repeat that sample when it receive a signal."
|
||||
icon_state = "radio"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
flags_1 = HEAR_1
|
||||
attachable = TRUE
|
||||
verb_say = "beeps"
|
||||
verb_ask = "beeps"
|
||||
verb_exclaim = "beeps"
|
||||
var/listening = FALSE
|
||||
var/recorded = "" //the activation message
|
||||
var/languages
|
||||
|
||||
/obj/item/assembly/playback/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(speaker == src)
|
||||
return
|
||||
|
||||
if(listening && !radio_freq)
|
||||
record_speech(speaker, raw_message, message_language)
|
||||
|
||||
/obj/item/assembly/playback/proc/record_speech(atom/movable/speaker, raw_message, datum/language/message_language)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
languages = message_language
|
||||
say("Activation message is '[recorded]'.", language = message_language)
|
||||
|
||||
/obj/item/assembly/playback/activate()
|
||||
if(recorded == "") // Why say anything when there isn't anything to say
|
||||
return FALSE
|
||||
say("[recorded]", language = languages) // Repeat the message in the language it was said in
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/playback/proc/record()
|
||||
if(!secured || holder)
|
||||
return FALSE
|
||||
listening = !listening
|
||||
say("[listening ? "Now" : "No longer"] recording input.")
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/playback/attack_self(mob/user)
|
||||
if(!user)
|
||||
return FALSE
|
||||
record()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/playback/toggle_secure()
|
||||
. = ..()
|
||||
listening = FALSE
|
||||
+160
-160
@@ -1,160 +1,160 @@
|
||||
/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)
|
||||
attachable = TRUE
|
||||
|
||||
var/scanning = FALSE
|
||||
var/timing = FALSE
|
||||
var/time = 10
|
||||
var/sensitivity = 1
|
||||
var/hearing_range = 3
|
||||
|
||||
/obj/item/assembly/prox_sensor/Initialize()
|
||||
. = ..()
|
||||
proximity_monitor = new(src, 0)
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/prox_sensor/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/prox_sensor/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The proximity sensor is [timing ? "arming" : (scanning ? "armed" : "disarmed")].</span>"
|
||||
|
||||
/obj/item/assembly/prox_sensor/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
if(!scanning)
|
||||
timing = !timing
|
||||
else
|
||||
scanning = FALSE
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/prox_sensor/on_detach()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
else
|
||||
proximity_monitor.SetHost(src,src)
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/toggle_secure()
|
||||
secured = !secured
|
||||
if(!secured)
|
||||
if(scanning)
|
||||
toggle_scan()
|
||||
proximity_monitor.SetHost(src,src)
|
||||
timing = FALSE
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
else
|
||||
START_PROCESSING(SSobj, src)
|
||||
proximity_monitor.SetHost(loc,src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/HasProximity(atom/movable/AM as mob|obj)
|
||||
if (istype(AM, /obj/effect/beam))
|
||||
return
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/sense()
|
||||
if(!scanning || !secured || next_activate > world.time)
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
next_activate = world.time + 30
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/process()
|
||||
if(!timing)
|
||||
return
|
||||
time--
|
||||
if(time <= 0)
|
||||
timing = FALSE
|
||||
toggle_scan(TRUE)
|
||||
time = initial(time)
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/toggle_scan(scan)
|
||||
if(!secured)
|
||||
return FALSE
|
||||
scanning = scan
|
||||
proximity_monitor.SetRange(scanning ? sensitivity : 0)
|
||||
update_icon()
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/sensitivity_change(value)
|
||||
var/sense = min(max(sensitivity + value, 0), 5)
|
||||
sensitivity = sense
|
||||
if(scanning && proximity_monitor.SetRange(sense))
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/update_icon()
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
add_overlay("prox_timing")
|
||||
attached_overlays += "prox_timing"
|
||||
if(scanning)
|
||||
add_overlay("prox_scanning")
|
||||
attached_overlays += "prox_scanning"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/prox_sensor/ui_interact(mob/user)//TODO: Change this to the wires thingy
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = "<TT><B>Proximity Sensor</B></TT>"
|
||||
if(!scanning)
|
||||
dat += "<BR>[(timing ? "<A href='?src=[REF(src)];time=0'>Arming</A>" : "<A href='?src=[REF(src)];time=1'>Not Arming</A>")] [minute]:[second]"
|
||||
dat += "<BR><A href='?src=[REF(src)];tp=-30'>-</A> <A href='?src=[REF(src)];tp=-1'>-</A> <A href='?src=[REF(src)];tp=1'>+</A> <A href='?src=[REF(src)];tp=30'>+</A>"
|
||||
dat += "<BR><A href='?src=[REF(src)];scanning=[scanning?"0'>Armed":"1'>Unarmed (Movement sensor active when armed!)"]</A>"
|
||||
dat += "<BR>Detection range: <A href='?src=[REF(src)];sense=down'>-</A> [sensitivity] <A href='?src=[REF(src)];sense=up'>+</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
user << browse(dat, "window=prox")
|
||||
onclose(user, "prox")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/Topic(href, href_list)
|
||||
..()
|
||||
if(usr.incapacitated() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=prox")
|
||||
onclose(usr, "prox")
|
||||
return
|
||||
|
||||
if(href_list["sense"])
|
||||
sensitivity_change(((href_list["sense"] == "up") ? 1 : -1))
|
||||
|
||||
if(href_list["scanning"])
|
||||
toggle_scan(text2num(href_list["scanning"]))
|
||||
|
||||
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)
|
||||
attachable = TRUE
|
||||
|
||||
var/scanning = FALSE
|
||||
var/timing = FALSE
|
||||
var/time = 10
|
||||
var/sensitivity = 1
|
||||
var/hearing_range = 3
|
||||
|
||||
/obj/item/assembly/prox_sensor/Initialize()
|
||||
. = ..()
|
||||
proximity_monitor = new(src, 0)
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/prox_sensor/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/prox_sensor/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The proximity sensor is [timing ? "arming" : (scanning ? "armed" : "disarmed")].</span>"
|
||||
|
||||
/obj/item/assembly/prox_sensor/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
if(!scanning)
|
||||
timing = !timing
|
||||
else
|
||||
scanning = FALSE
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/prox_sensor/on_detach()
|
||||
. = ..()
|
||||
if(!.)
|
||||
return
|
||||
else
|
||||
proximity_monitor.SetHost(src,src)
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/toggle_secure()
|
||||
secured = !secured
|
||||
if(!secured)
|
||||
if(scanning)
|
||||
toggle_scan()
|
||||
proximity_monitor.SetHost(src,src)
|
||||
timing = FALSE
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
else
|
||||
START_PROCESSING(SSobj, src)
|
||||
proximity_monitor.SetHost(loc,src)
|
||||
update_icon()
|
||||
return secured
|
||||
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/HasProximity(atom/movable/AM as mob|obj)
|
||||
if (istype(AM, /obj/effect/beam))
|
||||
return
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/sense()
|
||||
if(!scanning || !secured || next_activate > world.time)
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
next_activate = world.time + 30
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/process()
|
||||
if(!timing)
|
||||
return
|
||||
time--
|
||||
if(time <= 0)
|
||||
timing = FALSE
|
||||
toggle_scan(TRUE)
|
||||
time = initial(time)
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/toggle_scan(scan)
|
||||
if(!secured)
|
||||
return FALSE
|
||||
scanning = scan
|
||||
proximity_monitor.SetRange(scanning ? sensitivity : 0)
|
||||
update_icon()
|
||||
|
||||
/obj/item/assembly/prox_sensor/proc/sensitivity_change(value)
|
||||
var/sense = min(max(sensitivity + value, 0), 5)
|
||||
sensitivity = sense
|
||||
if(scanning && proximity_monitor.SetRange(sense))
|
||||
sense()
|
||||
|
||||
/obj/item/assembly/prox_sensor/update_icon()
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
add_overlay("prox_timing")
|
||||
attached_overlays += "prox_timing"
|
||||
if(scanning)
|
||||
add_overlay("prox_scanning")
|
||||
attached_overlays += "prox_scanning"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/prox_sensor/ui_interact(mob/user)//TODO: Change this to the wires thingy
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = "<TT><B>Proximity Sensor</B></TT>"
|
||||
if(!scanning)
|
||||
dat += "<BR>[(timing ? "<A href='?src=[REF(src)];time=0'>Arming</A>" : "<A href='?src=[REF(src)];time=1'>Not Arming</A>")] [minute]:[second]"
|
||||
dat += "<BR><A href='?src=[REF(src)];tp=-30'>-</A> <A href='?src=[REF(src)];tp=-1'>-</A> <A href='?src=[REF(src)];tp=1'>+</A> <A href='?src=[REF(src)];tp=30'>+</A>"
|
||||
dat += "<BR><A href='?src=[REF(src)];scanning=[scanning?"0'>Armed":"1'>Unarmed (Movement sensor active when armed!)"]</A>"
|
||||
dat += "<BR>Detection range: <A href='?src=[REF(src)];sense=down'>-</A> [sensitivity] <A href='?src=[REF(src)];sense=up'>+</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
user << browse(dat, "window=prox")
|
||||
onclose(user, "prox")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/prox_sensor/Topic(href, href_list)
|
||||
..()
|
||||
if(usr.incapacitated() || !in_range(loc, usr))
|
||||
usr << browse(null, "window=prox")
|
||||
onclose(usr, "prox")
|
||||
return
|
||||
|
||||
if(href_list["sense"])
|
||||
sensitivity_change(((href_list["sense"] == "up") ? 1 : -1))
|
||||
|
||||
if(href_list["scanning"])
|
||||
toggle_scan(text2num(href_list["scanning"]))
|
||||
|
||||
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,39 +1,39 @@
|
||||
/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/electropack/part2 = null
|
||||
w_class = WEIGHT_CLASS_HUGE
|
||||
flags_1 = CONDUCT_1
|
||||
|
||||
/obj/item/assembly/shock_kit/Destroy()
|
||||
qdel(part1)
|
||||
qdel(part2)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/shock_kit/wrench_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='notice'>You disassemble [src].</span>")
|
||||
if(part1)
|
||||
part1.forceMove(drop_location())
|
||||
part1.master = null
|
||||
part1 = null
|
||||
if(part2)
|
||||
part2.forceMove(drop_location())
|
||||
part2.master = null
|
||||
part2 = null
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/shock_kit/attack_self(mob/user)
|
||||
part1.attack_self(user)
|
||||
part2.attack_self(user)
|
||||
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/electropack/part2 = null
|
||||
w_class = WEIGHT_CLASS_HUGE
|
||||
flags_1 = CONDUCT_1
|
||||
|
||||
/obj/item/assembly/shock_kit/Destroy()
|
||||
qdel(part1)
|
||||
qdel(part2)
|
||||
return ..()
|
||||
|
||||
/obj/item/assembly/shock_kit/wrench_act(mob/living/user, obj/item/I)
|
||||
to_chat(user, "<span class='notice'>You disassemble [src].</span>")
|
||||
if(part1)
|
||||
part1.forceMove(drop_location())
|
||||
part1.master = null
|
||||
part1 = null
|
||||
if(part2)
|
||||
part2.forceMove(drop_location())
|
||||
part2.master = null
|
||||
part2 = null
|
||||
qdel(src)
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/shock_kit/attack_self(mob/user)
|
||||
part1.attack_self(user)
|
||||
part2.attack_self(user)
|
||||
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
|
||||
|
||||
+208
-208
@@ -1,209 +1,209 @@
|
||||
/obj/item/assembly/signaler
|
||||
name = "remote signaling device"
|
||||
desc = "Used to remotely activate devices. Allows for syncing when using a secure signaler on another."
|
||||
icon_state = "signaller"
|
||||
item_state = "signaler"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
materials = list(MAT_METAL=400, MAT_GLASS=120)
|
||||
wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE
|
||||
attachable = TRUE
|
||||
|
||||
var/code = DEFAULT_SIGNALER_CODE
|
||||
var/frequency = FREQ_SIGNALER
|
||||
var/delay = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
var/suicider = null
|
||||
var/hearing_range = 1
|
||||
|
||||
/obj/item/assembly/signaler/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] eats \the [src]! If it is signaled, [user.p_they()] will die!</span>")
|
||||
playsound(src, 'sound/items/eatfood.ogg', 50, TRUE)
|
||||
user.transferItemToLoc(src, user, TRUE)
|
||||
suicider = user
|
||||
return MANUAL_SUICIDE
|
||||
|
||||
/obj/item/assembly/signaler/proc/manual_suicide(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user]'s \the [src] receives a signal, killing [user.p_them()] instantly!</span>")
|
||||
user.adjustOxyLoss(200)//it sends an electrical pulse to their heart, killing them. or something.
|
||||
user.death(0)
|
||||
|
||||
/obj/item/assembly/signaler/Initialize()
|
||||
. = ..()
|
||||
set_frequency(frequency)
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/Destroy()
|
||||
SSradio.remove_object(src,frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/signaler/activate()
|
||||
if(!..())//cooldown processing
|
||||
return FALSE
|
||||
signal()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/update_icon()
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/ui_interact(mob/user, flag1)
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
var/t1 = "-------"
|
||||
var/dat = {"
|
||||
<TT>
|
||||
|
||||
<A href='byond://?src=[REF(src)];send=1'>Send Signal</A><BR>
|
||||
<B>Frequency/Code</B> for signaler:<BR>
|
||||
Frequency:
|
||||
[format_frequency(src.frequency)]
|
||||
<A href='byond://?src=[REF(src)];set=freq'>Set</A><BR>
|
||||
|
||||
Code:
|
||||
[src.code]
|
||||
<A href='byond://?src=[REF(src)];set=code'>Set</A><BR>
|
||||
[t1]
|
||||
</TT>"}
|
||||
user << browse(dat, "window=radio")
|
||||
onclose(user, "radio")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
usr << browse(null, "window=radio")
|
||||
onclose(usr, "radio")
|
||||
return
|
||||
|
||||
if (href_list["set"])
|
||||
|
||||
if(href_list["set"] == "freq")
|
||||
var/new_freq = input(usr, "Input a new signalling frequency", "Remote Signaller Frequency", format_frequency(frequency)) as num|null
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
new_freq = unformat_frequency(new_freq)
|
||||
new_freq = sanitize_frequency(new_freq, TRUE)
|
||||
set_frequency(new_freq)
|
||||
|
||||
if(href_list["set"] == "code")
|
||||
var/new_code = input(usr, "Input a new signalling code", "Remote Signaller Code", code) as num|null
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
new_code = round(new_code)
|
||||
new_code = CLAMP(new_code, 1, 100)
|
||||
code = new_code
|
||||
|
||||
if(href_list["send"])
|
||||
spawn( 0 )
|
||||
signal()
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/attackby(obj/item/W, mob/user, params)
|
||||
if(issignaler(W))
|
||||
var/obj/item/assembly/signaler/signaler2 = W
|
||||
if(secured && signaler2.secured)
|
||||
code = signaler2.code
|
||||
set_frequency(signaler2.frequency)
|
||||
to_chat(user, "You transfer the frequency and code of \the [signaler2.name] to \the [name]")
|
||||
..()
|
||||
|
||||
/obj/item/assembly/signaler/proc/signal()
|
||||
if(!radio_connection)
|
||||
return
|
||||
|
||||
var/datum/signal/signal = new(list("code" = code))
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
var/time = time2text(world.realtime,"hh:mm:ss")
|
||||
var/turf/T = get_turf(src)
|
||||
if(usr)
|
||||
GLOB.lastsignalers.Add("[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(frequency)]/[code]")
|
||||
|
||||
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/receive_signal(datum/signal/signal)
|
||||
. = FALSE
|
||||
if(!signal)
|
||||
return
|
||||
if(signal.data["code"] != code)
|
||||
return
|
||||
if(!(src.wires & WIRE_RADIO_RECEIVE))
|
||||
return
|
||||
if(suicider)
|
||||
manual_suicide(suicider)
|
||||
pulse(TRUE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/proc/set_frequency(new_frequency)
|
||||
SSradio.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = SSradio.add_object(src, frequency, RADIO_SIGNALER)
|
||||
return
|
||||
|
||||
// Embedded signaller used in grenade construction.
|
||||
// It's necessary because the signaler doens't have an off state.
|
||||
// Generated during grenade construction. -Sayu
|
||||
/obj/item/assembly/signaler/receiver
|
||||
var/on = FALSE
|
||||
|
||||
/obj/item/assembly/signaler/receiver/proc/toggle_safety()
|
||||
on = !on
|
||||
|
||||
/obj/item/assembly/signaler/receiver/activate()
|
||||
toggle_safety()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/receiver/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The radio receiver is [on?"on":"off"].</span>"
|
||||
|
||||
/obj/item/assembly/signaler/receiver/receive_signal(datum/signal/signal)
|
||||
if(!on)
|
||||
return
|
||||
return ..(signal)
|
||||
|
||||
|
||||
// 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"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
resistance_flags = FIRE_PROOF
|
||||
var/anomaly_type = /obj/effect/anomaly
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/receive_signal(datum/signal/signal)
|
||||
if(!signal)
|
||||
return FALSE
|
||||
if(signal.data["code"] != code)
|
||||
return FALSE
|
||||
for(var/obj/effect/anomaly/A in get_turf(src))
|
||||
A.anomalyNeutralize()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/attack_self()
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/cyborg
|
||||
|
||||
/obj/item/assembly/signaler/cyborg/attackby(obj/item/W, mob/user, params)
|
||||
return
|
||||
/obj/item/assembly/signaler/cyborg/screwdriver_act(mob/living/user, obj/item/I)
|
||||
/obj/item/assembly/signaler
|
||||
name = "remote signaling device"
|
||||
desc = "Used to remotely activate devices. Allows for syncing when using a secure signaler on another."
|
||||
icon_state = "signaller"
|
||||
item_state = "signaler"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
materials = list(MAT_METAL=400, MAT_GLASS=120)
|
||||
wires = WIRE_RECEIVE | WIRE_PULSE | WIRE_RADIO_PULSE | WIRE_RADIO_RECEIVE
|
||||
attachable = TRUE
|
||||
|
||||
var/code = DEFAULT_SIGNALER_CODE
|
||||
var/frequency = FREQ_SIGNALER
|
||||
var/delay = 0
|
||||
var/datum/radio_frequency/radio_connection
|
||||
var/suicider = null
|
||||
var/hearing_range = 1
|
||||
|
||||
/obj/item/assembly/signaler/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user] eats \the [src]! If it is signaled, [user.p_they()] will die!</span>")
|
||||
playsound(src, 'sound/items/eatfood.ogg', 50, TRUE)
|
||||
user.transferItemToLoc(src, user, TRUE)
|
||||
suicider = user
|
||||
return MANUAL_SUICIDE
|
||||
|
||||
/obj/item/assembly/signaler/proc/manual_suicide(mob/living/carbon/user)
|
||||
user.visible_message("<span class='suicide'>[user]'s \the [src] receives a signal, killing [user.p_them()] instantly!</span>")
|
||||
user.adjustOxyLoss(200)//it sends an electrical pulse to their heart, killing them. or something.
|
||||
user.death(0)
|
||||
|
||||
/obj/item/assembly/signaler/Initialize()
|
||||
. = ..()
|
||||
set_frequency(frequency)
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/Destroy()
|
||||
SSradio.remove_object(src,frequency)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/signaler/activate()
|
||||
if(!..())//cooldown processing
|
||||
return FALSE
|
||||
signal()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/update_icon()
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/ui_interact(mob/user, flag1)
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
var/t1 = "-------"
|
||||
var/dat = {"
|
||||
<TT>
|
||||
|
||||
<A href='byond://?src=[REF(src)];send=1'>Send Signal</A><BR>
|
||||
<B>Frequency/Code</B> for signaler:<BR>
|
||||
Frequency:
|
||||
[format_frequency(src.frequency)]
|
||||
<A href='byond://?src=[REF(src)];set=freq'>Set</A><BR>
|
||||
|
||||
Code:
|
||||
[src.code]
|
||||
<A href='byond://?src=[REF(src)];set=code'>Set</A><BR>
|
||||
[t1]
|
||||
</TT>"}
|
||||
user << browse(dat, "window=radio")
|
||||
onclose(user, "radio")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
usr << browse(null, "window=radio")
|
||||
onclose(usr, "radio")
|
||||
return
|
||||
|
||||
if (href_list["set"])
|
||||
|
||||
if(href_list["set"] == "freq")
|
||||
var/new_freq = input(usr, "Input a new signalling frequency", "Remote Signaller Frequency", format_frequency(frequency)) as num|null
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
new_freq = unformat_frequency(new_freq)
|
||||
new_freq = sanitize_frequency(new_freq, TRUE)
|
||||
set_frequency(new_freq)
|
||||
|
||||
if(href_list["set"] == "code")
|
||||
var/new_code = input(usr, "Input a new signalling code", "Remote Signaller Code", code) as num|null
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
new_code = round(new_code)
|
||||
new_code = CLAMP(new_code, 1, 100)
|
||||
code = new_code
|
||||
|
||||
if(href_list["send"])
|
||||
spawn( 0 )
|
||||
signal()
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/attackby(obj/item/W, mob/user, params)
|
||||
if(issignaler(W))
|
||||
var/obj/item/assembly/signaler/signaler2 = W
|
||||
if(secured && signaler2.secured)
|
||||
code = signaler2.code
|
||||
set_frequency(signaler2.frequency)
|
||||
to_chat(user, "You transfer the frequency and code of \the [signaler2.name] to \the [name]")
|
||||
..()
|
||||
|
||||
/obj/item/assembly/signaler/proc/signal()
|
||||
if(!radio_connection)
|
||||
return
|
||||
|
||||
var/datum/signal/signal = new(list("code" = code))
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
var/time = time2text(world.realtime,"hh:mm:ss")
|
||||
var/turf/T = get_turf(src)
|
||||
if(usr)
|
||||
GLOB.lastsignalers.Add("[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(frequency)]/[code]")
|
||||
|
||||
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/receive_signal(datum/signal/signal)
|
||||
. = FALSE
|
||||
if(!signal)
|
||||
return
|
||||
if(signal.data["code"] != code)
|
||||
return
|
||||
if(!(src.wires & WIRE_RADIO_RECEIVE))
|
||||
return
|
||||
if(suicider)
|
||||
manual_suicide(suicider)
|
||||
pulse(TRUE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/assembly/signaler/proc/set_frequency(new_frequency)
|
||||
SSradio.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = SSradio.add_object(src, frequency, RADIO_SIGNALER)
|
||||
return
|
||||
|
||||
// Embedded signaller used in grenade construction.
|
||||
// It's necessary because the signaler doens't have an off state.
|
||||
// Generated during grenade construction. -Sayu
|
||||
/obj/item/assembly/signaler/receiver
|
||||
var/on = FALSE
|
||||
|
||||
/obj/item/assembly/signaler/receiver/proc/toggle_safety()
|
||||
on = !on
|
||||
|
||||
/obj/item/assembly/signaler/receiver/activate()
|
||||
toggle_safety()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/receiver/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The radio receiver is [on?"on":"off"].</span>"
|
||||
|
||||
/obj/item/assembly/signaler/receiver/receive_signal(datum/signal/signal)
|
||||
if(!on)
|
||||
return
|
||||
return ..(signal)
|
||||
|
||||
|
||||
// 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"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
resistance_flags = FIRE_PROOF
|
||||
var/anomaly_type = /obj/effect/anomaly
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/receive_signal(datum/signal/signal)
|
||||
if(!signal)
|
||||
return FALSE
|
||||
if(signal.data["code"] != code)
|
||||
return FALSE
|
||||
for(var/obj/effect/anomaly/A in get_turf(src))
|
||||
A.anomalyNeutralize()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/signaler/anomaly/attack_self()
|
||||
return
|
||||
|
||||
/obj/item/assembly/signaler/cyborg
|
||||
|
||||
/obj/item/assembly/signaler/cyborg/attackby(obj/item/W, mob/user, params)
|
||||
return
|
||||
/obj/item/assembly/signaler/cyborg/screwdriver_act(mob/living/user, obj/item/I)
|
||||
return
|
||||
+135
-135
@@ -1,135 +1,135 @@
|
||||
/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)
|
||||
attachable = TRUE
|
||||
|
||||
var/timing = FALSE
|
||||
var/time = 5
|
||||
var/saved_time = 5
|
||||
var/loop = FALSE
|
||||
var/hearing_range = 3
|
||||
|
||||
/obj/item/assembly/timer/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] looks at the timer and decides [user.p_their()] fate! It looks like [user.p_theyre()] going to commit suicide!</span>")
|
||||
activate()//doesnt rely on timer_end to prevent weird metas where one person can control the timer and therefore someone's life. (maybe that should be how it works...)
|
||||
addtimer(CALLBACK(src, .proc/manual_suicide, user), time*10)//kill yourself once the time runs out
|
||||
return MANUAL_SUICIDE
|
||||
|
||||
/obj/item/assembly/timer/proc/manual_suicide(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user]'s time is up!</span>")
|
||||
user.adjustOxyLoss(200)
|
||||
user.death(0)
|
||||
|
||||
/obj/item/assembly/timer/Initialize()
|
||||
. = ..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/timer/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/timer/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The timer is [timing ? "counting down from [time]":"set for [time] seconds"].</span>"
|
||||
|
||||
/obj/item/assembly/timer/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
|
||||
/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 || next_activate > world.time)
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
if(loop)
|
||||
timing = TRUE
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/assembly/timer/process()
|
||||
if(!timing)
|
||||
return
|
||||
time--
|
||||
if(time <= 0)
|
||||
timing = FALSE
|
||||
timer_end()
|
||||
time = saved_time
|
||||
|
||||
|
||||
/obj/item/assembly/timer/update_icon()
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
add_overlay("timer_timing")
|
||||
attached_overlays += "timer_timing"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
|
||||
/obj/item/assembly/timer/ui_interact(mob/user)//TODO: Have this use the wires
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = "<TT><B>Timing Unit</B></TT>"
|
||||
dat += "<BR>[(timing ? "<A href='?src=[REF(src)];time=0'>Timing</A>" : "<A href='?src=[REF(src)];time=1'>Not Timing</A>")] [minute]:[second]"
|
||||
dat += "<BR><A href='?src=[REF(src)];tp=-30'>-</A> <A href='?src=[REF(src)];tp=-1'>-</A> <A href='?src=[REF(src)];tp=1'>+</A> <A href='?src=[REF(src)];tp=30'>+</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];repeat=[(loop ? "0'>Stop repeating" : "1'>Set to repeat")]</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
var/datum/browser/popup = new(user, "timer", name)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
|
||||
/obj/item/assembly/timer/Topic(href, href_list)
|
||||
..()
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
usr << browse(null, "window=timer")
|
||||
onclose(usr, "timer")
|
||||
return
|
||||
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
if(timing && istype(holder, /obj/item/transfer_valve))
|
||||
var/timer_message = "[ADMIN_LOOKUPFLW(usr)] activated [src] attachment on [holder]."
|
||||
message_admins(timer_message)
|
||||
GLOB.bombers += timer_message
|
||||
log_game("[key_name(usr)] activated [src] attachment on [holder]")
|
||||
update_icon()
|
||||
if(href_list["repeat"])
|
||||
loop = text2num(href_list["repeat"])
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
time += tp
|
||||
time = min(max(round(time), 1), 600)
|
||||
saved_time = 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)
|
||||
attachable = TRUE
|
||||
|
||||
var/timing = FALSE
|
||||
var/time = 5
|
||||
var/saved_time = 5
|
||||
var/loop = FALSE
|
||||
var/hearing_range = 3
|
||||
|
||||
/obj/item/assembly/timer/suicide_act(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user] looks at the timer and decides [user.p_their()] fate! It looks like [user.p_theyre()] going to commit suicide!</span>")
|
||||
activate()//doesnt rely on timer_end to prevent weird metas where one person can control the timer and therefore someone's life. (maybe that should be how it works...)
|
||||
addtimer(CALLBACK(src, .proc/manual_suicide, user), time*10)//kill yourself once the time runs out
|
||||
return MANUAL_SUICIDE
|
||||
|
||||
/obj/item/assembly/timer/proc/manual_suicide(mob/living/user)
|
||||
user.visible_message("<span class='suicide'>[user]'s time is up!</span>")
|
||||
user.adjustOxyLoss(200)
|
||||
user.death(0)
|
||||
|
||||
/obj/item/assembly/timer/Initialize()
|
||||
. = ..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/assembly/timer/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
. = ..()
|
||||
|
||||
/obj/item/assembly/timer/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>The timer is [timing ? "counting down from [time]":"set for [time] seconds"].</span>"
|
||||
|
||||
/obj/item/assembly/timer/activate()
|
||||
if(!..())
|
||||
return FALSE//Cooldown check
|
||||
timing = !timing
|
||||
update_icon()
|
||||
return TRUE
|
||||
|
||||
|
||||
/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 || next_activate > world.time)
|
||||
return FALSE
|
||||
pulse(FALSE)
|
||||
audible_message("[icon2html(src, hearers(src))] *beep* *beep* *beep*", null, hearing_range)
|
||||
for(var/CHM in get_hearers_in_view(hearing_range, src))
|
||||
if(ismob(CHM))
|
||||
var/mob/LM = CHM
|
||||
LM.playsound_local(get_turf(src), 'sound/machines/triple_beep.ogg', ASSEMBLY_BEEP_VOLUME, TRUE)
|
||||
if(loop)
|
||||
timing = TRUE
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/assembly/timer/process()
|
||||
if(!timing)
|
||||
return
|
||||
time--
|
||||
if(time <= 0)
|
||||
timing = FALSE
|
||||
timer_end()
|
||||
time = saved_time
|
||||
|
||||
|
||||
/obj/item/assembly/timer/update_icon()
|
||||
cut_overlays()
|
||||
attached_overlays = list()
|
||||
if(timing)
|
||||
add_overlay("timer_timing")
|
||||
attached_overlays += "timer_timing"
|
||||
if(holder)
|
||||
holder.update_icon()
|
||||
|
||||
|
||||
/obj/item/assembly/timer/ui_interact(mob/user)//TODO: Have this use the wires
|
||||
. = ..()
|
||||
if(is_secured(user))
|
||||
var/second = time % 60
|
||||
var/minute = (time - second) / 60
|
||||
var/dat = "<TT><B>Timing Unit</B></TT>"
|
||||
dat += "<BR>[(timing ? "<A href='?src=[REF(src)];time=0'>Timing</A>" : "<A href='?src=[REF(src)];time=1'>Not Timing</A>")] [minute]:[second]"
|
||||
dat += "<BR><A href='?src=[REF(src)];tp=-30'>-</A> <A href='?src=[REF(src)];tp=-1'>-</A> <A href='?src=[REF(src)];tp=1'>+</A> <A href='?src=[REF(src)];tp=30'>+</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];repeat=[(loop ? "0'>Stop repeating" : "1'>Set to repeat")]</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];refresh=1'>Refresh</A>"
|
||||
dat += "<BR><BR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
var/datum/browser/popup = new(user, "timer", name)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
|
||||
/obj/item/assembly/timer/Topic(href, href_list)
|
||||
..()
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
usr << browse(null, "window=timer")
|
||||
onclose(usr, "timer")
|
||||
return
|
||||
|
||||
if(href_list["time"])
|
||||
timing = text2num(href_list["time"])
|
||||
if(timing && istype(holder, /obj/item/transfer_valve))
|
||||
var/timer_message = "[ADMIN_LOOKUPFLW(usr)] activated [src] attachment on [holder]."
|
||||
message_admins(timer_message)
|
||||
GLOB.bombers += timer_message
|
||||
log_game("[key_name(usr)] activated [src] attachment on [holder]")
|
||||
update_icon()
|
||||
if(href_list["repeat"])
|
||||
loop = text2num(href_list["repeat"])
|
||||
|
||||
if(href_list["tp"])
|
||||
var/tp = text2num(href_list["tp"])
|
||||
time += tp
|
||||
time = min(max(round(time), 1), 600)
|
||||
saved_time = time
|
||||
|
||||
if(href_list["close"])
|
||||
usr << browse(null, "window=timer")
|
||||
return
|
||||
|
||||
if(usr)
|
||||
attack_self(usr)
|
||||
|
||||
+104
-101
@@ -1,101 +1,104 @@
|
||||
#define INCLUSIVE_MODE 1
|
||||
#define EXCLUSIVE_MODE 2
|
||||
#define RECOGNIZER_MODE 3
|
||||
#define VOICE_SENSOR_MODE 4
|
||||
|
||||
/obj/item/assembly/voice
|
||||
name = "voice analyzer"
|
||||
desc = "A small electronic device able to record a voice sample, and send a signal when that sample is repeated."
|
||||
icon_state = "voice"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
flags_1 = HEAR_1
|
||||
attachable = TRUE
|
||||
verb_say = "beeps"
|
||||
verb_ask = "beeps"
|
||||
verb_exclaim = "beeps"
|
||||
var/listening = FALSE
|
||||
var/recorded = "" //the activation message
|
||||
var/mode = 1
|
||||
var/static/list/modes = list("inclusive",
|
||||
"exclusive",
|
||||
"recognizer",
|
||||
"voice sensor")
|
||||
|
||||
/obj/item/assembly/voice/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>Use a multitool to swap between \"inclusive\", \"exclusive\", \"recognizer\", and \"voice sensor\" mode.</span>"
|
||||
|
||||
/obj/item/assembly/voice/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(speaker == src)
|
||||
return
|
||||
|
||||
if(listening && !radio_freq)
|
||||
record_speech(speaker, raw_message, message_language)
|
||||
else
|
||||
if(check_activation(speaker, raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/record_speech(atom/movable/speaker, raw_message, datum/language/message_language)
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", message_language)
|
||||
if(EXCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", message_language)
|
||||
if(RECOGNIZER_MODE)
|
||||
recorded = speaker.GetVoice()
|
||||
listening = FALSE
|
||||
say("Your voice pattern is saved.", message_language)
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/check_activation(atom/movable/speaker, raw_message)
|
||||
. = FALSE
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
if(findtext(raw_message, recorded))
|
||||
. = TRUE
|
||||
if(EXCLUSIVE_MODE)
|
||||
if(raw_message == recorded)
|
||||
. = TRUE
|
||||
if(RECOGNIZER_MODE)
|
||||
if(speaker.GetVoice() == recorded)
|
||||
. = TRUE
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
. = TRUE
|
||||
|
||||
/obj/item/assembly/voice/multitool_act(mob/living/user, obj/item/I)
|
||||
mode %= modes.len
|
||||
mode++
|
||||
to_chat(user, "<span class='notice'>You set [src] into [modes[mode]] mode.</span>")
|
||||
listening = FALSE
|
||||
recorded = ""
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/activate()
|
||||
if(!secured || holder)
|
||||
return FALSE
|
||||
listening = !listening
|
||||
say("[listening ? "Now" : "No longer"] recording input.")
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/attack_self(mob/user)
|
||||
if(!user)
|
||||
return FALSE
|
||||
activate()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/toggle_secure()
|
||||
. = ..()
|
||||
listening = FALSE
|
||||
|
||||
#undef INCLUSIVE_MODE
|
||||
#undef EXCLUSIVE_MODE
|
||||
#undef RECOGNIZER_MODE
|
||||
#undef VOICE_SENSOR_MODE
|
||||
#define INCLUSIVE_MODE 1
|
||||
#define EXCLUSIVE_MODE 2
|
||||
#define RECOGNIZER_MODE 3
|
||||
#define VOICE_SENSOR_MODE 4
|
||||
|
||||
/obj/item/assembly/voice
|
||||
name = "voice analyzer"
|
||||
desc = "A small electronic device able to record a voice sample, and send a signal when that sample is repeated."
|
||||
icon_state = "voice"
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=50)
|
||||
flags_1 = HEAR_1
|
||||
attachable = TRUE
|
||||
verb_say = "beeps"
|
||||
verb_ask = "beeps"
|
||||
verb_exclaim = "beeps"
|
||||
var/listening = FALSE
|
||||
var/recorded = "" //the activation message
|
||||
var/languages // The Message's language
|
||||
var/mode = 1
|
||||
var/static/list/modes = list("inclusive",
|
||||
"exclusive",
|
||||
"recognizer",
|
||||
"voice sensor")
|
||||
|
||||
/obj/item/assembly/voice/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>Use a multitool to swap between \"inclusive\", \"exclusive\", \"recognizer\", and \"voice sensor\" mode.</span>"
|
||||
|
||||
/obj/item/assembly/voice/Hear(message, atom/movable/speaker, message_language, raw_message, radio_freq, list/spans, message_mode, atom/movable/source)
|
||||
. = ..()
|
||||
if(speaker == src)
|
||||
return
|
||||
|
||||
if(listening && !radio_freq)
|
||||
record_speech(speaker, raw_message, message_language)
|
||||
else
|
||||
if(message_language == languages) // If it isn't in the same language as the message, don't try to find the message
|
||||
if(check_activation(speaker, raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/record_speech(atom/movable/speaker, raw_message, datum/language/message_language)
|
||||
languages = message_language // Assign the message's language to a variable to use it elsewhere
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", language = languages) // Say the message in the language it was said in
|
||||
if(EXCLUSIVE_MODE)
|
||||
recorded = raw_message
|
||||
listening = FALSE
|
||||
say("Activation message is '[recorded]'.", language = languages)
|
||||
if(RECOGNIZER_MODE)
|
||||
recorded = speaker.GetVoice()
|
||||
listening = FALSE
|
||||
say("Your voice pattern is saved.", language = languages)
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
addtimer(CALLBACK(src, .proc/pulse, 0), 10)
|
||||
|
||||
/obj/item/assembly/voice/proc/check_activation(atom/movable/speaker, raw_message)
|
||||
. = FALSE
|
||||
switch(mode)
|
||||
if(INCLUSIVE_MODE)
|
||||
if(findtext(raw_message, recorded))
|
||||
. = TRUE
|
||||
if(EXCLUSIVE_MODE)
|
||||
if(raw_message == recorded)
|
||||
. = TRUE
|
||||
if(RECOGNIZER_MODE)
|
||||
if(speaker.GetVoice() == recorded)
|
||||
. = TRUE
|
||||
if(VOICE_SENSOR_MODE)
|
||||
if(length(raw_message))
|
||||
. = TRUE
|
||||
|
||||
/obj/item/assembly/voice/multitool_act(mob/living/user, obj/item/I)
|
||||
mode %= modes.len
|
||||
mode++
|
||||
to_chat(user, "<span class='notice'>You set [src] into [modes[mode]] mode.</span>")
|
||||
listening = FALSE
|
||||
recorded = ""
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/activate()
|
||||
if(!secured || holder)
|
||||
return FALSE
|
||||
listening = !listening
|
||||
say("[listening ? "Now" : "No longer"] recording input.")
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/attack_self(mob/user)
|
||||
if(!user)
|
||||
return FALSE
|
||||
activate()
|
||||
return TRUE
|
||||
|
||||
/obj/item/assembly/voice/toggle_secure()
|
||||
. = ..()
|
||||
listening = FALSE
|
||||
|
||||
#undef INCLUSIVE_MODE
|
||||
#undef EXCLUSIVE_MODE
|
||||
#undef RECOGNIZER_MODE
|
||||
#undef VOICE_SENSOR_MODE
|
||||
|
||||
Reference in New Issue
Block a user