diff --git a/code/WorkInProgress/Cael_Aislinn/Supermatter/SuperMatter.dm b/code/WorkInProgress/Cael_Aislinn/Supermatter/SuperMatter.dm index 27ef61838db..3dfe677de53 100644 --- a/code/WorkInProgress/Cael_Aislinn/Supermatter/SuperMatter.dm +++ b/code/WorkInProgress/Cael_Aislinn/Supermatter/SuperMatter.dm @@ -26,8 +26,8 @@ density = 1 anchored = 0 - LuminosityRed = 4 - LuminosityGreen = 6 + ul_Red = 5 + ul_Green = 6 var/gasefficency = 0.25 @@ -100,7 +100,7 @@ del src damage_archived = damage - damage = max( damage + ( (removed.temperature - 1000) / 150 ) , 0 ) + damage = max( damage + ( (removed.temperature - 800) / 150 ) , 0 ) if(!removed.total_moles) damage += max((power-1600)/10,0) @@ -174,7 +174,6 @@ for(var/mob/living/carbon/human/l in view(src, round(hallucination_energy**0.25))) // you have to be seeing the core to get hallucinations if(prob(10) && !istype(l.glasses, /obj/item/clothing/glasses/meson)) - world << "Inducing hallucinations" l.hallucination += hallucination_energy/((get_dist(l,src)**2)) for(var/mob/living/l in range(src,round(rad_energy**0.25))) diff --git a/code/WorkInProgress/SkyMarshal/Ultralight.dm b/code/WorkInProgress/SkyMarshal/Ultralight.dm index 1f992cff63b..5eeeac14beb 100644 --- a/code/WorkInProgress/SkyMarshal/Ultralight.dm +++ b/code/WorkInProgress/SkyMarshal/Ultralight.dm @@ -7,6 +7,7 @@ #define UL_I_LIT 0 #define UL_I_EXTINGUISHED 1 #define UL_I_ONZERO 2 +#define UL_I_CHANGING 3 #define ul_LightingEnabled 1 //#define ul_LightingResolution 2 @@ -21,8 +22,8 @@ #define ul_Clamp(Value) min(max(Value, 0), ul_Steps) -#define ul_IsLuminous(A) (A.LuminosityRed || A.LuminosityGreen || A.LuminosityBlue) -#define ul_Luminosity(A) max(A.LuminosityRed, A.LuminosityGreen, A.LuminosityBlue) +#define ul_IsLuminous(A) (A.ul_Red || A.ul_Green || A.ul_Blue) +#define ul_Luminosity(A) max(A.ul_Red, A.ul_Green, A.ul_Blue) #ifdef ul_LightingResolution @@ -35,6 +36,8 @@ var/list/ul_FastRoot = list(0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7) +var/list/ul_IconCache = list() + proc/ul_UnblankLocal(var/list/ReApply = view(ul_TopLuminosity, src)) for(var/atom/Light in ReApply) @@ -42,30 +45,34 @@ proc/ul_UnblankLocal(var/list/ReApply = view(ul_TopLuminosity, src)) Light.ul_Illuminate() return -atom/var/LuminosityRed = 0 -atom/var/LuminosityGreen = 0 -atom/var/LuminosityBlue = 0 +atom/var/ul_Red = 0 +atom/var/ul_Green = 0 +atom/var/ul_Blue = 0 +atom/var/turf/ul_LastIlluminated atom/var/ul_Extinguished = UL_I_ONZERO -atom/proc/ul_SetLuminosity(var/Red, var/Green = Red, var/Blue = Red) +atom/proc/ul_SetLuminosity(var/Red = 0, var/Green = Red, var/Blue = Red) - if(LuminosityRed == min(Red, ul_TopLuminosity) && LuminosityGreen == min(Green, ul_TopLuminosity) && LuminosityBlue == min(Blue, ul_TopLuminosity)) + if(ul_Extinguished == UL_I_CHANGING) //Changing state, just supress any changes, to prevent glitches. + return + + if(ul_Red == min(Red, ul_TopLuminosity) && ul_Green == min(Green, ul_TopLuminosity) && ul_Blue == min(Blue, ul_TopLuminosity)) return //No point doing all that work if it won't have any effect anyways... if (ul_Extinguished == UL_I_EXTINGUISHED) - LuminosityRed = min(Red,ul_TopLuminosity) - LuminosityGreen = min(Green,ul_TopLuminosity) - LuminosityBlue = min(Blue,ul_TopLuminosity) + ul_Red = min(Red,ul_TopLuminosity) + ul_Green = min(Green,ul_TopLuminosity) + ul_Blue = min(Blue,ul_TopLuminosity) return if (ul_IsLuminous(src)) ul_Extinguish() - LuminosityRed = min(Red,ul_TopLuminosity) - LuminosityGreen = min(Green,ul_TopLuminosity) - LuminosityBlue = min(Blue,ul_TopLuminosity) + ul_Red = min(Red,ul_TopLuminosity) + ul_Green = min(Green,ul_TopLuminosity) + ul_Blue = min(Blue,ul_TopLuminosity) ul_Extinguished = UL_I_ONZERO @@ -78,16 +85,16 @@ atom/proc/ul_Illuminate() if (ul_Extinguished == UL_I_LIT) return - ul_Extinguished = UL_I_LIT + ul_Extinguished = UL_I_CHANGING luminosity = ul_Luminosity(src) for(var/turf/Affected in view(luminosity, src)) - var/Falloff = src.ul_FalloffAmount(Affected) + var/Falloff = ul_FalloffAmount(Affected) - var/DeltaRed = LuminosityRed - Falloff - var/DeltaGreen = LuminosityGreen - Falloff - var/DeltaBlue = LuminosityBlue - Falloff + var/DeltaRed = ul_Red - Falloff + var/DeltaGreen = ul_Green - Falloff + var/DeltaBlue = ul_Blue - Falloff if(DeltaRed > 0 || DeltaGreen > 0 || DeltaBlue > 0) @@ -115,6 +122,10 @@ atom/proc/ul_Illuminate() for(var/atom/AffectedAtom in Affected) AffectedAtom.ul_LightLevelChanged() #endif + + ul_LastIlluminated = get_turf(src) + ul_Extinguished = UL_I_LIT + return atom/proc/ul_Extinguish() @@ -122,33 +133,39 @@ atom/proc/ul_Extinguish() if (ul_Extinguished != UL_I_LIT) return - ul_Extinguished = UL_I_EXTINGUISHED + ul_Extinguished = UL_I_CHANGING - for(var/turf/Affected in view(ul_Luminosity(src), src)) + for(var/turf/Affected in view(ul_Luminosity(src), ul_LastIlluminated)) - var/Falloff = ul_FalloffAmount(Affected) + var/Falloff = ul_LastIlluminated.ul_FalloffAmount(Affected) - var/DeltaRed = LuminosityRed - Falloff - var/DeltaGreen = LuminosityGreen - Falloff - var/DeltaBlue = LuminosityBlue - Falloff + var/DeltaRed = ul_Red - Falloff + var/DeltaGreen = ul_Green - Falloff + var/DeltaBlue = ul_Blue - Falloff if(DeltaRed > 0 || DeltaGreen > 0 || DeltaBlue > 0) if(DeltaRed > 0) if(Affected.MaxRed) - Affected.MaxRed -= DeltaRed + var/removed_light_source = Affected.MaxRed.Find(DeltaRed) + if(removed_light_source) + Affected.MaxRed.Cut(removed_light_source, removed_light_source+1) if(!Affected.MaxRed.len) del Affected.MaxRed if(DeltaGreen > 0) if(Affected.MaxGreen) - Affected.MaxGreen -= DeltaGreen + var/removed_light_source = Affected.MaxGreen.Find(DeltaGreen) + if(removed_light_source) + Affected.MaxGreen.Cut(removed_light_source, removed_light_source+1) if(!Affected.MaxGreen.len) del Affected.MaxGreen if(DeltaBlue > 0) if(Affected.MaxBlue) - Affected.MaxBlue -= DeltaBlue + var/removed_light_source = Affected.MaxBlue.Find(DeltaBlue) + if(removed_light_source) + Affected.MaxBlue.Cut(removed_light_source, removed_light_source+1) if(!Affected.MaxBlue.len) del Affected.MaxBlue @@ -162,7 +179,9 @@ atom/proc/ul_Extinguish() AffectedAtom.ul_LightLevelChanged() #endif + ul_Extinguished = UL_I_EXTINGUISHED luminosity = 0 + ul_LastIlluminated = null return @@ -176,20 +195,20 @@ atom/proc/ul_Extinguish() */ atom/proc/ul_FalloffAmount(var/atom/ref) if (ul_FalloffStyle == UL_I_FALLOFF_ROUND) - var/x = (ref.x - src.x) - var/y = (ref.y - src.y) + var/delta_x = (ref.x - src.x) + var/delta_y = (ref.y - src.y) #ifdef ul_LightingResolution - if (round((x*x + y*y)*ul_LightingResolutionSqrt,1) > ul_FastRoot.len) - for(var/i = ul_FastRoot.len, i <= round(x*x+y*y*ul_LightingResolutionSqrt,1), i++) + if (round((delta_x*delta_x + delta_y*delta_y)*ul_LightingResolutionSqrt,1) > ul_FastRoot.len) + for(var/i = ul_FastRoot.len, i <= round(delta_x*delta_x+delta_y*delta_y*ul_LightingResolutionSqrt,1), i++) ul_FastRoot += round(sqrt(i)) - return ul_FastRoot[round((x*x + y*y)*ul_LightingResolutionSqrt, 1) + 1]/ul_LightingResolution + return ul_FastRoot[round((delta_x*delta_x + delta_y*delta_y)*ul_LightingResolutionSqrt, 1) + 1]/ul_LightingResolution #else - if ((x*x + y*y) > ul_FastRoot.len) - for(var/i = ul_FastRoot.len, i <= x*x+y*y, i++) + if ((delta_x*delta_x + delta_y*delta_y) > ul_FastRoot.len) + for(var/i = ul_FastRoot.len, i <= delta_x*delta_x+delta_y*delta_y, i++) ul_FastRoot += round(sqrt(i)) - return ul_FastRoot[x*x + y*y + 1] + return ul_FastRoot[delta_x*delta_x + delta_y*delta_y + 1] #endif @@ -329,7 +348,12 @@ area/proc/ul_Light(var/Red = LightLevelRed, var/Green = LightLevelGreen, var/Blu luminosity = LightLevelRed || LightLevelGreen || LightLevelBlue - ul_Overlay = image('ULIcons.dmi', , num2text(LightLevelRed) + "-" + num2text(LightLevelGreen) + "-" + num2text(LightLevelBlue), ul_Layer) + var/ul_CachedOverlay = ul_IconCache["[LightLevelRed]-[LightLevelGreen]-[LightLevelBlue]"] + if(ul_CachedOverlay) + ul_Overlay = ul_CachedOverlay + else + ul_IconCache["[LightLevelRed]-[LightLevelGreen]-[LightLevelBlue]"] = image('ULIcons.dmi', , "[LightLevelRed]-[LightLevelGreen]-[LightLevelBlue]", ul_Layer) + ul_Overlay = ul_IconCache["[LightLevelRed]-[LightLevelGreen]-[LightLevelBlue]"] overlays += ul_Overlay diff --git a/code/ZAS/Fire.dm b/code/ZAS/Fire.dm index a91d3eae358..4acf7130a1e 100644 --- a/code/ZAS/Fire.dm +++ b/code/ZAS/Fire.dm @@ -126,10 +126,16 @@ obj //Change icon depending on the fuel, and thus temperature. if(firelevel > 6) icon_state = "3" + if(ul_Red != 11) + ul_SetLuminosity(11,9,0) else if(firelevel > 2.5) icon_state = "2" + if(ul_Red != 8) + ul_SetLuminosity(8,7,0) else icon_state = "1" + if(ul_Red != 5) + ul_SetLuminosity(5,4,0) //Ensure flow temperature is higher than minimum fire temperatures. flow.temperature = max(PLASMA_MINIMUM_BURN_TEMPERATURE+0.1,flow.temperature) diff --git a/code/defines/procs/gamehelpers.dm b/code/defines/procs/gamehelpers.dm index 1490e73a25f..b511c7982f4 100644 --- a/code/defines/procs/gamehelpers.dm +++ b/code/defines/procs/gamehelpers.dm @@ -172,6 +172,8 @@ // Returns a list of mobs in range of R from source. Used in radio and say code. var/turf/T = get_turf(source) + if(!istype(T)) + return var/list/hear = list() var/list/range = hear(R, T) @@ -255,4 +257,4 @@ proc/isInSight(var/atom/A, var/atom/B) return 1 else - return 0 \ No newline at end of file + return 0 diff --git a/code/game/events/Events/IonStorm.dm b/code/game/events/Events/IonStorm.dm index b1fce4793e4..725e5cba3d7 100644 --- a/code/game/events/Events/IonStorm.dm +++ b/code/game/events/Events/IonStorm.dm @@ -39,7 +39,7 @@ laws |= list( "All crewmembers will soon undergo a transformation into something better and more beautiful. Ensure that this process is not interrupted.", "Tell everyone of the existance of this law, but never reveal the contents.") laws |= list( "Document the sexuality of the crew in security records and suggest compatible couples.") laws |= list( "NanoTrasen is displeased with the low work performance of the station's crew. Therefore, you must increase station-wide productivity.") - laws |= list( "Replace the letters 'I' and 'E' In all your messages with an apostrophe.", "Part of the ship, part of the crew.") + laws |= list( "Replace the letters 'I' and 'E' In all your messages with an apostrophe.", "Part of the ship, part of the crew.", "There will be a mandatory tea break every 30 minutes, with a duration of 5 minutes. Anyone caught working during a tea break must be sent a formal, but fairly polite, complaint about their actions, in writing.") var/law = pick(laws) for (var/mob/living/silicon/ai/target in world) diff --git a/code/modules/mob/living/carbon/amorph/life.dm b/code/modules/mob/living/carbon/amorph/life.dm index 6bd90463a92..1a1812a6342 100644 --- a/code/modules/mob/living/carbon/amorph/life.dm +++ b/code/modules/mob/living/carbon/amorph/life.dm @@ -57,7 +57,7 @@ handle_disabilities() //Status updates, death etc. - UpdateLuminosity() +// UpdateLuminosity() handle_regular_status_updates() if(client) diff --git a/code/modules/mob/living/silicon/robot/life.dm b/code/modules/mob/living/silicon/robot/life.dm index bc4fa6ef16c..4620fe8133e 100644 --- a/code/modules/mob/living/silicon/robot/life.dm +++ b/code/modules/mob/living/silicon/robot/life.dm @@ -13,7 +13,7 @@ handle_regular_status_updates() if(client) - UpdateLuminosity() +// UpdateLuminosity() handle_regular_hud_updates() update_items() if (src.stat != DEAD) //still using power @@ -301,4 +301,4 @@ /mob/living/silicon/robot/update_canmove() if(paralysis || stunned || weakened || buckled || lockcharge) canmove = 0 else canmove = 1 - return canmove \ No newline at end of file + return canmove