[Ready For Review] Unapologetic Vaurca Buffs II: Attack of the K'ois (#4083)

Implements Black K'ois
Implements K'ois Mycosis
Implements Black K'ois Mycosis
Buffs K'ois' healing properties for Vaurca
Vaurca can now control where they bite
This commit is contained in:
LordFowl
2018-01-27 10:52:30 -05:00
committed by Erki
parent 08d026884f
commit e656f2743c
19 changed files with 692 additions and 352 deletions
+2 -2
View File
@@ -48,8 +48,8 @@
owner.organs -= src
if(owner.organs_by_name)
owner.organs_by_name -= src
owner = null
owner = null
QDEL_NULL(dna)
return ..()
-321
View File
@@ -174,324 +174,3 @@
icon_state = "appendixinflamed"
name = "inflamed appendix"
..()
//VAURCA ORGANS
/obj/item/organ/heart/left
name = "heart"
icon_state = "heart-on"
organ_tag = "left heart"
parent_organ = "chest"
dead_icon = "heart-off"
/obj/item/organ/heart/right
name = "heart"
icon_state = "heart-on"
organ_tag = "right heart"
parent_organ = "chest"
dead_icon = "heart-off"
/obj/item/organ/vaurca/neuralsocket
name = "neural socket"
organ_tag = "neural socket"
icon = 'icons/mob/alien.dmi'
icon_state = "neural_socket"
parent_organ = "head"
robotic = 2
obj/item/organ/vaurca/neuralsocket/process()
if (is_broken())
if (all_languages[LANGUAGE_VAURCA] in owner.languages)
owner.remove_language(LANGUAGE_VAURCA)
owner << "<span class='warning'>Your mind suddenly grows dark as the unity of the Hive is torn from you.</span>"
else
if (!(all_languages[LANGUAGE_VAURCA] in owner.languages))
owner.add_language(LANGUAGE_VAURCA)
owner << "<span class='notice'> Your mind expands, and your thoughts join the unity of the Hivenet.</span>"
..()
/obj/item/organ/vaurca/neuralsocket/replaced(var/mob/living/carbon/human/target)
if (!(all_languages[LANGUAGE_VAURCA] in owner.languages))
owner.add_language(LANGUAGE_VAURCA)
owner << "<span class='notice'> Your mind expands, and your thoughts join the unity of the Hivenet.</span>"
..()
/obj/item/organ/vaurca/neuralsocket/removed(var/mob/living/carbon/human/target)
if(all_languages[LANGUAGE_VAURCA] in target.languages)
target.remove_language(LANGUAGE_VAURCA)
target << "<span class='warning'>Your mind suddenly grows dark as the unity of the Hive is torn from you.</span>"
..()
/obj/item/organ/vaurca/filtrationbit
name = "filtration bit"
organ_tag = "filtration bit"
parent_organ = "head"
icon = 'icons/mob/alien.dmi'
icon_state = "filter"
robotic = 2
/obj/item/organ/vaurca/preserve
name = "phoron reserve tank"
organ_tag = "phoron reserve tank"
parent_organ = "chest"
icon = 'icons/mob/alien.dmi'
icon_state = "breathing_app"
robotic = 1
var/datum/gas_mixture/air_contents = null
var/distribute_pressure = ((2*ONE_ATMOSPHERE)*O2STANDARD)
var/volume = 50
var/manipulated_by = null
/obj/item/organ/vaurca/preserve/Initialize()
. = ..()
air_contents = new /datum/gas_mixture()
air_contents.adjust_gas("phoron", (ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
air_contents.volume = volume //liters
air_contents.temperature = T20C
distribute_pressure = ((pick(2.4,2.8,3.2,3.6)*ONE_ATMOSPHERE)*O2STANDARD)
START_PROCESSING(SSprocessing, src)
var/mob/living/carbon/location = loc
location.internal = src
usr << "<span class='notice'>You open \the [src] valve.</span>"
if (location.internals)
location.internals.icon_state = "internal1"
return
/obj/item/organ/vaurca/preserve/Destroy()
if(air_contents)
qdel(air_contents)
STOP_PROCESSING(SSprocessing, src)
return ..()
/obj/item/organ/vaurca/preserve/examine(mob/user)
. = ..(user, 0)
if(.)
var/celsius_temperature = air_contents.temperature - T0C
var/descriptive
switch(celsius_temperature)
if(300 to INFINITY)
descriptive = "furiously hot"
if(100 to 300)
descriptive = "hot"
if(80 to 100)
descriptive = "warm"
if(40 to 80)
descriptive = "lukewarm"
if(20 to 40)
descriptive = "room temperature"
else
descriptive = "cold"
user << "<span class='notice'>\The [src] feels [descriptive].</span>"
/obj/item/organ/vaurca/preserve/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
var/obj/icon = src
if ((istype(W, /obj/item/device/analyzer)) && get_dist(user, src) <= 1)
for (var/mob/O in viewers(user, null))
O << "<span class='warning'>[user] has used [W] on \icon[icon] [src]</span>"
var/pressure = air_contents.return_pressure()
manipulated_by = user.real_name //This person is aware of the contents of the tank.
var/total_moles = air_contents.total_moles
user << "<span class='notice'>Results of analysis of \icon[icon]</span>"
if (total_moles>0)
user << "<span class='notice'>Pressure: [round(pressure,0.1)] kPa</span>"
for(var/g in air_contents.gas)
user << "<span class='notice'>[gas_data.name[g]]: [(round(air_contents.gas[g] / total_moles) * 100)]%</span>"
user << "<span class='notice'>Temperature: [round(air_contents.temperature-T0C)]&deg;C</span>"
else
user << "<span class='notice'>Tank is empty!</span>"
src.add_fingerprint(user)
else if (istype(W,/obj/item/latexballon))
var/obj/item/latexballon/LB = W
LB.blow(src)
src.add_fingerprint(user)
/obj/item/organ/vaurca/preserve/attack_self(mob/user as mob)
if (!(src.air_contents))
return
ui_interact(user)
/obj/item/organ/vaurca/preserve/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/mob/living/carbon/location = null
var/using_internal
if(istype(location))
if(location.internal==src)
using_internal = 1
// this is the data which will be sent to the ui
var/data[0]
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
data["valveOpen"] = using_internal ? 1 : 0
data["maskConnected"] = 0
if(istype(location))
var/mask_check = 0
if(location.internal == src) // if tank is current internal
mask_check = 1
else if(src in location) // or if tank is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
else if(istype(src.loc, /obj/item/weapon/rig) && src.loc in location) // or the rig is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
if(mask_check)
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
data["maskConnected"] = 1
else if(istype(location, /mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.flags & AIRTIGHT))
data["maskConnected"] = 1
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "tanks.tmpl", "Tank", 500, 300)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
/obj/item/organ/vaurca/preserve/Topic(href, href_list)
..()
if (usr.stat|| usr.restrained())
return 0
if (src.loc != usr)
return 0
if (href_list["dist_p"])
if (href_list["dist_p"] == "reset")
src.distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
else if (href_list["dist_p"] == "max")
src.distribute_pressure = TANK_MAX_RELEASE_PRESSURE
else
var/cp = text2num(href_list["dist_p"])
src.distribute_pressure += cp
src.distribute_pressure = min(max(round(src.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
if (href_list["stat"])
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/location = loc
if(location.internal == src)
location.internal = null
location.internals.icon_state = "internal0"
usr << "<span class='notice'>You close the tank release valve.</span>"
if (location.internals)
location.internals.icon_state = "internal0"
else
var/can_open_valve
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
can_open_valve = 1
else if(istype(location,/mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.flags & AIRTIGHT))
can_open_valve = 1
if(can_open_valve)
location.internal = src
usr << "<span class='notice'>You open \the [src] valve.</span>"
if (location.internals)
location.internals.icon_state = "internal1"
else
usr << "<span class='notice'>You need something to connect to \the [src].</span>"
src.add_fingerprint(usr)
return 1
/obj/item/organ/vaurca/preserve/remove_air(amount)
return air_contents.remove(amount)
/obj/item/organ/vaurca/preserve/return_air()
return air_contents
/obj/item/organ/vaurca/preserve/assume_air(datum/gas_mixture/giver)
air_contents.merge(giver)
check_status()
return 1
/obj/item/organ/vaurca/preserve/proc/remove_air_volume(volume_to_return)
if(!air_contents)
return null
var/tank_pressure = air_contents.return_pressure()
if((tank_pressure < distribute_pressure) && prob(5))
owner << "<span class='warning'>There is a buzzing in your [parent_organ].</span>"
var/moles_needed = distribute_pressure*volume_to_return/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
return remove_air(moles_needed)
/obj/item/organ/vaurca/preserve/process()
//Allow for reactions
air_contents.react() //cooking up air tanks - add phoron and oxygen, then heat above PHORON_MINIMUM_BURN_TEMPERATURE
check_status()
..()
/obj/item/organ/vaurca/preserve/proc/check_status()
//Handle exploding, leaking, and rupturing of the tank
if(!air_contents)
return 0
var/pressure = air_contents.return_pressure()
if(pressure > TANK_FRAGMENT_PRESSURE)
if(!istype(src.loc,/obj/item/device/transfer_valve))
message_admins("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast].")
log_game("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast].")
//Give the gas a chance to build up more pressure through reacting
air_contents.react()
air_contents.react()
air_contents.react()
pressure = air_contents.return_pressure()
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
explosion(
get_turf(loc),
round(min(BOMBCAP_DVSTN_RADIUS, range*0.25)),
round(min(BOMBCAP_HEAVY_RADIUS, range*0.50)),
round(min(BOMBCAP_LIGHT_RADIUS, range*1.00)),
round(min(BOMBCAP_FLASH_RADIUS, range*1.50))
)
qdel(src)
else if(pressure > (8.0*ONE_ATMOSPHERE))
if(damage >= 60)
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)
qdel(src)
else if(pressure > (5.0*ONE_ATMOSPHERE))
if(damage >= 45)
var/turf/simulated/T = get_turf(src)
if(!T)
return
var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25)
T.assume_air(leaked_gas)
+196
View File
@@ -0,0 +1,196 @@
/obj/item/organ/parasite
name = "parasite"
icon = 'icons/mob/alien.dmi'
icon_state = "burst_lie"
dead_icon = "bursted_lie"
organ_tag = "parasite"
var/stage = 1
var/max_stage = 4
var/stage_ticker = 0
var/stage_interval = 600 //time between stages, in seconds
var/subtle = 0 //will the body reject the parasite naturally?
/obj/item/organ/parasite/process()
..()
if(!owner)
return
if(stage < max_stage)
stage_ticker += 2 //process ticks every ~2 seconds
if(stage_ticker >= stage*stage_interval)
stage = min(stage+1,max_stage)
/obj/item/organ/parasite/handle_rejection()
if(subtle)
return ..()
else
if(rejecting)
rejecting = 0
return
///////////////////
///K'ois Mycosis///
///////////////////
/obj/item/organ/parasite/kois
name = "k'ois mycosis"
icon_state = "kois-on"
dead_icon = "kois-off"
organ_tag = "kois"
parent_organ = "chest"
/obj/item/organ/parasite/kois/process()
..()
if(prob(10) && !(owner.species.flags & NO_PAIN))
owner << "<span class='warning'>You feel a stinging pain in your abdomen!</span>"
owner.emote("me",1,"winces slightly.")
owner.adjustHalLoss(5)
else if(prob(10) && !(owner.species.flags & NO_BREATHE))
owner.emote("cough")
else if(prob(10) && !(owner.species.flags & NO_BREATHE))
owner.emote("me", 1, "coughs up blood!")
owner.drip(10)
if(stage >= 2)
if(prob(10) && !(owner.species.flags & NO_BREATHE))
owner.emote("me", 1, "gasps for air!")
owner.losebreath += 5
if(stage >= 3)
set_light(1, l_color = "#E6E600")
if(prob(10))
owner << "<span class='warning'>You feel something squirming inside of you!</span>"
owner.reagents.add_reagent("phoron", 8)
owner.reagents.add_reagent("koispaste", 5)
if(stage >= 4)
if(prob(10))
owner << "<span class='danger'>You feel something alien coming up your throat!</span>"
owner.emote("cough")
var/turf/T = get_turf(owner)
var/datum/reagents/R = new/datum/reagents(100)
R.add_reagent("koispaste",10)
R.add_reagent("phoron",10)
var/datum/effect/effect/system/smoke_spread/chem/spores/S = new("koisspore")
S.attach(T)
S.set_up(R, 20, 0, T, 40)
S.start()
if(!(owner.species.flags & NO_PAIN))
owner.emote("scream")
owner.adjustHalLoss(15)
owner.drip(15)
owner.delayed_vomit()
///////////////////
///Black Mycosis///
///////////////////
/obj/item/organ/parasite/blackkois
name = "k'ois mycosis"
icon_state = "black-on"
dead_icon = "black-off"
subtle = 1
organ_tag = "blackkois"
parent_organ = "head"
var/removed_langs = 0
/obj/item/organ/parasite/blackkois/process()
..()
if(prob(10) && !(owner.species.flags & NO_PAIN))
if(stage < 3)
owner << "<span class='warning'>You feel a stinging pain in your abdomen!</span>"
else
owner << "<span class='warning'>You feel a stinging pain in your head!</span>"
owner.emote("me",1,"winces slightly.")
owner.adjustHalLoss(5)
if(stage >= 2)
if(prob(10) && !(owner.species.flags & NO_BREATHE))
owner.emote("me", 1, "gasps for air!")
owner.losebreath += 5
if(stage >= 3)
set_light(-1.5, 6, "#FFFFFF")
if(!(all_languages[LANGUAGE_VAURCA] in owner.languages))
owner.add_language(LANGUAGE_VAURCA)
owner << "<span class='notice'> Your mind expands, and your thoughts join the unity of the Hivenet.</span>"
if(prob(5))
owner << "<span class='warning'>You feel something squirming inside of you!</span>"
owner.reagents.add_reagent("phoron", 4)
else if(prob(10))
owner << "<span class='warning'>You feel disorientated!</span>"
switch(rand(1,3))
if(1)
owner.confused += 10
owner.apply_effect(10,EYE_BLUR)
if(2)
owner.slurring += 30
if(3)
owner.make_dizzy(10)
if(stage >= 4)
var/obj/item/organ/brain/B = owner.internal_organs_by_name["brain"]
if(B && !B.lobotomized)
owner << "<span class='danger'>As the K'ois consumes your mind, you feel your past self, your memories, your very being slip away... only slavery to the swarm remains...</span>"
owner << "<b>You have been lobotomized by K'ois infection. All of your previous memories up until this point are gone, and all of your ambitions are nothing. You live for only one purpose; to serve the Lii'dra hive.</b>"
B.lobotomized = 1
if(!removed_langs)
for(var/datum/language/L in owner.languages)
owner.remove_language(L.name)
owner.add_language(LANGUAGE_VAURCA)
removed_langs = 1
if(prob(10))
if(!(owner.species.flags & NO_PAIN))
owner << "<span class='warning'>You feel an unbearable pain in your mind!</span>"
owner.emote("scream")
owner.adjustBrainLoss(1)
else if(prob(10))
owner << "<span class='danger'>You feel something alien coming up your throat!</span>"
var/turf/T = get_turf(owner)
var/datum/reagents/R = new/datum/reagents(100)
R.add_reagent("blackkois",10)
R.add_reagent("phoron",10)
var/datum/effect/effect/system/smoke_spread/chem/spores/S = new("blackkois")
S.attach(T)
S.set_up(R, 20, 0, T, 40)
S.start()
if(!(owner.species.flags & NO_PAIN))
owner.emote("scream")
owner.adjustHalLoss(15)
owner.drip(15)
owner.delayed_vomit()
/obj/item/organ/parasite/blackkois/removed(var/mob/living/carbon/human/target)
if(all_languages[LANGUAGE_VAURCA] in target.languages && stage >= 3 && !isvaurca(target))
target.remove_language(LANGUAGE_VAURCA)
target << "<span class='warning'>Your mind suddenly grows dark as the unity of the Hive is torn from you.</span>"
removed_langs = 0
..()
+315
View File
@@ -0,0 +1,315 @@
/obj/item/organ/heart/left
name = "heart"
icon_state = "heart-on"
organ_tag = "left heart"
parent_organ = "chest"
dead_icon = "heart-off"
/obj/item/organ/heart/right
name = "heart"
icon_state = "heart-on"
organ_tag = "right heart"
parent_organ = "chest"
dead_icon = "heart-off"
/obj/item/organ/vaurca/neuralsocket
name = "neural socket"
organ_tag = "neural socket"
icon = 'icons/mob/alien.dmi'
icon_state = "neural_socket"
parent_organ = "head"
robotic = 2
obj/item/organ/vaurca/neuralsocket/process()
if (is_broken())
if (all_languages[LANGUAGE_VAURCA] in owner.languages)
owner.remove_language(LANGUAGE_VAURCA)
owner << "<span class='warning'>Your mind suddenly grows dark as the unity of the Hive is torn from you.</span>"
else
if (!(all_languages[LANGUAGE_VAURCA] in owner.languages))
owner.add_language(LANGUAGE_VAURCA)
owner << "<span class='notice'> Your mind expands, and your thoughts join the unity of the Hivenet.</span>"
..()
/obj/item/organ/vaurca/neuralsocket/replaced(var/mob/living/carbon/human/target)
if (!(all_languages[LANGUAGE_VAURCA] in owner.languages))
owner.add_language(LANGUAGE_VAURCA)
owner << "<span class='notice'> Your mind expands, and your thoughts join the unity of the Hivenet.</span>"
..()
/obj/item/organ/vaurca/neuralsocket/removed(var/mob/living/carbon/human/target)
if(all_languages[LANGUAGE_VAURCA] in target.languages)
target.remove_language(LANGUAGE_VAURCA)
target << "<span class='warning'>Your mind suddenly grows dark as the unity of the Hive is torn from you.</span>"
..()
/obj/item/organ/vaurca/filtrationbit
name = "filtration bit"
organ_tag = "filtration bit"
parent_organ = "head"
icon = 'icons/mob/alien.dmi'
icon_state = "filter"
robotic = 2
/obj/item/organ/vaurca/preserve
name = "phoron reserve tank"
organ_tag = "phoron reserve tank"
parent_organ = "chest"
icon = 'icons/mob/alien.dmi'
icon_state = "breathing_app"
robotic = 1
var/datum/gas_mixture/air_contents = null
var/distribute_pressure = ((2*ONE_ATMOSPHERE)*O2STANDARD)
var/volume = 50
var/manipulated_by = null
/obj/item/organ/vaurca/preserve/Initialize()
. = ..()
air_contents = new /datum/gas_mixture()
air_contents.adjust_gas("phoron", (ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
air_contents.volume = volume //liters
air_contents.temperature = T20C
distribute_pressure = ((pick(2.4,2.8,3.2,3.6)*ONE_ATMOSPHERE)*O2STANDARD)
var/mob/living/carbon/location = loc
location.internal = src
if (location.internals)
location.internals.icon_state = "internal1"
return
/obj/item/organ/vaurca/preserve/Destroy()
if(air_contents)
QDEL_NULL(air_contents)
return ..()
/obj/item/organ/vaurca/preserve/examine(mob/user)
. = ..(user, 0)
if(.)
var/celsius_temperature = air_contents.temperature - T0C
var/descriptive
switch(celsius_temperature)
if(300 to INFINITY)
descriptive = "furiously hot"
if(100 to 300)
descriptive = "hot"
if(80 to 100)
descriptive = "warm"
if(40 to 80)
descriptive = "lukewarm"
if(20 to 40)
descriptive = "room temperature"
else
descriptive = "cold"
user << "<span class='notice'>\The [src] feels [descriptive].</span>"
/obj/item/organ/vaurca/preserve/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
var/obj/icon = src
if ((istype(W, /obj/item/device/analyzer)) && get_dist(user, src) <= 1)
user.visible_message("<span class='warning'>[user] has used [W] on \icon[icon] [src]</span>")
var/pressure = air_contents.return_pressure()
manipulated_by = user.real_name //This person is aware of the contents of the tank.
var/total_moles = air_contents.total_moles
user << "<span class='notice'>Results of analysis of \icon[icon]</span>"
if (total_moles>0)
user << "<span class='notice'>Pressure: [round(pressure,0.1)] kPa</span>"
for(var/g in air_contents.gas)
user << "<span class='notice'>[gas_data.name[g]]: [(round(air_contents.gas[g] / total_moles) * 100)]%</span>"
user << "<span class='notice'>Temperature: [round(air_contents.temperature-T0C)]&deg;C</span>"
else
user << "<span class='notice'>Tank is empty!</span>"
src.add_fingerprint(user)
else if (istype(W,/obj/item/latexballon))
var/obj/item/latexballon/LB = W
LB.blow(src)
src.add_fingerprint(user)
/obj/item/organ/vaurca/preserve/attack_self(mob/user as mob)
if (!(src.air_contents))
return
ui_interact(user)
/obj/item/organ/vaurca/preserve/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/mob/living/carbon/location = null
var/using_internal
if(istype(location))
if(location.internal==src)
using_internal = 1
// this is the data which will be sent to the ui
var/data[0]
data["tankPressure"] = round(air_contents.return_pressure() ? air_contents.return_pressure() : 0)
data["releasePressure"] = round(distribute_pressure ? distribute_pressure : 0)
data["defaultReleasePressure"] = round(TANK_DEFAULT_RELEASE_PRESSURE)
data["maxReleasePressure"] = round(TANK_MAX_RELEASE_PRESSURE)
data["valveOpen"] = using_internal ? 1 : 0
data["maskConnected"] = 0
if(istype(location))
var/mask_check = 0
if(location.internal == src) // if tank is current internal
mask_check = 1
else if(src in location) // or if tank is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
else if(istype(src.loc, /obj/item/weapon/rig) && src.loc in location) // or the rig is in the mobs possession
if(!location.internal) // and they do not have any active internals
mask_check = 1
if(mask_check)
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
data["maskConnected"] = 1
else if(istype(location, /mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.flags & AIRTIGHT))
data["maskConnected"] = 1
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "tanks.tmpl", "Tank", 500, 300)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
/obj/item/organ/vaurca/preserve/Topic(href, href_list)
..()
if (usr.stat|| usr.restrained())
return 0
if (src.loc != usr)
return 0
if (href_list["dist_p"])
if (href_list["dist_p"] == "reset")
src.distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
else if (href_list["dist_p"] == "max")
src.distribute_pressure = TANK_MAX_RELEASE_PRESSURE
else
var/cp = text2num(href_list["dist_p"])
src.distribute_pressure += cp
src.distribute_pressure = min(max(round(src.distribute_pressure), 0), TANK_MAX_RELEASE_PRESSURE)
if (href_list["stat"])
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/location = loc
if(location.internal == src)
location.internal = null
location.internals.icon_state = "internal0"
usr << "<span class='notice'>You close the tank release valve.</span>"
if (location.internals)
location.internals.icon_state = "internal0"
else
var/can_open_valve
if(location.wear_mask && (location.wear_mask.flags & AIRTIGHT))
can_open_valve = 1
else if(istype(location,/mob/living/carbon/human))
var/mob/living/carbon/human/H = location
if(H.head && (H.head.flags & AIRTIGHT))
can_open_valve = 1
if(can_open_valve)
location.internal = src
usr << "<span class='notice'>You open \the [src] valve.</span>"
if (location.internals)
location.internals.icon_state = "internal1"
else
usr << "<span class='notice'>You need something to connect to \the [src].</span>"
src.add_fingerprint(usr)
return 1
/obj/item/organ/vaurca/preserve/remove_air(amount)
return air_contents.remove(amount)
/obj/item/organ/vaurca/preserve/return_air()
return air_contents
/obj/item/organ/vaurca/preserve/assume_air(datum/gas_mixture/giver)
air_contents.merge(giver)
check_status()
return 1
/obj/item/organ/vaurca/preserve/proc/remove_air_volume(volume_to_return)
if(!air_contents)
return null
var/tank_pressure = air_contents.return_pressure()
if((tank_pressure < distribute_pressure) && prob(5))
owner << "<span class='warning'>There is a buzzing in your [parent_organ].</span>"
var/moles_needed = distribute_pressure*volume_to_return/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
return remove_air(moles_needed)
/obj/item/organ/vaurca/preserve/process()
//Allow for reactions
air_contents.react() //cooking up air tanks - add phoron and oxygen, then heat above PHORON_MINIMUM_BURN_TEMPERATURE
check_status()
..()
/obj/item/organ/vaurca/preserve/proc/check_status()
//Handle exploding, leaking, and rupturing of the tank
if(!air_contents)
return 0
var/pressure = air_contents.return_pressure()
if(pressure > TANK_FRAGMENT_PRESSURE)
if(!istype(src.loc,/obj/item/device/transfer_valve))
message_admins("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast].")
log_game("Explosive tank rupture! last key to touch the tank was [src.fingerprintslast].")
//Give the gas a chance to build up more pressure through reacting
air_contents.react()
air_contents.react()
air_contents.react()
pressure = air_contents.return_pressure()
var/range = (pressure-TANK_FRAGMENT_PRESSURE)/TANK_FRAGMENT_SCALE
explosion(
get_turf(loc),
round(min(BOMBCAP_DVSTN_RADIUS, range*0.25)),
round(min(BOMBCAP_HEAVY_RADIUS, range*0.50)),
round(min(BOMBCAP_LIGHT_RADIUS, range*1.00)),
round(min(BOMBCAP_FLASH_RADIUS, range*1.50))
)
qdel(src)
else if(pressure > (8.0*ONE_ATMOSPHERE))
if(damage >= 60)
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)
qdel(src)
else if(pressure > (5.0*ONE_ATMOSPHERE))
if(damage >= 45)
var/turf/simulated/T = get_turf(src)
if(!T)
return
var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25)
T.assume_air(leaked_gas)