Single tank bombs.

There's a couple of known issues, and they've not been tested, so they're unticked for now.

This includes some adjustments and fixes for other assembly stuff, and it also renames most tanks.

Shout at me if this breaks anything.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4644 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
petethegoat@gmail.com
2012-09-07 13:39:13 +00:00
parent aeaf790882
commit 6f27b40a96
10 changed files with 177 additions and 334 deletions

View File

@@ -11,8 +11,8 @@
* Oxygen
*/
/obj/item/weapon/tank/oxygen
name = "Gas Tank (Oxygen)"
desc = "A tank of oxygen"
name = "oxygen tank"
desc = "A tank of oxygen."
icon_state = "oxygen"
distribute_pressure = ONE_ATMOSPHERE*O2STANDARD
@@ -32,12 +32,10 @@
/obj/item/weapon/tank/oxygen/yellow
name = "Gas Tank (Oxygen)"
desc = "A tank of oxygen, this one is yellow."
icon_state = "oxygen_f"
/obj/item/weapon/tank/oxygen/red
name = "Gas Tank (Oxygen)"
desc = "A tank of oxygen, this one is red."
icon_state = "oxygen_fr"
@@ -46,8 +44,8 @@
* Anesthetic
*/
/obj/item/weapon/tank/anesthetic
name = "Gas Tank (Sleeping Agent)"
desc = "A N2O/O2 gas mix"
name = "anesthetic tank"
desc = "A tank with an N2O/O2 gas mix."
icon_state = "anesthetic"
item_state = "an_tank"
@@ -66,7 +64,7 @@
* Air
*/
/obj/item/weapon/tank/air
name = "Gas Tank (Air Mix)"
name = "air tank"
desc = "Mixed anyone?"
icon_state = "oxygen"
@@ -90,8 +88,8 @@
* Plasma
*/
/obj/item/weapon/tank/plasma
name = "Gas Tank (BIOHAZARD)"
desc = "Contains dangerous plasma. Do not inhale."
name = "plasma tank"
desc = "Contains dangerous plasma. Do not inhale. Warning: extremely flammable."
icon_state = "plasma"
flags = FPRINT | TABLEPASS | CONDUCT
slot_flags = null //they have no straps!
@@ -103,42 +101,6 @@
src.air_contents.toxins = (3*ONE_ATMOSPHERE)*70/(R_IDEAL_GAS_EQUATION*T20C)
return
/obj/item/weapon/tank/plasma/proc/release()
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles())
loc.assume_air(removed)
/obj/item/weapon/tank/plasma/proc/ignite()
var/fuel_moles = air_contents.toxins + air_contents.oxygen/6
var/strength = 1
var/turf/ground_zero = get_turf(loc)
loc = null
if(air_contents.temperature > (T0C + 400))
strength = fuel_moles/15
explosion(ground_zero, strength, strength*2, strength*3, strength*4)
else if(air_contents.temperature > (T0C + 250))
strength = fuel_moles/20
explosion(ground_zero, 0, strength, strength*2, strength*3)
else if(air_contents.temperature > (T0C + 100))
strength = fuel_moles/25
explosion(ground_zero, 0, 0, strength, strength*3)
else
ground_zero.assume_air(air_contents)
ground_zero.hotspot_expose(1000, 125)
if(src.master)
del(src.master)
del(src)
/obj/item/weapon/tank/plasma/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
@@ -180,11 +142,11 @@
usr << sound('sound/effects/alert.ogg')
/obj/item/weapon/tank/emergency_oxygen/engi
icon_state = "emergency_engi"
name = "extended-capacity emergency oxygen tank"
icon_state = "emergency_engi"
volume = 6
/obj/item/weapon/tank/emergency_oxygen/double
name = "double emergency oxygen tank"
icon_state = "emergency_double"
name = "Double Emergency Oxygen Tank"
volume = 10

View File

