Files
Paradise/code/game/objects/grenades/chem_grenade.dm
T
giacomand@gmail.com 7575c9a9cf -Added a new global list. Cameras will hold every camera created and is kept up to date by the Camera's New() and Del(). Much faster than having everything loop the world. AI camera movement seems faster too.
-Fixed Issue 415

-Tweaked creating new cameras. When you create a camera from a camera assembly, it will now auto detect the direction it should be in. I also added a confirmation message which allows you to re choose the direction with up to 5 chances; to avoid infinite loops.

-Made the New Player Options window a little bit slimmer.

-Forgot to add a changelog for my last commit.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4096 316c924e-a436-60f5-8080-3fe189b3f50e
2012-07-17 16:23:47 +00:00

280 lines
9.7 KiB
Plaintext

/obj/item/weapon/grenade/chem_grenade
name = "Grenade Casing"
icon_state = "chemg"
item_state = "flashbang"
w_class = 2.0
force = 2.0
var/stage = 0
var/state = 0
var/path = 0
var/motion = 0
var/direct = "SOUTH"
var/obj/item/weapon/circuitboard/circuit = null
var/list/beakers = new/list()
var/list/allowed_containers = list("/obj/item/weapon/reagent_containers/glass/beaker", "/obj/item/weapon/reagent_containers/glass/dispenser", "/obj/item/weapon/reagent_containers/glass/bottle")
var/affected_area = 3
New()
var/datum/reagents/R = new/datum/reagents(1000)
reagents = R
R.my_atom = src
attackby(obj/item/weapon/W as obj, mob/user as mob)//TODO:Have grenades use the new assembly things
if(istype(W,/obj/item/device/assembly_holder) && !stage && path != 2)
path = 1
user << "\blue You add [W] to the metal casing."
playsound(src.loc, 'Screwdriver2.ogg', 25, -3)
del(W) //Okay so we're not really adding anything here. cheating.
icon_state = initial(icon_state) +"_ass"
name = "unsecured grenade"
stage = 1
else if(istype(W,/obj/item/weapon/screwdriver) && stage == 1 && path != 2)
path = 1
if(beakers.len)
user << "\blue You lock the assembly."
playsound(src.loc, 'Screwdriver.ogg', 25, -3)
name = "grenade"
icon_state = initial(icon_state) +"_locked"
stage = 2
else
user << "\red You need to add at least one beaker before locking the assembly."
else if ((istype(W,/obj/item/weapon/reagent_containers/glass/beaker)||istype(W,/obj/item/weapon/reagent_containers/glass/dispenser)||istype(W,/obj/item/weapon/reagent_containers/glass/bottle)) && stage == 1 && path != 2)
path = 1
if(beakers.len == 2)
user << "\red The grenade can not hold more containers."
return
else
if(W.reagents.total_volume)
user << "\blue You add \the [W] to the assembly."
user.drop_item()
W.loc = src
beakers += W
else
user << "\red \the [W] is empty."
else if(path != 1)
if(!istype(src.loc,/turf))
user << "\red You need to put the canister on the ground to do that!"
else
switch(state)
if(0)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'Ratchet.ogg', 50, 1)
if(do_after(user, 20))
user << "\blue You wrench the canister in place."
src.name = "Camera Assembly"
src.anchored = 1
src.state = 1
path = 2
if(1)
if(istype(W, /obj/item/weapon/wrench))
playsound(src.loc, 'Ratchet.ogg', 50, 1)
if(do_after(user, 20))
user << "\blue You unfasten the canister."
src.name = "Grenade Casing"
src.anchored = 0
src.state = 0
path = 0
if(istype(W, /obj/item/device/multitool))
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
user << "\blue You place the electronics inside the canister."
src.circuit = W
user.drop_item()
W.loc = src
if(istype(W, /obj/item/weapon/screwdriver) && circuit)
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "\blue You screw the circuitry into place."
src.state = 2
if(istype(W, /obj/item/weapon/crowbar) && circuit)
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the circuitry."
src.state = 1
circuit.loc = src.loc
src.circuit = null
if(2)
if(istype(W, /obj/item/weapon/screwdriver) && circuit)
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "\blue You unfasten the circuitry."
src.state = 1
if(istype(W, /obj/item/weapon/cable_coil))
if(W:amount >= 1)
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
W:amount -= 1
if(!W:amount) del(W)
user << "\blue You add cabling to the canister."
src.state = 3
if(3)
if(istype(W, /obj/item/weapon/wirecutters))
playsound(src.loc, 'wirecutter.ogg', 50, 1)
user << "\blue You remove the cabling."
src.state = 2
var/obj/item/weapon/cable_coil/A = new /obj/item/weapon/cable_coil( src.loc )
A.amount = 1
if(issignaler(W))
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
user << "\blue You attach the wireless signaller unit to the circutry."
user.drop_item()
W.loc = src
src.state = 4
if(4)
if(istype(W, /obj/item/weapon/crowbar) && !motion)
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the remote signalling device."
src.state = 3
new /obj/item/device/assembly/signaler( src.loc, 1 )
if(isprox(W) && motion == 0)
// if(W:amount >= 1)
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
// W:use(1)
user << "\blue You attach the proximity sensor."
user.drop_item()
W.loc = src
motion = 1
if(istype(W, /obj/item/weapon/crowbar) && motion)
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the proximity sensor."
new /obj/item/device/assembly/prox_sensor( src.loc, 1 )
motion = 0
if(istype(W, /obj/item/stack/sheet/glass))
if(W:amount >= 1)
playsound(src.loc, 'Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
W:use(1)
user << "\blue You put in the glass lens."
src.state = 5
if(5)
if(istype(W, /obj/item/weapon/crowbar))
playsound(src.loc, 'Crowbar.ogg', 50, 1)
user << "\blue You remove the glass lens."
src.state = 4
new /obj/item/stack/sheet/glass( src.loc, 2 )
if(istype(W, /obj/item/weapon/screwdriver))
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
user << "\blue You connect the lense."
var/obj/machinery/camera/B = null
if(motion == 1)
B = new /obj/machinery/camera/motion( src.loc )
else
B = new /obj/machinery/camera( src.loc )
// To prevent people exploiting the fact that it doesn't delete the assembly until the user is done
// entering the camera options.
src.loc = B
//Auto detect walls and turn camera based on wall locations.
B.auto_turn()
B.network = "SS13"
B.network = input(usr, "Which network would you like to connect this camera to?", "Set Network", "SS13")
for(var/i = 5; i >= 0; i -= 1)
direct = input(user, "Direction?", "Assembling Camera", null) in list("LEAVE IT", "NORTH", "EAST", "SOUTH", "WEST" )
if(direct != "LEAVE IT")
B.dir = text2dir(direct)
if(i != 0)
var/confirm = alert(user, "Is this what you want? Chances Remaining: [i]", "Confirmation", "Yes", "No")
if(confirm == "Yes")
break
del(src)
prime()
if(prob(reliability))
var/has_reagents = 0
for(var/obj/item/weapon/reagent_containers/glass/G in beakers)
if(G.reagents.total_volume) has_reagents = 1
if(!has_reagents)
playsound(src.loc, 'Screwdriver2.ogg', 50, 1)
state = 0
return
playsound(src.loc, 'bamf.ogg', 50, 1)
for(var/obj/item/weapon/reagent_containers/glass/G in beakers)
G.reagents.trans_to(src, G.reagents.total_volume)
if(src.reagents.total_volume) //The possible reactions didnt use up all reagents.
var/datum/effect/effect/system/steam_spread/steam = new /datum/effect/effect/system/steam_spread()
steam.set_up(10, 0, get_turf(src))
steam.attach(src)
steam.start()
for(var/atom/A in view(affected_area, src.loc))
if( A == src ) continue
src.reagents.reaction(A, 1, 10)
invisibility = 100 //Why am i doing this?
spawn(50) //To make sure all reagents can work
del(src) //correctly before deleting the grenade.
else
icon_state = initial(icon_state) + "_locked"
crit_fail = 1
for(var/obj/item/weapon/reagent_containers/glass/G in beakers)
G.loc = get_turf(src.loc)
/obj/item/weapon/grenade/chem_grenade/large
name = "Large Chem Grenade"
desc = "An oversized grenade that affects a larger area."
icon_state = "large_grenade"
allowed_containers = list("/obj/item/weapon/reagent_containers/glass")
origin_tech = "combat=3;materials=3"
affected_area = 4
/obj/item/weapon/grenade/chem_grenade/metalfoam
name = "Metal-Foam Grenade"
desc = "Used for emergency sealing of air breaches."
path = 1
stage = 2
New()
..()
var/obj/item/weapon/reagent_containers/glass/beaker/B1 = new(src)
var/obj/item/weapon/reagent_containers/glass/beaker/B2 = new(src)
B1.reagents.add_reagent("aluminum", 30)
B2.reagents.add_reagent("foaming_agent", 10)
B2.reagents.add_reagent("pacid", 10)
beakers += B1
beakers += B2
icon_state = "grenade"
/obj/item/weapon/grenade/chem_grenade/incendiary
name = "Incendiary Grenade"
desc = "Used for clearing rooms of living things."
path = 1
stage = 2
New()
..()
var/obj/item/weapon/reagent_containers/glass/beaker/B1 = new(src)
var/obj/item/weapon/reagent_containers/glass/beaker/B2 = new(src)
B1.reagents.add_reagent("aluminum", 25)
B2.reagents.add_reagent("plasma", 25)
B2.reagents.add_reagent("acid", 25)
beakers += B1
beakers += B2
icon_state = "grenade"
/obj/item/weapon/grenade/chem_grenade/cleaner
name = "Cleaner Grenade"
desc = "BLAM!-brand foaming space cleaner. In a special applicator for rapid cleaning of wide areas."
stage = 2
path = 1
New()
..()
var/obj/item/weapon/reagent_containers/glass/beaker/B1 = new(src)
var/obj/item/weapon/reagent_containers/glass/beaker/B2 = new(src)
B1.reagents.add_reagent("fluorosurfactant", 40)
B2.reagents.add_reagent("water", 40)
B2.reagents.add_reagent("cleaner", 10)
beakers += B1
beakers += B2
icon_state = "grenade"