Skip to content

Commit

Permalink
Makes the clamp not allow deleting or creating energy.
Browse files Browse the repository at this point in the history
  • Loading branch information
CRITAWAKETS committed Mar 8, 2024
1 parent f116074 commit 0f51d09
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions maplestation_modules/code/modules/magic/story_spells/convect.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
spell_requirements = SPELL_REQUIRES_NO_ANTIMAGIC

var/temperature_for_cast = 25
//Minimum temperature able to be chosen when casting
var/minimum_temperature_delta = -50
//Maximum temperature able to be chosen when casting
//Maximum temperature change able to be chosen when casting
var/maximum_temperature_delta = 50
//Minimum temperature the spell can reach
var/minimum_temperature_atmos = T0C - 50
Expand All @@ -69,7 +67,7 @@

/// Asks the owner for a number via TGUI. If the number isn't 0 or null, sets it to our temperature.
/datum/action/cooldown/spell/pointed/convect/proc/get_new_cast_temperature()
var/temperature = tgui_input_number(owner, "How many degrees (kelvin) do you wish to shift temperature by?", "Convect", null, max_value = maximum_temperature_delta, min_value = minimum_temperature_delta, timeout = 5 SECONDS)
var/temperature = tgui_input_number(owner, "How many degrees (kelvin) do you wish to shift temperature by?", "Convect", null, max_value = maximum_temperature_delta, min_value = -maximum_temperature_delta, timeout = 5 SECONDS)
if (!temperature)
return FALSE
temperature_for_cast = temperature
Expand Down Expand Up @@ -105,10 +103,28 @@
var/datum/gas_mixture/air = cast_on.return_air()
var/datum/gas_mixture/turf_air = turf_target?.return_air()
if (air && air != turf_air) // if this has air and we arent a turf
air.temperature = clamp(air.temperature + temperature_for_cast, minimum_temperature_atmos, maximum_temperature_atmos) //don't want fusion temperatures in your pocket now dont you
if(air.temperature + temperature_for_cast >= maximum_temperature_atmos && temperature_for_cast <= 0) //veeery hot
air.temperature = max(air.temperature + temperature_for_cast, minimum_temperature_atmos)
else if(air.temperature + temperature_for_cast <= minimum_temperature_atmos && temperature_for_cast > 0) //veeery cold
air.temperature = min(air.temperature + temperature_for_cast, maximum_temperature_atmos)
else if(air.temperature + temperature_for_cast >= maximum_temperature_atmos && temperature_for_cast > 0) //These else if blocks suck. Why air doesn't have a proc to set temperature is byond me
air.temperature = maximum_temperature_atmos
else if(air.temperature + temperature_for_cast <= minimum_temperature_atmos && temperature_for_cast <= 0)
air.temperature = minimum_temperature_atmos
else
air.temperature = clamp(air.temperature + temperature_for_cast, minimum_temperature_atmos, maximum_temperature_atmos) //don't want fusion temperatures in your pocket now dont you
air.react(cast_on)
if (isturf(cast_on) && turf_air)
turf_air.temperature = clamp(turf_air.temperature + temperature_for_cast, minimum_temperature_atmos, maximum_temperature_atmos)
if(turf_air.temperature + temperature_for_cast >= maximum_temperature_atmos && temperature_for_cast <= 0)
turf_air.temperature = max(turf_air.temperature + temperature_for_cast, minimum_temperature_atmos)
else if(turf_air.temperature + temperature_for_cast <= minimum_temperature_atmos && temperature_for_cast > 0)
turf_air.temperature = min(turf_air.temperature + temperature_for_cast, maximum_temperature_atmos)
else if(turf_air.temperature + temperature_for_cast >= maximum_temperature_atmos && temperature_for_cast > 0)
turf_air.temperature = maximum_temperature_atmos
else if(turf_air.temperature + temperature_for_cast <= minimum_temperature_atmos && temperature_for_cast <= 0)
turf_air.temperature = minimum_temperature_atmos
else
turf_air.temperature = clamp(turf_air.temperature + temperature_for_cast, minimum_temperature_atmos, maximum_temperature_atmos)
turf_air.react(turf_target)
turf_target?.air_update_turf()

Expand Down

0 comments on commit 0f51d09

Please sign in to comment.