@@ -238,7 +238,10 @@
else if(pressure > TANK_RUPTURE_PRESSURE)
//world << "\blue[x],[y] tank is rupturing: [pressure] kPa, integrity [integrity]"
if(integrity <= 0)
loc.assume_air(air_contents)
var/turf/simulated/T = get_turf(src)
if(!T)
return
T.assume_air(air_contents)
playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3)
del(src)
else
@@ -247,8 +250,11 @@
else if(pressure > TANK_LEAK_PRESSURE)
//world << "\blue[x],[y] tank is leaking: [pressure] kPa, integrity [integrity]"
if(integrity <= 0)
var/turf/simulated/T = get_turf(src)
if(!T)
return
var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25)
loc.assume_air(leaked_gas)
T.assume_air(leaked_gas)
else
integrity--

View File

@@ -4,7 +4,6 @@
icon = 'icons/obj/assemblies/new_assemblies.dmi'
icon_state = ""
flags = FPRINT | TABLEPASS| CONDUCT
item_state = "electronic"
w_class = 2.0
m_amt = 100
g_amt = 0

View File

@@ -0,0 +1,153 @@
/obj/item/device/onetankbomb
name = "bomb"
icon = 'tank.dmi'
item_state = "assembly"
throwforce = 5
w_class = 3.0
throw_speed = 2
throw_range = 4
flags = FPRINT | TABLEPASS| CONDUCT //Copied this from old code, so this may or may not be necessary
var/status = 0 //0 - not readied //1 - bomb finished with welder
var/obj/item/device/assembly_holder/bombassembly = null //The first part of the bomb is an assembly holder, holding an igniter+some device
var/obj/item/weapon/tank/bombtank = null //the second part of the bomb is a plasma tank
/obj/item/device/onetankbomb/examine()
..()
bombtank.examine()
/obj/item/device/onetankbomb/update_icon()
if(bombtank)
icon_state = bombtank.icon_state
if(bombassembly)
overlays += bombassembly.icon_state
overlays += bombassembly.overlays
overlays += "bomb_assembly"
/obj/item/device/onetankbomb/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/device/analyzer))
bombtank.attackby(W, user)
return
if(istype(W, /obj/item/weapon/wrench) && !status) //This is basically bomb assembly code inverted. apparently it works.
user << "<span class='notice'>You disassemble [src].</span>"
bombassembly.loc = user.loc
bombassembly.master = null
bombassembly = null
bombtank.loc = user.loc
bombtank.master = null
bombtank = null
del(src)
return
if((istype(W, /obj/item/weapon/weldingtool) && W:welding))
if(!status)
status = 1
bombers += "[key_name(user)] welded a single tank bomb. Temp: [bombtank.air_contents.temperature-T0C]"
message_admins("[key_name_admin(user)] welded a single tank bomb. Temp: [bombtank.air_contents.temperature-T0C]")
user << "<span class='notice'>A pressure hole has been bored to [bombtank] valve. \The [bombtank] can now be ignited.</span>"
else
status = 0
bombers += "[key_name(user)] unwelded a single tank bomb. Temp: [bombtank.air_contents.temperature-T0C]"
user << "<span class='notice'>The hole has been closed.</span>"
add_fingerprint(user)
..()
/obj/item/device/onetankbomb/attack_self(mob/user as mob) //pressing the bomb accesses its assembly
bombassembly.attack_self(user, 1)
add_fingerprint(user)
return
/obj/item/device/onetankbomb/receive_signal() //This is mainly called by the sensor through sense() to the holder, and from the holder to here.
visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
sleep(10)
if(!src)
return
if(status)
bombtank.ignite() //if its not a dud, boom (or not boom if you made shitty mix) the ignite proc is below, in this file
/obj/item/device/onetankbomb/HasProximity(atom/movable/AM as mob|obj)
if(bombassembly)
bombassembly.HasProximity(AM)
// ---------- Procs below are for tanks that are used exclusively in 1-tank bombs ----------
/obj/item/weapon/tank/attackby(obj/item/weapon/W as obj, mob/user as mob) //Bomb assembly proc. This turns assembly+tank into a bomb
if(istype(W, /obj/item/device/assembly_holder))
var/obj/item/device/assembly_holder/S = W
if(!S.secured) //Check if the assembly is secured
return
if(isigniter(S.a_left) == isigniter(S.a_right)) //Check if either part of the assembly has an igniter, but if both parts are igniters, then fuck it
return
var/obj/item/device/onetankbomb/R = new /obj/item/device/onetankbomb(loc)
user.drop_item() //Remove the assembly from your hands
user.remove_from_mob(src) //Remove the tank from your character,in case you were holding it
user.put_in_hands(R) //Equips the bomb if possible, or puts it on the floor.
R.bombassembly = S //Tell the bomb about its assembly part
S.master = R //Tell the assembly about its new owner
S.loc = R //Move the assembly out of the fucking way
R.bombtank = src //Same for tank
master = R
loc = R
R.update_icon()
return
/obj/item/weapon/tank/proc/ignite() //This happens when a bomb is told to explode
var/fuel_moles = air_contents.toxins + air_contents.oxygen/6
var/strength = 1
var/turf/ground_zero = get_turf(loc)
loc = null
if(air_contents.temperature > (T0C + 400))
strength = (fuel_moles/15)
if(strength >=1)
explosion(ground_zero, round(strength,1), round(strength*2,1), round(strength*3,1), round(strength*4,1))
else if(strength >=0.5)
explosion(ground_zero, 0, 1, 2, 4)
else if(strength >=0.2)
explosion(ground_zero, -1, 0, 1, 2)
else
ground_zero.assume_air(air_contents)
ground_zero.hotspot_expose(1000, 125)
else if(air_contents.temperature > (T0C + 250))
strength = (fuel_moles/20)
if(strength >=1)
explosion(ground_zero, 0, round(strength,1), round(strength*2,1), round(strength*3,1))
else if (strength >=0.5)
explosion(ground_zero, -1, 0, 1, 2)
else
ground_zero.assume_air(air_contents)
ground_zero.hotspot_expose(1000, 125)
else if(air_contents.temperature > (T0C + 100))
strength = (fuel_moles/25)
if (strength >=1)
explosion(ground_zero, -1, 0, round(strength,1), round(strength*3,1))
else
ground_zero.assume_air(air_contents)
ground_zero.hotspot_expose(1000, 125)
else
ground_zero.assume_air(air_contents)
ground_zero.hotspot_expose(1000, 125)
if(master)
del(master)
del(src)
/obj/item/weapon/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out.
var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles())
var/turf/simulated/T = get_turf(src)
if(!T)
return
T.assume_air(removed)

