Temperature gun update

This commit is contained in:
Markolie
2015-09-13 21:05:23 +02:00
parent d6ccb3f189
commit aaeac981b9
12 changed files with 230 additions and 77 deletions
+11 -11
View File
@@ -141,26 +141,26 @@
loc_temp = loc:air_contents.temperature
else
loc_temp = environment.temperature
if(loc_temp < 310.15) // a cold place
bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1)
else // a hot place
bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1)
//Account for massive pressure differences
if(bodytemperature < (T0C + 5)) // start calculating temperature damage etc
if(bodytemperature <= (T0C - 40)) // stun temperature
Tempstun = 1
if(bodytemperature <= (T0C - 50)) // hurt temperature
if(bodytemperature <= 50) // sqrting negative numbers is bad
adjustToxLoss(200)
else
adjustToxLoss(301) //The config.health_threshold_dead is -100 by default, and slimes have 150hp (200hp for adults),
else //so the ToxLoss needs to be 300 or above to guarrantee an instant death
adjustToxLoss(round(sqrt(bodytemperature)) * 2)
else
Tempstun = 0
/*moved after the temperature damage code so freeze beams can instantly kill slimes -Deity Link*/
if(loc_temp < 310.15) // a cold place
bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1)
else // a hot place
bodytemperature += adjust_body_temperature(bodytemperature, loc_temp, 1)
updatehealth()
@@ -215,7 +215,7 @@
if(src.stat != DEAD)
src.stat = UNCONSCIOUS
if(prob(30))
if(prob(30)) //I think this is meant to allow slimes to starve to death
adjustOxyLoss(-1)
adjustToxLoss(-1)
adjustFireLoss(-1)
+1
View File
@@ -204,6 +204,7 @@
in_chamber.loc = get_turf(user)
in_chamber.starting = get_turf(user)
in_chamber.current = curloc
in_chamber.OnFired()
in_chamber.yo = targloc.y - curloc.y
in_chamber.xo = targloc.x - curloc.x
if(params)
@@ -1,80 +1,182 @@
/obj/item/weapon/gun/energy/temperature
name = "temperature gun"
icon_state = "freezegun"
icon = 'icons/obj/gun_temperature.dmi'
icon_state = "tempgun_4"
item_state = "tempgun_4"
slot_flags = SLOT_BACK
w_class = 4.0
fire_sound = 'sound/weapons/pulse3.ogg'
desc = "A gun that changes temperatures."
var/temperature = T20C
var/current_temperature = T20C
charge_cost = 100
desc = "A gun that changes the body temperature of its targets."
var/temperature = 300
var/target_temperature = 300
charge_cost = 90
origin_tech = "combat=3;materials=4;powerstorage=3;magnets=2"
projectile_type = "/obj/item/projectile/temp"
cell_type = "/obj/item/weapon/stock_parts/cell/crap"
projectile_type = /obj/item/projectile/temp
cell_type = /obj/item/weapon/stock_parts/cell/temperaturegun
var/powercost = ""
var/powercostcolor = ""
var/emagged = 0 //ups the temperature cap from 500 to 1000, targets hit by beams over 500 Kelvin will burst into flames
var/dat = ""
/obj/item/weapon/gun/energy/temperature/New()
..()
update_icon()
processing_objects.Add(src)
New()
..()
processing_objects.Add(src)
/obj/item/weapon/gun/energy/temperature/Destroy()
processing_objects.Remove(src)
..()
Destroy()
processing_objects.Remove(src)
return ..()
/obj/item/weapon/gun/energy/temperature/attack_self(mob/living/user as mob)
user.set_machine(src)
update_dat()
user << browse("<TITLE>Temperature Gun Configuration</TITLE><HR>[dat]", "window=tempgun;size=510x120")
onclose(user, "tempgun")
attack_self(mob/living/user as mob)
user.set_machine(src)
var/temp_text = ""
if(temperature > (T0C - 50))
temp_text = "<FONT color=black>[temperature] ([round(temperature-T0C)]&deg;C) ([round(temperature*1.8-459.67)]&deg;F)</FONT>"
/obj/item/weapon/gun/energy/temperature/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/card/emag) && !emagged)
emagged = 1
user << "<span class='caution'>You double the gun's temperature cap! Targets hit by searing beams will burst into flames!</span>"
desc = "A gun that changes the body temperature of its targets. Its temperature cap has been hacked."
/obj/item/weapon/gun/energy/temperature/Topic(href, href_list)
if (..())
return
usr.set_machine(src)
add_fingerprint(usr)
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
if(amount > 0)
target_temperature = min((500 + 500*emagged), target_temperature+amount)
else
temp_text = "<FONT color=blue>[temperature] ([round(temperature-T0C)]&deg;C) ([round(temperature*1.8-459.67)]&deg;F)</FONT>"
var/dat = {"<B>Freeze Gun Configuration: </B><BR>
Current output temperature: [temp_text]<BR>
Target output temperature: <A href='?src=\ref[src];temp=-100'>-</A> <A href='?src=\ref[src];temp=-10'>-</A> <A href='?src=\ref[src];temp=-1'>-</A> [current_temperature] <A href='?src=\ref[src];temp=1'>+</A> <A href='?src=\ref[src];temp=10'>+</A> <A href='?src=\ref[src];temp=100'>+</A><BR>
"}
target_temperature = max(0, target_temperature+amount)
if (istype(loc, /mob))
attack_self(loc)
add_fingerprint(usr)
return
user << browse(dat, "window=freezegun;size=450x300;can_resize=1;can_close=1;can_minimize=1")
onclose(user, "window=freezegun", src)
Topic(href, href_list)
if (..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["temp"])
var/amount = text2num(href_list["temp"])
if(amount > 0)
src.current_temperature = min(500, src.current_temperature+amount)
/obj/item/weapon/gun/energy/temperature/process()
switch(temperature)
if(0 to 100)
charge_cost = 300
powercost = "High"
if(100 to 250)
charge_cost = 180
powercost = "Medium"
if(251 to 300)
charge_cost = 90
powercost = "Low"
if(301 to 400)
charge_cost = 180
powercost = "Medium"
if(401 to 1000)
charge_cost = 300
powercost = "High"
switch(powercost)
if("High") powercostcolor = "orange"
if("Medium") powercostcolor = "green"
else powercostcolor = "blue"
if(target_temperature != temperature)
var/difference = abs(target_temperature - temperature)
if(difference >= (10 + 40*emagged)) //so emagged temp guns adjust their temperature much more quickly
if(target_temperature < temperature)
temperature -= (10 + 40*emagged)
else
src.current_temperature = max(0, src.current_temperature+amount)
if (istype(src.loc, /mob))
attack_self(src.loc)
src.add_fingerprint(usr)
return
temperature += (10 + 40*emagged)
else
temperature = target_temperature
update_icon()
if (istype(loc, /mob/living/carbon))
var /mob/living/carbon/M = loc
if (src == M.machine)
update_dat()
M << browse("<TITLE>Temperature Gun Configuration</TITLE><HR>[dat]", "window=tempgun;size=510x102")
process()
switch(temperature)
if(0 to 100) charge_cost = 1000
if(100 to 250) charge_cost = 500
if(251 to 300) charge_cost = 100
if(301 to 400) charge_cost = 500
if(401 to 500) charge_cost = 1000
if(power_supply)
power_supply.give(50)
update_icon()
return
if(current_temperature != temperature)
var/difference = abs(current_temperature - temperature)
if(difference >= 10)
if(current_temperature < temperature)
temperature -= 10
else
temperature += 10
else
temperature = current_temperature
return
/obj/item/weapon/gun/energy/temperature/proc/update_dat()
dat = ""
dat += "Current output temperature: "
if(temperature > 500)
dat += "<FONT color=red><B>[temperature]</B> ([round(temperature-T0C)]&deg;C)</FONT>"
dat += "<FONT color=red><B> SEARING!</B></FONT>"
else if(temperature > (T0C + 50))
dat += "<FONT color=red><B>[temperature]</B> ([round(temperature-T0C)]&deg;C) ([round(temperature*1.8-459.67)]&deg;F)</FONT>"
else if(temperature > (T0C - 50))
dat += "<FONT color=black><B>[temperature]</B> ([round(temperature-T0C)]&deg;C) ([round(temperature*1.8-459.67)]&deg;F)</FONT>"
else
dat += "<FONT color=blue><B>[temperature]</B> ([round(temperature-T0C)]&deg;C) ([round(temperature*1.8-459.67)]&deg;F)</FONT>"
dat += "<BR>"
dat += "Target output temperature: " //might be string idiocy, but at least it's easy to read
dat += "<A href='?src=\ref[src];temp=-100'>-</A> "
dat += "<A href='?src=\ref[src];temp=-10'>-</A> "
dat += "<A href='?src=\ref[src];temp=-1'>-</A> "
dat += "[target_temperature] "
dat += "<A href='?src=\ref[src];temp=1'>+</A> "
dat += "<A href='?src=\ref[src];temp=10'>+</A> "
dat += "<A href='?src=\ref[src];temp=100'>+</A>"
dat += "<BR>"
dat += "Power cost: "
dat += "<FONT color=[powercostcolor]><B>[powercost]</B></FONT>"
/obj/item/weapon/gun/energy/temperature/proc/update_temperature()
switch(temperature)
if(501 to INFINITY)
item_state = "tempgun_8"
if(400 to 500)
item_state = "tempgun_7"
if(360 to 400)
item_state = "tempgun_6"
if(335 to 360)
item_state = "tempgun_5"
if(295 to 335)
item_state = "tempgun_4"
if(260 to 295)
item_state = "tempgun_3"
if(200 to 260)
item_state = "tempgun_2"
if(120 to 260)
item_state = "tempgun_1"
if(-INFINITY to 120)
item_state = "tempgun_0"
icon_state = item_state
/obj/item/weapon/gun/energy/temperature/proc/update_charge()
var/charge = power_supply.charge
switch(charge)
if(900 to INFINITY) overlays += "900"
if(800 to 900) overlays += "800"
if(700 to 800) overlays += "700"
if(600 to 700) overlays += "600"
if(500 to 600) overlays += "500"
if(400 to 500) overlays += "400"
if(300 to 400) overlays += "300"
if(200 to 300) overlays += "200"
if(100 to 200) overlays += "100"
if(-INFINITY to 100) overlays += "0"
/obj/item/weapon/gun/energy/temperature/proc/update_user()
if (istype(loc,/mob/living/carbon))
var/mob/living/carbon/M = loc
M.update_inv_back()
M.update_inv_l_hand()
M.update_inv_r_hand()
/obj/item/weapon/gun/energy/temperature/update_icon()
overlays = 0
update_temperature()
update_user()
update_charge()
+3
View File
@@ -88,6 +88,9 @@
var/mob/living/L = target
return L.apply_effects(stun, weaken, paralyze, irradiate, slur, stutter, eyeblur, drowsy, agony, blocked, stamina, jitter)
proc/OnFired() //if assigned, allows for code when the projectile gets fired
return 1
proc/check_fire(var/mob/living/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not.
if(!istype(target) || !istype(user))
return 0
+44 -2
View File
@@ -44,17 +44,59 @@
/obj/item/projectile/temp
name = "freeze beam"
icon_state = "ice_2"
icon_state = "temp_4"
damage = 0
damage_type = BURN
nodamage = 1
flag = "energy"
var/temperature = 300
var/obj/item/weapon/gun/energy/temperature/T = null
OnFired()
T = shot_from
temperature = T.temperature
switch(temperature)
if(501 to INFINITY)
name = "searing beam" //if emagged
icon_state = "temp_8"
if(400 to 500)
name = "burning beam" //temp at which mobs start taking HEAT_DAMAGE_LEVEL_2
icon_state = "temp_7"
if(360 to 400)
name = "hot beam" //temp at which mobs start taking HEAT_DAMAGE_LEVEL_1
icon_state = "temp_6"
if(335 to 360)
name = "warm beam" //temp at which players get notified of their high body temp
icon_state = "temp_5"
if(295 to 335)
name = "ambient beam"
icon_state = "temp_4"
if(260 to 295)
name = "cool beam" //temp at which players get notified of their low body temp
icon_state = "temp_3"
if(200 to 260)
name = "cold beam" //temp at which mobs start taking COLD_DAMAGE_LEVEL_1
icon_state = "temp_2"
if(120 to 260)
name = "ice beam" //temp at which mobs start taking COLD_DAMAGE_LEVEL_2
icon_state = "temp_1"
if(-INFINITY to 120)
name = "freeze beam" //temp at which mobs start taking COLD_DAMAGE_LEVEL_3
icon_state = "temp_0"
else
name = "temperature beam"//failsafe
icon_state = "temp_4"
on_hit(var/atom/target, var/blocked = 0)//These two could likely check temp protection on the mob
if(istype(target, /mob/living))
var/mob/M = target
var/mob/living/M = target
M.bodytemperature = temperature
if(temperature > 500)//emagged
M.adjust_fire_stacks(0.5)
M.on_fire = 1
M.update_icon = 1
playsound(M.loc, 'sound/effects/bamf.ogg', 50, 0)
return 1
/obj/item/projectile/meteor
@@ -165,13 +165,12 @@
/datum/design/temp_gun
name = "Temperature Gun"
desc = "A gun that shoots temperature bullet energy things to change temperature."//Change it if you want
desc = "A gun that changes the body temperature of its targets."
id = "temp_gun"
req_tech = list("combat" = 3, "materials" = 4, "powerstorage" = 3, "magnets" = 2)
build_type = PROTOLATHE
materials = list(MAT_METAL = 5000, MAT_GLASS = 500, MAT_SILVER = 3000)
build_path = /obj/item/weapon/gun/energy/temperature
locked = 1
category = list("Weapons")
/datum/design/suppressor