mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-22 11:36:38 +01:00
Bomb Disarmament
Added a wiring system to the nuclear bomb- Screwdriver the panel after recovering the nuke disc to open it up and play with the wires inside! Warning: if the bomb is set, you might just end up exploding faster if you play with the wrong wires...
This commit is contained in:
@@ -8,6 +8,8 @@ var/bomb_set
|
||||
density = 1
|
||||
var/deployable = 0.0
|
||||
var/extended = 0.0
|
||||
var/lighthack = 0
|
||||
var/opened = 0.0
|
||||
var/timeleft = 60.0
|
||||
var/timing = 0.0
|
||||
var/r_code = "ADMIN"
|
||||
@@ -15,15 +17,48 @@ var/bomb_set
|
||||
var/yes_code = 0.0
|
||||
var/safety = 1.0
|
||||
var/obj/item/weapon/disk/nuclear/auth = null
|
||||
var/list/wires = list()
|
||||
var/light_wire
|
||||
var/safety_wire
|
||||
var/timing_wire
|
||||
var/removal_stage = 0 // 0 is no removal, 1 is covers removed, 2 is covers open,
|
||||
// 3 is sealant open, 4 is unwrenched, 5 is removed from bolts.
|
||||
flags = FPRINT
|
||||
use_power = 0
|
||||
|
||||
proc //Bomb squad, go!
|
||||
nukehack_win(mob/user as mob)
|
||||
var/dat as text
|
||||
dat += "<TT><B>Nuclear Fission Explosive</B><BR>\nNuclear Device Wires:</A><HR>"
|
||||
for(var/wire in src.wires)
|
||||
dat += text("[wire] Wire: <A href='?src=\ref[src];wire=[wire];act=wire'>[src.wires[wire] ? "Mend" : "Cut"]</A> <A href='?src=\ref[src];wire=[wire];act=pulse'>Pulse</A><BR>")
|
||||
|
||||
dat += text("<HR>The device is [src.timing ? "shaking!" : "still"]<BR>")
|
||||
dat += text("The device is [src.safety ? "quiet" : "whirring"].<BR>")
|
||||
dat += text("The lights are [src.lighthack ? "static" : "functional"].<BR>")
|
||||
user << browse("<HTML><HEAD><TITLE>Bomb Defusion</TITLE></HEAD><BODY>[dat]</BODY></HTML>","window=nukebomb_hack")
|
||||
onclose(user, "nukebomb_hack")
|
||||
|
||||
|
||||
/obj/machinery/nuclearbomb/New()
|
||||
..()
|
||||
r_code = "[rand(10000, 99999.0)]"//Creates a random code upon object spawn.
|
||||
|
||||
src.wires["Red"] = 0
|
||||
src.wires["Blue"] = 0
|
||||
src.wires["Green"] = 0
|
||||
src.wires["Marigold"] = 0
|
||||
src.wires["Fuschia"] = 0
|
||||
src.wires["Black"] = 0
|
||||
src.wires["Pearl"] = 0
|
||||
var/list/w = list("Red","Blue","Green","Marigold","Black","Fuschia","Pearl")
|
||||
src.light_wire = pick(w)
|
||||
w -= src.light_wire
|
||||
src.timing_wire = pick(w)
|
||||
w -= src.timing_wire
|
||||
src.safety_wire = pick(w)
|
||||
w -= src.safety_wire
|
||||
|
||||
/obj/machinery/nuclearbomb/process()
|
||||
if (src.timing)
|
||||
bomb_set = 1 //So long as there is one nuke timing, it means one nuke is armed.
|
||||
@@ -36,6 +71,30 @@ var/bomb_set
|
||||
return
|
||||
|
||||
/obj/machinery/nuclearbomb/attackby(obj/item/weapon/O as obj, mob/user as mob)
|
||||
|
||||
if (istype(O, /obj/item/weapon/screwdriver))
|
||||
src.add_fingerprint(user)
|
||||
if (src.auth)
|
||||
if (src.opened == 0)
|
||||
src.opened = 1
|
||||
overlays += image(icon, "npanel_open")
|
||||
user << "You unscrew the control panel of [src]."
|
||||
|
||||
else
|
||||
src.opened = 0
|
||||
overlays -= image(icon, "npanel_open")
|
||||
user << "You screw the control panel of [src] back on."
|
||||
else
|
||||
if (src.opened == 0)
|
||||
user << "The [src] emits a buzzing noise, the panel staying locked in."
|
||||
if (src.opened == 1)
|
||||
src.opened = 0
|
||||
overlays -= image(icon, "npanel_open")
|
||||
user << "You screw the control panel of [src] back on."
|
||||
flick("nuclearbombc", src)
|
||||
|
||||
return
|
||||
|
||||
if (src.extended)
|
||||
if (istype(O, /obj/item/weapon/disk/nuclear))
|
||||
usr.drop_item()
|
||||
@@ -119,6 +178,8 @@ var/bomb_set
|
||||
|
||||
/obj/machinery/nuclearbomb/attack_hand(mob/user as mob)
|
||||
if (src.extended)
|
||||
if (src.opened)
|
||||
nukehack_win(user,50)
|
||||
user.set_machine(src)
|
||||
var/dat = text("<TT><B>Nuclear Fission Explosive</B><BR>\nAuth. Disk: <A href='?src=\ref[];auth=1'>[]</A><HR>", src, (src.auth ? "++++++++++" : "----------"))
|
||||
if (src.auth)
|
||||
@@ -145,8 +206,9 @@ var/bomb_set
|
||||
visible_message("\red With a steely snap, bolts slide out of [src] and anchor it to the flooring!")
|
||||
else
|
||||
visible_message("\red \The [src] makes a highly unpleasant crunching noise. It looks like the anchoring bolts have been cut.")
|
||||
flick("nuclearbombc", src)
|
||||
src.icon_state = "nuclearbomb1"
|
||||
if(!src.lighthack)
|
||||
flick("nuclearbombc", src)
|
||||
src.icon_state = "nuclearbomb1"
|
||||
src.extended = 1
|
||||
return
|
||||
|
||||
@@ -161,16 +223,55 @@ var/bomb_set
|
||||
else
|
||||
usr << "\red You adjust some panels to make [src] deployable."
|
||||
src.deployable = 1
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/nuclearbomb/Topic(href, href_list)
|
||||
..()
|
||||
if (!usr.canmove || usr.stat || usr.restrained())
|
||||
return
|
||||
if (!ishuman(usr))
|
||||
usr << "\red You don't have the dexterity to do this!"
|
||||
return 1
|
||||
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))))
|
||||
usr.set_machine(src)
|
||||
if(href_list["act"])
|
||||
var/temp_wire = href_list["wire"]
|
||||
if(href_list["act"] == "pulse")
|
||||
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
usr << "You need a multitool!"
|
||||
else
|
||||
if(src.wires[temp_wire])
|
||||
usr << "You can't pulse a cut wire."
|
||||
else
|
||||
if(src.light_wire == temp_wire)
|
||||
src.lighthack = !src.lighthack
|
||||
spawn(100) src.lighthack = !src.lighthack
|
||||
if(src.timing_wire == temp_wire)
|
||||
explode()
|
||||
if(src.safety_wire == temp_wire)
|
||||
src.safety = !src.safety
|
||||
spawn(100) src.safety = !src.safety
|
||||
if(src.safety == 1)
|
||||
visible_message("\blue The [src] quiets down.")
|
||||
if(!src.lighthack)
|
||||
if (src.icon_state == "nuclearbomb2")
|
||||
src.icon_state = "nuclearbomb1"
|
||||
else
|
||||
visible_message("\blue The [src] emits a quiet whirling noise!")
|
||||
if(href_list["act"] == "wire")
|
||||
if (!istype(usr.get_active_hand(), /obj/item/weapon/wirecutters))
|
||||
usr << "You need wirecutters!"
|
||||
else
|
||||
wires[temp_wire] = !wires[temp_wire]
|
||||
if(src.safety_wire == temp_wire)
|
||||
explode()
|
||||
if(src.timing_wire == temp_wire)
|
||||
if(!src.lighthack)
|
||||
if (src.icon_state == "nuclearbomb2")
|
||||
src.icon_state = "nuclearbomb1"
|
||||
src.timing = 0
|
||||
bomb_set = 0
|
||||
if(src.light_wire == temp_wire)
|
||||
src.lighthack = !src.lighthack
|
||||
|
||||
if (href_list["auth"])
|
||||
if (src.auth)
|
||||
src.auth.loc = src.loc
|
||||
@@ -211,14 +312,16 @@ var/bomb_set
|
||||
return
|
||||
src.timing = !( src.timing )
|
||||
if (src.timing)
|
||||
src.icon_state = "nuclearbomb2"
|
||||
if(!src.lighthack)
|
||||
src.icon_state = "nuclearbomb2"
|
||||
if(!src.safety)
|
||||
bomb_set = 1//There can still be issues with this reseting when there are multiple bombs. Not a big deal tho for Nuke/N
|
||||
else
|
||||
bomb_set = 0
|
||||
else
|
||||
src.icon_state = "nuclearbomb1"
|
||||
bomb_set = 0
|
||||
if(!src.lighthack)
|
||||
src.icon_state = "nuclearbomb1"
|
||||
if (href_list["safety"])
|
||||
src.safety = !( src.safety )
|
||||
if(safety)
|
||||
@@ -266,7 +369,8 @@ var/bomb_set
|
||||
src.timing = -1.0
|
||||
src.yes_code = 0
|
||||
src.safety = 1
|
||||
src.icon_state = "nuclearbomb3"
|
||||
if(!src.lighthack)
|
||||
src.icon_state = "nuclearbomb3"
|
||||
playsound(src,'sound/machines/Alarm.ogg',100,0,5)
|
||||
if (ticker && ticker.mode)
|
||||
ticker.mode.explosion_in_progress = 1
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 81 KiB |
Reference in New Issue
Block a user