View File

@@ -4,7 +4,6 @@
icon_state = "holder"
item_state = "assembly"
flags = FPRINT | TABLEPASS| CONDUCT
item_state = "electronic"
throwforce = 5
w_class = 2.0
throw_speed = 3
@@ -70,6 +69,8 @@
src.overlays += "[initial(a_right.icon_state)]_right"
for(var/O in a_right.attached_overlays)
overlays += "[O]_r"
if(master)
master.update_icon()
/* if(special_assembly)
special_assembly.update_icon()
@@ -176,6 +177,8 @@
a_right.pulsed(0)
if(a_left != D)
a_left.pulsed(0)
if(master)
master.receive_signal()
// if(special && special_assembly)
// if(!special_assembly == D)
// special_assembly.dothings()

View File

@@ -100,6 +100,8 @@
signal()
if(!radio_connection) return
var/datum/signal/signal = new
signal.source = src
signal.encryption = code

View File

@@ -37,8 +37,7 @@
timer_end()
if((!secured)||(cooldown > 0)) return 0
pulse(0)
for(var/mob/O in hearers(null, null))
O.show_message(text("\icon[] *beep* *beep*", src), 3, "*beep* *beep*", 2)
visible_message("\icon[src] *beep* *beep*", "*beep* *beep*")
cooldown = 2
spawn(10)
process_cooldown()