mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 21:12:24 +01:00
Material door updates: lock and damage (#5659)
-ported locks and keys from baystation -fixed the simple door damage interaction, now you can properly destroy it and etc
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/obj/item/weapon/key
|
||||
name = "key"
|
||||
desc = "Used to unlock things."
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "keys"
|
||||
w_class = 1
|
||||
var/key_data = ""
|
||||
|
||||
/obj/item/weapon/key/New(var/newloc,var/data)
|
||||
if(data)
|
||||
key_data = data
|
||||
..(newloc)
|
||||
|
||||
/obj/item/weapon/key/proc/get_data(var/mob/user)
|
||||
return key_data
|
||||
|
||||
/obj/item/weapon/key/soap
|
||||
name = "soap key"
|
||||
desc = "a fragile key made using a bar of soap."
|
||||
var/uses = 0
|
||||
|
||||
/obj/item/weapon/key/soap/get_data(var/mob/user)
|
||||
uses--
|
||||
if(uses <= 0)
|
||||
user.drop_from_inventory(src,user)
|
||||
to_chat(user, "<span class='warning'>\The [src] crumbles in your hands!</span>")
|
||||
qdel(src)
|
||||
return ..()
|
||||
@@ -0,0 +1,81 @@
|
||||
#define LOCK_LOCKED 1
|
||||
#define LOCK_BROKEN 2
|
||||
|
||||
|
||||
/datum/lock
|
||||
var/status = 1 //unlocked, 1 == locked 2 == broken
|
||||
var/lock_data = "" //basically a randomized string. The longer the string the more complex the lock.
|
||||
var/atom/holder
|
||||
|
||||
/datum/lock/New(var/atom/h, var/complexity = 1)
|
||||
holder = h
|
||||
if(istext(complexity))
|
||||
lock_data = complexity
|
||||
else
|
||||
lock_data = generateRandomString(complexity)
|
||||
|
||||
/datum/lock/Destroy()
|
||||
holder = null
|
||||
..()
|
||||
|
||||
/datum/lock/proc/unlock(var/key = "", var/mob/user)
|
||||
if(status ^ LOCK_LOCKED)
|
||||
to_chat(user, "<span class='warning'>Its already unlocked!</span>")
|
||||
return 2
|
||||
key = get_key_data(key, user)
|
||||
if(cmptext(lock_data,key) && (status ^ LOCK_BROKEN))
|
||||
to_chat(user, "<span class='warning'>You unlock the lock.</span>")
|
||||
status &= ~LOCK_LOCKED
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/lock/proc/lock(var/key = "", var/mob/user)
|
||||
if(status & LOCK_LOCKED)
|
||||
to_chat(user, "<span class='warning'>Its already locked!</span>")
|
||||
return 2
|
||||
key = get_key_data(key, user)
|
||||
if(cmptext(lock_data,key) && (status ^ LOCK_BROKEN))
|
||||
to_chat(user, "<span class='warning'>You close the lock.</span>")
|
||||
status |= LOCK_LOCKED
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/lock/proc/toggle(var/key = "", var/mob/user)
|
||||
if(status & LOCK_LOCKED)
|
||||
return unlock(key, user)
|
||||
else
|
||||
return lock(key, user)
|
||||
|
||||
/datum/lock/proc/getComplexity()
|
||||
return length(lock_data)
|
||||
|
||||
/datum/lock/proc/get_key_data(var/key = "", var/mob/user)
|
||||
if(istype(key,/obj/item/weapon/key))
|
||||
var/obj/item/weapon/key/K = key
|
||||
return K.get_data(user)
|
||||
if(istext(key))
|
||||
return key
|
||||
return null
|
||||
|
||||
/datum/lock/proc/isLocked()
|
||||
return status & LOCK_LOCKED
|
||||
|
||||
/datum/lock/proc/pick_lock(var/obj/item/I, var/mob/user)
|
||||
if(!istype(I) || (status ^ LOCK_LOCKED))
|
||||
return 0
|
||||
var/unlock_power = I.lock_picking_level
|
||||
if(!unlock_power)
|
||||
return 0
|
||||
user.visible_message("\The [user] takes out \the [I], picking \the [holder]'s lock.")
|
||||
if(!do_after(user, 20, holder))
|
||||
return 0
|
||||
if(prob(20*(unlock_power/getComplexity())))
|
||||
to_chat(user, "<span class='notice'>You pick open \the [holder]'s lock!</span>")
|
||||
unlock(lock_data)
|
||||
return 1
|
||||
else if(prob(5 * unlock_power))
|
||||
to_chat(user, "<span class='warning'>You accidently break \the [holder]'s lock with \the [I]!</span>")
|
||||
status |= LOCK_BROKEN
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You fail to pick open \the [holder].</span>")
|
||||
return 0
|
||||
@@ -0,0 +1,30 @@
|
||||
/obj/item/weapon/material/lock_construct
|
||||
name = "lock"
|
||||
desc = "A crude but useful lock and bolt."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "largebinemag"
|
||||
w_class = 1
|
||||
var/lock_data
|
||||
|
||||
/obj/item/weapon/material/lock_construct/New()
|
||||
..()
|
||||
force = 0
|
||||
throwforce = 0
|
||||
lock_data = generateRandomString(round(material.integrity/50))
|
||||
|
||||
/obj/item/weapon/material/lock_construct/attackby(var/obj/item/I, var/mob/user)
|
||||
if(istype(I,/obj/item/weapon/key))
|
||||
var/obj/item/weapon/key/K = I
|
||||
if(!K.key_data)
|
||||
to_chat(user, "<span class='notice'>You fashion \the [I] to unlock \the [src]</span>")
|
||||
K.key_data = lock_data
|
||||
else
|
||||
to_chat(user, "<span class='warning'>\The [I] already unlocks something.</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/weapon/material/lock_construct/proc/create_lock(var/atom/target, var/mob/user)
|
||||
. = new /datum/lock(target,lock_data)
|
||||
user.drop_from_inventory(src,user)
|
||||
user.visible_message("<span class='notice'>\The [user] attaches \the [src] to \the [target].</span>")
|
||||
qdel(src)
|
||||
@@ -13,11 +13,12 @@
|
||||
recipes += new/datum/stack_recipe("[display_name] armor plate", /obj/item/weapon/material/armor_plating, 3, time = 20, on_floor = 1, supplied_material = "[name]")
|
||||
|
||||
if(integrity>=50)
|
||||
recipes += new/datum/stack_recipe("[display_name] door", /obj/structure/simple_door, 10, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
|
||||
recipes += new/datum/stack_recipe("[display_name] door", /obj/structure/simple_door, 10, time = 50, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
|
||||
recipes += new/datum/stack_recipe("[display_name] barricade", /obj/structure/barricade, 5, time = 50, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
|
||||
recipes += new/datum/stack_recipe("[display_name] stool", /obj/item/weapon/stool, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
|
||||
recipes += new/datum/stack_recipe("[display_name] chair", /obj/structure/bed/chair, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
|
||||
recipes += new/datum/stack_recipe("[display_name] bed", /obj/structure/bed, 2, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
|
||||
recipes += new/datum/stack_recipe("[display_name] lock",/obj/item/weapon/material/lock_construct, 1, time = 20, one_per_turf = 0, on_floor = 1, supplied_material = "[name]")
|
||||
if(hardness>=10)
|
||||
recipes += new/datum/stack_recipe("[display_name] ashtray", /obj/item/weapon/material/ashtray, 2, one_per_turf = 1, on_floor = 1, supplied_material = "[name]")
|
||||
if(hardness>50)
|
||||
@@ -44,6 +45,7 @@
|
||||
new/datum/stack_recipe("green comfy chair", /obj/structure/bed/chair/comfy/green, 2, one_per_turf = 1, on_floor = 1), \
|
||||
))
|
||||
|
||||
recipes += new/datum/stack_recipe("key", /obj/item/weapon/key, 1, time = 10, one_per_turf = 0, on_floor = 1)
|
||||
recipes += new/datum/stack_recipe("table frame", /obj/structure/table, 1, time = 10, one_per_turf = 1, on_floor = 1)
|
||||
recipes += new/datum/stack_recipe("custodial cart", /obj/structure/janitorialcart, 15, time = 120, one_per_turf = 1, on_floor = 1)
|
||||
recipes += new/datum/stack_recipe("rack", /obj/structure/table/rack, 1, time = 5, one_per_turf = 1, on_floor = 1)
|
||||
|
||||
@@ -114,6 +114,8 @@ var/list/name_to_material
|
||||
var/tableslam_noise = 'sound/weapons/tablehit1.ogg'
|
||||
// Noise made when a simple door made of this material opens or closes.
|
||||
var/dooropen_noise = 'sound/effects/stonedoor_openclose.ogg'
|
||||
// Noise made when you hit structure made of this material.
|
||||
var/hitsound = 'sound/weapons/genhit.ogg'
|
||||
// Path to resulting stacktype. Todo remove need for this.
|
||||
var/stack_type
|
||||
// Wallrot crumble message.
|
||||
@@ -280,6 +282,7 @@ var/list/name_to_material
|
||||
conductivity = 1
|
||||
shard_type = SHARD_SHARD
|
||||
tableslam_noise = 'sound/effects/Glasshit.ogg'
|
||||
hitsound = 'sound/effects/Glasshit.ogg'
|
||||
hardness = 100
|
||||
stack_origin_tech = list(TECH_MATERIAL = 6)
|
||||
golem = "Diamond Golem"
|
||||
@@ -384,6 +387,7 @@ var/list/name_to_material
|
||||
icon_reinf = "reinf_over"
|
||||
icon_colour = "#666666"
|
||||
golem = "Steel Golem"
|
||||
hitsound = 'sound/weapons/smash.ogg'
|
||||
|
||||
/material/diona
|
||||
name = "biomass"
|
||||
@@ -420,6 +424,7 @@ var/list/name_to_material
|
||||
stack_origin_tech = list(TECH_MATERIAL = 2)
|
||||
composite_material = list(DEFAULT_WALL_MATERIAL = 3750, "platinum" = 3750) //todo
|
||||
golem = "Plasteel Golem"
|
||||
hitsound = 'sound/weapons/smash.ogg'
|
||||
|
||||
/material/plasteel/titanium
|
||||
name = "titanium"
|
||||
@@ -636,6 +641,7 @@ var/list/name_to_material
|
||||
sheet_singular_name = "ingot"
|
||||
sheet_plural_name = "ingots"
|
||||
golem = "Iron Golem"
|
||||
hitsound = 'sound/weapons/smash.ogg'
|
||||
|
||||
// Adminspawn only, do not let anyone get this.
|
||||
/material/voxalloy
|
||||
@@ -677,6 +683,7 @@ var/list/name_to_material
|
||||
sheet_singular_name = "plank"
|
||||
sheet_plural_name = "planks"
|
||||
golem = "Wood Golem"
|
||||
hitsound = 'sound/effects/woodhit.ogg'
|
||||
|
||||
/material/rust
|
||||
name = "rust"
|
||||
|
||||
@@ -1513,6 +1513,24 @@
|
||||
var/obj/effect/golemrune/Z = new /obj/effect/golemrune
|
||||
Z.forceMove(get_turf(holder.my_atom))
|
||||
|
||||
/datum/chemical_reaction/soap_key
|
||||
name = "Soap Key"
|
||||
id = "skey"
|
||||
result = null
|
||||
required_reagents = list("triglyceride" = 2, "water" = 2, "cleaner" = 3)
|
||||
var/strength = 3
|
||||
|
||||
/datum/chemical_reaction/soap_key/can_happen(var/datum/reagents/holder)
|
||||
if(holder.my_atom && istype(holder.my_atom, /obj/item/weapon/soap))
|
||||
return ..()
|
||||
return 0
|
||||
|
||||
/datum/chemical_reaction/soap_key/on_reaction(var/datum/reagents/holder)
|
||||
var/obj/item/weapon/soap/S = holder.my_atom
|
||||
if(S.key_data)
|
||||
var/obj/item/weapon/key/soap/key = new(get_turf(holder.my_atom), S.key_data)
|
||||
key.uses = strength
|
||||
..()
|
||||
|
||||
/*
|
||||
====================
|
||||
|
||||
Reference in New Issue
Block a user