mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-16 17:44:25 +01:00
locks & keys
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
var/knock_sound = 'sound/machines/door/knock_glass.ogg'
|
||||
var/knock_hammer_sound = 'sound/weapons/sonic_jackhammer.ogg'
|
||||
|
||||
var/locked = FALSE //has the door been locked?
|
||||
var/lock_id = null //does the door have an associated key?
|
||||
var/keysound = 'sound/items/toolbelt_equip.ogg'
|
||||
|
||||
/obj/structure/simple_door/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
TemperatureAct(exposed_temperature)
|
||||
|
||||
@@ -97,6 +101,9 @@
|
||||
var/mob/M = user
|
||||
if(!material.can_open_material_door(user))
|
||||
return
|
||||
if(locked && state == 0)
|
||||
to_chat(M,"<span class='warning'>It's locked!</span>")
|
||||
return
|
||||
if(world.time - user.last_bumped <= 60)
|
||||
return
|
||||
if(M.client)
|
||||
@@ -147,13 +154,24 @@
|
||||
|
||||
/obj/structure/simple_door/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(istype(W,/obj/item/weapon/pickaxe))
|
||||
if(istype(W,/obj/item/weapon/simple_key))
|
||||
var/obj/item/weapon/simple_key/key = W
|
||||
if(state)
|
||||
to_chat(user,"<span class='notice'>\The [src] must be closed in order for you to lock it.</span>")
|
||||
else if(key.key_id != src.lock_id)
|
||||
to_chat(user,"<span class='warning'>The [key] doesn't fit \the [src]'s lock!</span>")
|
||||
else if(key.key_id == src.lock_id)
|
||||
visible_message("<span class='notice'>[user] [key.keyverb] \the [key] and [locked ? "unlocks" : "locks"] \the [src].</span>")
|
||||
locked = !locked
|
||||
playsound(src, keysound,100, 1)
|
||||
return
|
||||
if(istype(W,/obj/item/weapon/pickaxe) && breakable)
|
||||
var/obj/item/weapon/pickaxe/digTool = W
|
||||
visible_message("<span class='danger'>[user] starts digging [src]!</span>")
|
||||
if(do_after(user,digTool.digspeed*hardness) && src)
|
||||
visible_message("<span class='danger'>[user] finished digging [src]!</span>")
|
||||
Dismantle()
|
||||
else if(istype(W,/obj/item/weapon)) //not sure, can't not just weapons get passed to this proc?
|
||||
else if(istype(W,/obj/item/weapon) && breakable) //not sure, can't not just weapons get passed to this proc?
|
||||
hardness -= W.force/10
|
||||
visible_message("<span class='danger'>[user] hits [src] with [W]!</span>")
|
||||
if(material == get_material_by_name("resin"))
|
||||
@@ -163,7 +181,7 @@
|
||||
else
|
||||
playsound(src, 'sound/weapons/smash.ogg', 50, 1)
|
||||
CheckHardness()
|
||||
else if(istype(W,/obj/item/weapon/weldingtool))
|
||||
else if(istype(W,/obj/item/weapon/weldingtool) && breakable)
|
||||
var/obj/item/weapon/weldingtool/WT = W
|
||||
if(material.ignition_point && WT.remove_fuel(0, user))
|
||||
TemperatureAct(150)
|
||||
|
||||
Reference in New Issue
Block a user