181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
for name,user in pairs(starlit.activeUsers) do
local tr = user:species().tempRange
local t = starlit.world.climate.temp(user.entity:get_pos())
do -- this bit probably belongs in starlit:bio but we do it here in order
-- to spare ourselves another call into the dark swamp of climate.temp
local urg = 1
local function alarm(kind)
user:alarm(urg, kind, nil, {
elt = user.hud.elt.temp, ofs = {x=100,y=0};
tex = 'starlit-ui-alert-'..kind..'.png';
})
end
local hz = user:tempHazard(t)
local tr = user:species().tempRange.survivable
if hz == 'cold' then
if tr[1] - t > 7 then urg = 2 end
alarm 'temp-cold'
elseif hz == 'hot' then
if t - tr[2] > 7 then urg = 2 end
alarm 'temp-hot'
end
end
local insul = 0
local naked = user:naked()
local suitDef
if not naked then
|
|
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
for name,user in pairs(starlit.activeUsers) do
local tr = user:species().tempRange
local t = starlit.world.climate.temp(user.entity:get_pos())
do -- this bit probably belongs in starlit:bio but we do it here in order
-- to spare ourselves another call into the dark swamp of climate.temp
local urg = 1
local hz = user:tempHazard(t)
local tr = user:species().tempRange.survivable
if hz == 'cold' then
if tr[1] - t > 7 then urg = 2 end
user:alarm(urg, 'freeze', 3)
elseif hz == 'hot' then
if t - tr[2] > 7 then urg = 2 end
user:alarm(urg, 'overheat', 3)
end
end
local insul = 0
local naked = user:naked()
local suitDef
if not naked then
|