Merge pull request #10046 from warior4356/Drill

Thermal Drill
This commit is contained in:
variableundefined
2018-11-09 17:11:36 +08:00
committed by GitHub
19 changed files with 265 additions and 37 deletions
@@ -0,0 +1,27 @@
/obj/item/thermal_drill
name = "thermal safe drill"
desc = "A tungsten carbide thermal drill with magnetic clamps for the purpose of drilling hardened objects. Guaranteed 100% jam proof."
icon = 'icons/obj/items.dmi'
icon_state = "hardened_drill"
w_class = WEIGHT_CLASS_GIGANTIC
force = 15.0
var/time_multiplier = 1
var/datum/looping_sound/thermal_drill/soundloop
var/datum/effect_system/spark_spread/spark_system
/obj/item/thermal_drill/New()
soundloop = new(list(src), FALSE)
spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(1, 0, src)
spark_system.attach(src)
/obj/item/thermal_drill/Destroy()
QDEL_NULL(soundloop)
QDEL_NULL(spark_system)
return ..()
/obj/item/thermal_drill/diamond_drill
name = "diamond tipped thermal safe drill"
desc = "A diamond tipped thermal drill with magnetic clamps for the purpose of quickly drilling hardened objects. Guaranteed 100% jam proof."
icon_state = "diamond_drill"
time_multiplier = 0.5
@@ -265,4 +265,15 @@
<font size = "1">This is a highly experimental prototype chemical designed to repair damaged bones of soldiers in the field, use only as a last resort. The autoinjector contains prototype nanites bearing a calcium based payload. The nanites will simultaneously shut down body systems whilst aiding bone repair.<BR><BR><BR>Warning: Side effects can cause temporary paralysis, loss of co-ordination and sickness. <B>Do not use with any kind of stimulant or drugs. Serious damage can occur!</B><BR><BR><BR>
To apply, hold the injector a short distance away from the outer thigh before applying firmly to the skin surface. Bones should begin repair after a short time, during which you are advised to remain still. <BR><BR><BR><BR>After use you are advised to see a doctor at the next available opportunity. Mild scarring and tissue damage may occur after use. This is a prototype.</font><BR><HR></font>
"}
"}
/obj/item/storage/box/syndie_kit/safecracking
name = "Safe-cracking Kit"
desc = "Everything you need to quietly open a mechanical combination safe."
/obj/item/storage/box/syndie_kit/safecracking/New()
..()
new /obj/item/clothing/gloves/color/latex/nitrile(src)
new /obj/item/clothing/mask/balaclava(src)
new /obj/item/clothing/accessory/stethoscope(src)
new /obj/item/book/manual/engineering_hacking(src)
+140 -14
View File
@@ -2,8 +2,12 @@
CONTAINS:
SAFES
FLOOR SAFES
Safe Codes
Safe Internals
*/
GLOBAL_LIST_EMPTY(safes)
//SAFES
/obj/structure/safe
name = "\improper Safe"
@@ -13,7 +17,7 @@ FLOOR SAFES
anchored = 1
density = 1
var/open = FALSE //is the safe open?
var/unlocked = FALSE
var/locked = TRUE
var/tumbler_1_pos //the tumbler position- from 0 to 72
var/tumbler_1_open //the tumbler position to open at- 0 to 72
var/tumbler_2_pos
@@ -23,9 +27,18 @@ FLOOR SAFES
var/space = 0 //the combined w_class of everything in the safe
var/maxspace = 24 //the maximum combined w_class of stuff in the safe
var/combo_to_open //so admins know the code
var/obj/item/thermal_drill/drill = null
var/drill_timer
var/time_to_drill
var/image/bar
var/drill_start_time
var/drill_x_offset = -13
var/drill_y_offset = -3
var/knownby = list()
/obj/structure/safe/New()
GLOB.safes += src
tumbler_2_pos = rand(0, 99) // first value in the combination set first
tumbler_2_open = rand(0, 99)
@@ -43,7 +56,8 @@ FLOOR SAFES
if(num2 > 99)
num2 = num2 - 100
combo_to_open = "Go right past [num1] twice then stop at [num1]. Go left past [num2] once then stop at [num2]. Turn right till it stops and its open."
combo_to_open = "[num1] - [num2]"
/obj/structure/safe/Initialize()
..()
@@ -57,9 +71,9 @@ FLOOR SAFES
/obj/structure/safe/proc/check_unlocked()
if(tumbler_1_pos == tumbler_1_open && tumbler_2_pos == tumbler_2_open && dial == open_pos)
unlocked = TRUE
locked = FALSE
return TRUE
unlocked = FALSE
locked = TRUE
return FALSE
/obj/structure/safe/proc/make_noise(turns, turns_total, tum1 = 0, tum2 = 0, mob/user, canhear)
@@ -74,20 +88,63 @@ FLOOR SAFES
to_chat(user, "<span class='italics'>You hear a [pick("tonk", "krunk", "plunk")] from [src].</span>")
if(tumbler_2_pos == tumbler_2_open && turns_total == 1 && tum2) // You cant hear tumblers if you spin fast!
to_chat(user, "<span class='italics'>You hear a [pick("tink", "krink", "plink")] from [src].</span>")
if(unlocked)
if(!locked)
if(user)
visible_message("<i><b>[pick("Spring", "Sprang", "Sproing", "Clunk", "Krunk")]!</b></i>")
/obj/structure/safe/update_icon()
if(open)
icon_state = "[initial(icon_state)]-open"
if(broken)
icon_state = "[initial(icon_state)]-open-broken"
else
icon_state = "[initial(icon_state)]-open"
else
icon_state = initial(icon_state)
if(broken)
icon_state = "[initial(icon_state)]-broken"
else
icon_state = initial(icon_state)
overlays.Cut()
if(istype(drill, /obj/item/thermal_drill/diamond_drill))
if(drill_timer)
overlays += image(icon = 'icons/effects/drill.dmi', icon_state = "[initial(icon_state)]_d-drill-on", pixel_x = drill_x_offset, pixel_y = drill_y_offset)
else
overlays += image(icon = 'icons/effects/drill.dmi', icon_state = "[initial(icon_state)]_d-drill-off", pixel_x = drill_x_offset, pixel_y = drill_y_offset)
else if(istype(drill, /obj/item/thermal_drill))
if(drill_timer)
overlays += image(icon = 'icons/effects/drill.dmi', icon_state = "[initial(icon_state)]_h-drill-on", pixel_x = drill_x_offset, pixel_y = drill_y_offset)
else
overlays += image(icon = 'icons/effects/drill.dmi', icon_state = "[initial(icon_state)]_h-drill-off", pixel_x = drill_x_offset, pixel_y = drill_y_offset)
/obj/structure/safe/attack_hand(mob/user)
if(..())
return TRUE
ui_interact(user)
if(drill)
switch(alert("What would you like to do?", "Thermal Drill", "Turn [drill_timer ? "Off" : "On"]", "Remove Drill", "Cancel"))
if("Turn On")
if(do_after(user, 2 SECONDS, target = src))
drill_timer = addtimer(CALLBACK(src, .proc/drill_open), time_to_drill)
drill_start_time = world.time
drill.soundloop.start()
update_icon()
processing_objects.Add(src)
if("Turn Off")
if(do_after(user, 2 SECONDS, target = src))
deltimer(drill_timer)
drill_timer = null
drill.soundloop.stop()
update_icon()
processing_objects.Remove(src)
if("Remove Drill")
if(drill_timer)
to_chat(user, "<span class='warning'>You cant remove the drill while it's running!</span>")
else if(do_after(user, 2 SECONDS, target = src))
user.put_in_hands(drill)
drill = null
update_icon()
if("Cancel")
return
else
ui_interact(user)
return
/obj/structure/safe/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
@@ -109,7 +166,7 @@ FLOOR SAFES
data["dial"] = dial
data["open"] = open
data["unlocked"] = unlocked
data["locked"] = locked
data["rotation"] = "[-dial*3.6]deg"
data["contents"] = contents_names
@@ -130,7 +187,7 @@ FLOOR SAFES
canhear = 1
if(href_list["open"])
if(check_unlocked() || open)
if(check_unlocked() || open || broken)
to_chat(user, "<span class='notice'>You [open ? "close" : "open"] [src].</span>")
open = !open
update_icon()
@@ -143,6 +200,9 @@ FLOOR SAFES
var/ticks = text2num(href_list["decrement"])
if(open)
return
if(broken)
to_chat(user, "The dial will not turn, the mechanism is destroyed.")
return
for(var/i=1 to ticks)
if(!check_unlocked())
dial = Wrap(dial - 1, 0 ,100)
@@ -162,6 +222,9 @@ FLOOR SAFES
var/ticks = text2num(href_list["increment"])
if(open)
return
if(broken)
to_chat(user, "The dial will not turn, the mechanism is destroyed.")
return
for(var/i=1 to ticks)
check_unlocked()
dial = Wrap(dial + 1, 0, 100)
@@ -194,7 +257,13 @@ FLOOR SAFES
/obj/structure/safe/attackby(obj/item/I, mob/user, params)
if(open)
if(I.w_class + space <= maxspace)
if(broken && istype(I, /obj/item/safe_internals) && do_after(user, 2 SECONDS, target = src))
to_chat(user, "You replace the broken mechanism.")
qdel(I)
broken = !broken
update_icon()
return
else if(I.w_class + space <= maxspace)
space += I.w_class
if(!user.drop_item())
to_chat(user, "<span class='warning'>\The [I] is stuck to your hand, you cannot put it in the safe!</span>")
@@ -210,10 +279,27 @@ FLOOR SAFES
if(istype(I, /obj/item/clothing/accessory/stethoscope))
to_chat(user, "<span class='warning'>Hold [I] in one of your hands while you manipulate the dial!</span>")
return
else if(istype(I, /obj/item/thermal_drill))
if(drill)
to_chat(user, "There is already a drill attached!")
else if(do_after(user, 2 SECONDS, target = src))
if(!user.drop_item())
to_chat(user, "<span class='warning'>[I] is stuck to your hand, you cannot put it in the safe!</span>")
return
I.loc = src
drill = I
time_to_drill = 300 SECONDS * drill.time_multiplier
update_icon()
else
to_chat(user, "<span class='warning'>You can't put [I] in into the safe while it is closed!</span>")
return
/obj/structure/safe/proc/drill_open()
broken = TRUE
drill_timer = null
drill.soundloop.stop()
update_icon()
processing_objects.Remove(src)
/obj/structure/safe/blob_act()
return
@@ -224,6 +310,24 @@ FLOOR SAFES
/obj/structure/safe/examine_status(mob/user)
return
/obj/structure/safe/Destroy()
GLOB.safes -= src
drill.soundloop.stop()
return ..()
/obj/structure/safe/process()
if(drill_timer)
overlays -= bar
bar = image('icons/effects/progessbar.dmi', src, "prog_bar_[round((((world.time - drill_start_time) / time_to_drill) * 100), 5)]", HUD_LAYER)
overlays += bar
if(prob(15))
drill.spark_system.start()
/obj/structure/safe/examine(mob/user)
..()
if(open)
to_chat(user, "On the inside of the the door is <b>[combo_to_open]</b>")
//FLOOR SAFES
/obj/structure/safe/floor
name = "floor safe"
@@ -231,13 +335,35 @@ FLOOR SAFES
density = 0
level = 1 //underfloor
layer = 2.5
drill_x_offset = -1
drill_y_offset = 20
/obj/structure/safe/floor/Initialize()
..()
var/turf/T = loc
hide(T.intact)
/obj/structure/safe/floor/hide(var/intact)
invisibility = intact ? 101 : 0
invisibility = intact ? 101 : 0
/obj/item/safe_internals
name = "safe internals"
desc = "The mechanism and locking bolts for a Scarborough Arms - 2 tumbler safe"
icon_state = "safe_internals"
/obj/item/paper/safe_code
name = "safe codes"
var/owner
info = "<div style='text-align:center;'><img src='ntlogo.png'><center><h3>Safe Codes</h3></center>"
/obj/item/paper/safe_code/New()
..()
addtimer(CALLBACK(src, .proc/populate_codes), 10)
/obj/item/paper/safe_code/proc/populate_codes()
for(var/safe in GLOB.safes)
var/obj/structure/safe/S = safe
if(owner in S.knownby)
info += "<br> The combination for the safe located in the [get_area(S).name] is: [S.combo_to_open]<br>"
info_links = info
update_icon()