diff --git a/code/game/objects/items/weapons/power_cells.dm b/code/game/objects/items/weapons/power_cells.dm index e60b78df8d0..a1e97eb3f92 100644 --- a/code/game/objects/items/weapons/power_cells.dm +++ b/code/game/objects/items/weapons/power_cells.dm @@ -155,3 +155,9 @@ /obj/item/weapon/stock_parts/cell/emproof/corrupt() return + +/obj/item/weapon/stock_parts/cell/temperaturegun + name = "temperature gun cell" + desc = "A specially designed power cell for heating and cooling projectiles" + icon_state = "icell" + maxcharge = 900 \ No newline at end of file diff --git a/code/modules/mob/living/carbon/metroid/life.dm b/code/modules/mob/living/carbon/metroid/life.dm index d2cfeeb9037..05e078553a8 100644 --- a/code/modules/mob/living/carbon/metroid/life.dm +++ b/code/modules/mob/living/carbon/metroid/life.dm @@ -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) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 61fb6ba0020..61a646242a1 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -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) diff --git a/code/modules/projectiles/guns/energy/temperature.dm b/code/modules/projectiles/guns/energy/temperature.dm index 5db53cc5a84..6de9cbbf6c2 100644 --- a/code/modules/projectiles/guns/energy/temperature.dm +++ b/code/modules/projectiles/guns/energy/temperature.dm @@ -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("Temperature Gun Configuration
[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 = "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" +/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 << "You double the gun's temperature cap! Targets hit by searing beams will burst into flames!" + 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 = "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" - - var/dat = {"Freeze Gun Configuration:
- Current output temperature: [temp_text]
- Target output temperature: - - - [current_temperature] + + +
- "} + 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("Temperature Gun Configuration
[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 += "[temperature] ([round(temperature-T0C)]°C)" + dat += " SEARING!" + else if(temperature > (T0C + 50)) + dat += "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" + else if(temperature > (T0C - 50)) + dat += "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" + else + dat += "[temperature] ([round(temperature-T0C)]°C) ([round(temperature*1.8-459.67)]°F)" + dat += "
" + dat += "Target output temperature: " //might be string idiocy, but at least it's easy to read + dat += "- " + dat += "- " + dat += "- " + dat += "[target_temperature] " + dat += "+ " + dat += "+ " + dat += "+" + dat += "
" + dat += "Power cost: " + dat += "[powercost]" + +/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() \ No newline at end of file diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 8542729e3d1..aff5fbfd167 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -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 diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm index b263e03afeb..962ed6725a3 100644 --- a/code/modules/projectiles/projectile/special.dm +++ b/code/modules/projectiles/projectile/special.dm @@ -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 diff --git a/code/modules/research/designs/weapon_designs.dm b/code/modules/research/designs/weapon_designs.dm index 3482547f113..55070af9374 100644 --- a/code/modules/research/designs/weapon_designs.dm +++ b/code/modules/research/designs/weapon_designs.dm @@ -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 diff --git a/icons/mob/back.dmi b/icons/mob/back.dmi index 26e8c26f508..a5931466e9a 100644 Binary files a/icons/mob/back.dmi and b/icons/mob/back.dmi differ diff --git a/icons/mob/in-hand/left/temperature_gun.dmi b/icons/mob/in-hand/left/temperature_gun.dmi new file mode 100644 index 00000000000..e6c0165fd6a Binary files /dev/null and b/icons/mob/in-hand/left/temperature_gun.dmi differ diff --git a/icons/mob/in-hand/right/temperature_gun.dmi b/icons/mob/in-hand/right/temperature_gun.dmi new file mode 100644 index 00000000000..7566067ae09 Binary files /dev/null and b/icons/mob/in-hand/right/temperature_gun.dmi differ diff --git a/icons/obj/gun_temperature.dmi b/icons/obj/gun_temperature.dmi new file mode 100644 index 00000000000..56ab9b6b5fd Binary files /dev/null and b/icons/obj/gun_temperature.dmi differ diff --git a/icons/obj/projectiles.dmi b/icons/obj/projectiles.dmi index ec57d8bb6df..be1a0a4c875 100644 Binary files a/icons/obj/projectiles.dmi and b/icons/obj/projectiles.dmi differ