Overview
Comment: | add chem radiator, add dummy radiator props to underfloor heater, complete (?) unfinished radiator API, fix longstanding LED offset buggery & crash, fix asset filename issue for LEDs, fix broken vector func |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2e501ef0db93a7c47eeb2926ebd6dd9f |
User & Date: | lexi on 2024-05-15 20:37:58 |
Original Comment: | add chem radiator add dummy radiator props to underfloor heater fix longstanding LED offset buggery & crash fix asset filename issue for LEDs fix broken vector func |
Other Links: | manifest | tags |
Context
2024-12-19
| ||
20:03 | unfuck cpio invocations check-in: e926621707 user: root tags: trunk | |
2024-05-15
| ||
20:37 | add chem radiator, add dummy radiator props to underfloor heater, complete (?) unfinished radiator API, fix longstanding LED offset buggery & crash, fix asset filename issue for LEDs, fix broken vector func check-in: 2e501ef0db user: lexi tags: trunk | |
18:51 | add (nonfunctional) floor heater check-in: d6efac25ef user: lexi tags: trunk | |
Changes
Modified asset.list from [38c250b2ba] to [33338e0378].
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
mods/starlit/textures/starlit-terrain-greengraze.png~ mods/starlit/textures/starlit-terrain-lifesilt.png mods/starlit/textures/starlit-terrain-sand.png mods/starlit/textures/starlit-terrain-soil.png mods/starlit/textures/starlit-terrain-undergloam-overlay.png mods/starlit/textures/starlit-terrain-cuprite.png mods/starlit/textures/starlit-terrain-undergloam.png mods/starlit/textures/starlit-ui-alert-bg-hot.png mods/starlit/textures/starlit-ui-alert-bg-hydration.png mods/starlit/textures/starlit-ui-alert-bg-nutrition.png mods/starlit/textures/starlit-ui-alert-bg-rad.png mods/starlit/textures/starlit-ui-alert-bg-success.png mods/starlit/textures/starlit-ui-alert-bg-temp-cold.png mods/starlit/textures/starlit-ui-alert-bg-temp-rad.png mods/starlit/textures/starlit-ui-alert-hydration.png mods/starlit/textures/starlit-ui-alert-item.png mods/starlit/textures/starlit-ui-alert-nutrition.png mods/starlit/textures/starlit-ui-alert-rad.png mods/starlit/textures/starlit-ui-alert-temp-cold.png mods/starlit/textures/starlit-ui-alert-temp-hot.png mods/starlit/textures/starlit-ui-alert.png |
< | | |
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
mods/starlit/textures/starlit-terrain-greengraze.png~ mods/starlit/textures/starlit-terrain-lifesilt.png mods/starlit/textures/starlit-terrain-sand.png mods/starlit/textures/starlit-terrain-soil.png mods/starlit/textures/starlit-terrain-undergloam-overlay.png mods/starlit/textures/starlit-terrain-cuprite.png mods/starlit/textures/starlit-terrain-undergloam.png mods/starlit/textures/starlit-ui-alert-bg-hydration.png mods/starlit/textures/starlit-ui-alert-bg-nutrition.png mods/starlit/textures/starlit-ui-alert-bg-rad.png mods/starlit/textures/starlit-ui-alert-bg-success.png mods/starlit/textures/starlit-ui-alert-bg-temp-hot.png mods/starlit/textures/starlit-ui-alert-bg-temp-cold.png mods/starlit/textures/starlit-ui-alert-hydration.png mods/starlit/textures/starlit-ui-alert-item.png mods/starlit/textures/starlit-ui-alert-nutrition.png mods/starlit/textures/starlit-ui-alert-rad.png mods/starlit/textures/starlit-ui-alert-temp-cold.png mods/starlit/textures/starlit-ui-alert-temp-hot.png mods/starlit/textures/starlit-ui-alert.png |
Modified mods/starlit-building/init.lua from [c6afb91b3d] to [cc61bb3736].
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
if not B.path[from] then return nil end return B.path[from][kind][what] end B.stage.foreach('starlit:stageGen', {}, function(id, e) local grp = e.groups and table.copy(e.groups) or {} grp.stage = 1 minetest.register_node(id, { description = 'Construction'; drawtype = (e.box and 'nodebox') or (e.mesh and 'mesh') or 'regular'; paramtype = e.paramtype or (e.box or e.mesh or e.light) and 'light' or nil; paramtype2 = e.paramtype2 or 'none'; tiles = e.tex; node_box = e.box; mesh = e.mesh; groups = grp; _starlit = { stage = id; recover = e.recover; }; }) if e.begin then for _, kind in ipairs {'part', 'tool'} do for i, v in ipairs(e.begin[kind] or {}) do assert(B.begin[kind][v] == nil, 'attempted to overwrite buildpath beginning') B.begin[kind][v] = id end |
> > > > > | < < < |
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
if not B.path[from] then return nil end return B.path[from][kind][what] end B.stage.foreach('starlit:stageGen', {}, function(id, e) local grp = e.groups and table.copy(e.groups) or {} grp.stage = 1 local meta = { stage = id; recover = e.recover; } for k,v in pairs(e.meta or {}) do meta[k] = v end minetest.register_node(id, { description = 'Construction'; drawtype = (e.box and 'nodebox') or (e.mesh and 'mesh') or 'regular'; paramtype = e.paramtype or (e.box or e.mesh or e.light) and 'light' or nil; paramtype2 = e.paramtype2 or 'none'; tiles = e.tex; node_box = e.box; mesh = e.mesh; groups = grp; _starlit = meta; }) if e.begin then for _, kind in ipairs {'part', 'tool'} do for i, v in ipairs(e.begin[kind] or {}) do assert(B.begin[kind][v] == nil, 'attempted to overwrite buildpath beginning') B.begin[kind][v] = id end |
Modified mods/starlit-building/stages/arch.lua from [625292d7b1] to [26a8b6ec24].
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
unscrew = { speed = 2; drop = 'starlit_building:panel'; swap = 'starlit_building:stage_floor_heater'; }; }; }; }) B.panelRun = lib.registry.mk 'starlit_building:panelRun' B.panelRun.foreach('starlit_building:runGen', {}, function(id, run) local F = string.format assert(run.name, 'missing name for panelrun') local name = run.name ................................................................................ }; }; }) local floorBasis = run.floorBasis or 'starlit_building:stage_foundation_insulation' B.pathLink(floorBasis, 'part', buildPart, floorStageRaw) mat = floorMat + fabFor 'starlit_building:panel'; B.stage.link(floorStage, { tex = { 'starlit-node-floor-panel-top.png'; 'starlit-node-concrete.png'; imgPlug:blit(lib.image 'starlit-node-floor-panel-side.png'):render(); }; recover = floorMat + fabFor 'starlit_building:panel'; |
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
<
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
...
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
unscrew = { speed = 2; drop = 'starlit_building:panel'; swap = 'starlit_building:stage_floor_heater'; }; }; }; groups = { radiator = 1; }; meta = { radiator = { -- FIXME -- maxEffectArea = function(pos) local r = 3 local dist = vector.new(r,r,r) return pos - dist, pos + dist end; radius = function(pos) return 3; end; radiate = function(rp, pos) return 0; end; -- END FIXME -- }; }; }) B.panelRun = lib.registry.mk 'starlit_building:panelRun' B.panelRun.foreach('starlit_building:runGen', {}, function(id, run) local F = string.format assert(run.name, 'missing name for panelrun') local name = run.name ................................................................................ }; }; }) local floorBasis = run.floorBasis or 'starlit_building:stage_foundation_insulation' B.pathLink(floorBasis, 'part', buildPart, floorStageRaw) B.stage.link(floorStage, { tex = { 'starlit-node-floor-panel-top.png'; 'starlit-node-concrete.png'; imgPlug:blit(lib.image 'starlit-node-floor-panel-side.png'):render(); }; recover = floorMat + fabFor 'starlit_building:panel'; |
Modified mods/starlit-scenario/init.lua from [d2f3af923b] to [8a376bbedc].
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
r.files = files E.chip.write(chip, r) return chip end local survivalBasics = { {'starlit_tech:chem_lamp', 0}; {'starlit_tech:crate', 0}; {'starlit_building:battery_box', 0}; {'starlit_building:heating_element', 0}; {'starlit_building:electrode', 0}; {'starlit_building:cable_electric', 0}; {'starlit_building:transformer', 0}; {'starlit_building:concrete', 0}; |
> |
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
r.files = files
E.chip.write(chip, r)
return chip
end
local survivalBasics = {
{'starlit_tech:chem_lamp', 0};
{'starlit_tech:chem_radiator', 0};
{'starlit_tech:crate', 0};
{'starlit_building:battery_box', 0};
{'starlit_building:heating_element', 0};
{'starlit_building:electrode', 0};
{'starlit_building:cable_electric', 0};
{'starlit_building:transformer', 0};
{'starlit_building:concrete', 0};
|
Modified mods/starlit-tech/init.lua from [de8d4eba0f] to [22b6956759].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
local lib = starlit.mod.lib do -- chemlamp local burnTime = 60*60 local maxBright = 12 local stages = maxBright local stageTimeout = burnTime / stages local function chemLampID(n) if n == stages then return 'starlit_tech:chem_lamp' end return string.format('starlit_tech:chem_lamp_%s',n) end local fab = starlit.type.fab { element = { carbon = 4, magnesium = 1 }; cost = { power = 100 }; flag = { print = true }; time = { print = 5 }; }; for i = stages, 0, -1 do minetest.register_node(chemLampID(i), { short_description = 'Chem Lamp'; description = starlit.ui.tooltip { title = 'Chem Lamp'; desc = "A simple carbon-frame chemical light source powered by ambient oxygen. Cheap, quick to print, and biodedragable, without any need for an electric grid or complex power storage mechanism. However, the light only lasts a few days, after which the lamp must be recycled or discarded."; color = lib.color(1,.4,.1); props = { {title = 'Burn Remaining', desc=lib.math.timespec(stageTimeout * i), affinity=i > 4 and 'good' or 'bad'}; {title = 'Mass', desc='10g', affinity='info'}; }; }; drawtype = 'nodebox'; groups = { object = 1; attached_node = 1; }; node_box = { type = 'fixed'; fixed = { -.4, -.5, -.20; .4, -.3, .20; }; }; tiles = { lib.image 'starlit-tech-lamp-glow.png' :fade(1 - i/stages) :blit(lib.image 'starlit-tech-lamp.png') :render(); }; paramtype = 'light'; paramtype2 = 'wallmounted'; wallmounted_rotate_vertical = true; light_source = math.floor(lib.math.lerp(i/stages, 0, maxBright)); on_construct = i ~= 0 and function(pos) local t = minetest.get_node_timer(pos) t:start(stageTimeout) end or nil; on_timer = i ~= 0 and function(pos) local me = minetest.get_node(pos) minetest.swap_node(pos, {name=chemLampID(i-1), param2=me.param2}) return i > 1 end or nil; _starlit = { mass = 10; reverseEngineer = { complexity = 1; sw = 'starlit_tech:schematic_chem_lamp'; }; recover = starlit.type.fab { element = { carbon = 8; magnesium = math.floor(lib.math.lerp(i/stages, 0, 2)); }; time = { shred = .5; shredPower = 2; }; }; }; }) end starlit.item.sw.link('starlit_tech:schematic_chem_lamp', { name = 'Chem Lamp Schematic'; kind = 'schematic'; input = fab; output = chemLampID(stages); size = 32e6; cost = { cycles = 8e9; ram = 16e6; }; rarity = 1; }) end minetest.register_node('starlit_tech:crate', { short_description = 'Crate'; description = starlit.ui.tooltip { title = 'Crate'; desc = 'A sturdy but lightweight storage crate woven from graphene.'; props = { {title='Mass', affinity='info', desc='100g'} }; |
| | | | | | | | | | | | | | | | | | | | | | | | | > | < < < | | | < < < < < | > > > > | | > | | | < > | > > | < < < < | | | | | | < > > > | | < > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
local lib = starlit.mod.lib local function mkBurnDown(def) -- chemlamp local burnTime = def.time local stages = def.stages or 10 local stageTimeout = burnTime / stages local function stID(n) if n == stages then return def.id end return string.format('%s_%s',def.id,n) end local fab = def.fab for i = stages, 0, -1 do local grp = { object = 1; attached_node = 1; } if def.group then for k,v in pairs(def.group((i/stages))) do grp[k]=v end end minetest.register_node(stID(i), { short_description = def.name; description = starlit.ui.tooltip { title = def.name; desc = def.desc; color = def.color; props = { {title = 'Burn Remaining', desc=lib.math.timespec(stageTimeout * i), affinity=i > (stages/2) and 'good' or 'bad'}; {title = 'Mass', desc=lib.math.siUI('g', def.mass), affinity='info'}; }; }; drawtype = 'nodebox'; groups = grp; node_box = { type = 'fixed'; fixed = { -(7/16), -.5, -(4/16); (7/16), -.5 + (2/16), (4/16); }; }; tiles = def.tile((i/stages)); paramtype = 'light'; paramtype2 = 'wallmounted'; wallmounted_rotate_vertical = true; light_source = math.floor(lib.math.lerp(i/stages, 0, def.glow)); on_construct = i ~= 0 and function(pos) local t = minetest.get_node_timer(pos) t:start(stageTimeout) if def.ctor then def.ctor(pos, (i/stages)) end end or nil; on_destruct = def.dtor and function(pos) def.dtor(pos, (i/stages)) end or nil; on_timer = i ~= 0 and function(pos) local me = minetest.get_node(pos) minetest.swap_node(pos, {name=stID(i-1), param2=me.param2}) return i > 1 end or nil; _starlit = (function() local meta = { mass = def.mass; reverseEngineer = { complexity = 1; sw = def.id .. '_schematic'; }; recover = def.mat + (def.fuel / (i/stages)) + starlit.type.fab { time = { shred = .5; shredPower = 2; }; }; } for k,v in pairs(def.meta and def.meta((i/stages)) or {}) do meta[k]=v end return meta end)(); }) end starlit.item.sw.link(def.id .. '_schematic', { name = def.name .. ' Schematic'; kind = 'schematic'; input = def.fab + def.mat + def.fuel; output = stID(stages); size = 32e6; cost = { cycles = 8e9; ram = 16e6; }; rarity = 1; }) end mkBurnDown { id = 'starlit_tech:chem_lamp'; name = 'Chem Lamp'; desc = "A simple carbon-frame chemical light source powered by ambient oxygen. Cheap, quick to print, and biodedragable, without any need for an electric grid or complex power storage mechanism. However, the light only lasts a few days, after which the lamp must be recycled or discarded."; stages = 12; glow = 12; time = 60*60; mass = 10; color = lib.color(1,.4,.1); tile = function(f) return { lib.image 'starlit-tech-lamp-glow.png' :fade(f) :blit(lib.image 'starlit-tech-lamp.png') :render(); } end; fab = starlit.type.fab { cost = { power = 100 }; flag = { print = true }; time = { print = 5 }; }; mat = starlit.type.fab { element = { carbon = 4 }; }; fuel = starlit.type.fab { element = { magnesium = 1 }; }; } mkBurnDown { id = 'starlit_tech:chem_radiator'; name = 'Chem Radiator'; desc = "A simple carbon-frame chemical heat source powered by ambient oxygen. Cheap, quick to print, and biodedragable, without any need for an electric grid or complex power storage mechanism. However, the heat only lasts a few hours, after which the lamp must be recycled or discarded."; stages = 12; glow = 7; time = 15*60; mass = 10; color = lib.color(1,.4,.1); tile = function(f) return { lib.image 'starlit-tech-lamp-glow.png' :fade(f) :blit(lib.image 'starlit-tech-lamp.png') :tint{hue=0,sat=1,lum=.5}:render(); } end; fab = starlit.type.fab { cost = { power = 150 }; flag = { print = true }; time = { print = 10 }; }; mat = starlit.type.fab { element = { carbon = 4 }; }; fuel = starlit.type.fab { element = { magnesium = 2, iron = 2 }; }; group = function(f) if f > 0 then return {radiator=1} else return {} end end; ctor = function(pos, f) starlit.region.radiator.scan(pos) end; dtor = function(pos, f) starlit.region.radiator.unload(pos) end; meta = function(f) return { radiator = { radius = function(pos) return 2; end; radiate = function(rp, pos) return 15 * f end; }; } end; } minetest.register_node('starlit_tech:crate', { short_description = 'Crate'; description = starlit.ui.tooltip { title = 'Crate'; desc = 'A sturdy but lightweight storage crate woven from graphene.'; props = { {title='Mass', affinity='info', desc='100g'} }; |
Modified mods/starlit/init.lua from [df4ee2ddd8] to [44e70e86d4].
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
-- complex algorithms that cut across namespaces or don't belong anywhere else alg = {}; region = { radiator = { store = AreaStore(); emitters = {}; }; }; -- standardized effects fx = {}; type = {}; ................................................................................ if not chunk then error(err) end return chunk(...) end function starlit.include(name, ...) -- semantic variant used for loading modules return starlit.evaluate(name..'.lua', ...) end minetest.register_lbm { label = 'build radiator index'; name = 'starlit:loadradiatorboxes'; nodenames = {'group:radiator'}; run_at_every_load = true; action = function(pos, node, dt) local R = starlit.region local phash = minetest.hash_node_position(pos) if R.radiator.sources[phash] then return end -- already loaded local def = minetest.registered_nodes[node.name] local cl = def._starlit.radiator local min,max = cl.maxEffectArea(pos) local id = R.radiator.store:insert_area(min,max, minetest.pos_to_string(pos)) R.radiator.sources[phash] = id end; -- NOTE: temp emitter nodes are responsible for decaching themselves in their on_destruct cb } function starlit.startJob(id, interval, job) local lastRun local function start() starlit.jobs[id] = minetest.after(interval, function() local t = minetest.get_gametime() local d = lastRun and t - lastRun or nil |
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
<
<
<
<
<
<
<
<
>
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
-- complex algorithms that cut across namespaces or don't belong anywhere else alg = {}; region = { radiator = { store = AreaStore(); sources = {}; }; }; -- standardized effects fx = {}; type = {}; ................................................................................ if not chunk then error(err) end return chunk(...) end function starlit.include(name, ...) -- semantic variant used for loading modules return starlit.evaluate(name..'.lua', ...) end function starlit.region.radiator.scan(pos,node) local R = starlit.region local phash = minetest.hash_node_position(pos) if R.radiator.sources[phash] then return end -- already loaded node = node or minetest.get_node(pos) local def = minetest.registered_nodes[node.name] local cl = def._starlit and def._starlit.radiator if not cl then return nil end local min,max = cl.maxEffectArea and cl.maxEffectArea(pos) or nil if not min then assert(cl.radius, 'no radius callback for radiator') local r = cl.radius(pos) local vr = vector.new(r,r,r) min,max = pos-vr, pos+vr end local id = R.radiator.store:insert_area(min,max, minetest.pos_to_string(pos)) R.radiator.sources[phash] = id end function starlit.region.radiator.unload(pos) local R = starlit.region local phash = minetest.hash_node_position(pos) local id = R.radiator.sources[phash] R.radiator.store:remove_area(id) R.radiator.sources[phash] = nil end minetest.register_lbm { label = 'build radiator index'; name = 'starlit:loadradiatorboxes'; nodenames = {'group:radiator'}; run_at_every_load = true; action = function(pos, node, dt) starlit.region.radiator.scan(pos, node) end; -- NOTE: temp emitter nodes are responsible for decaching themselves in their on_destruct cb } function starlit.startJob(id, interval, job) local lastRun local function start() starlit.jobs[id] = minetest.after(interval, function() local t = minetest.get_gametime() local d = lastRun and t - lastRun or nil |
Modified mods/starlit/user.lua from [1ac6a2a876] to [ae84fc4236].
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 ... 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 .... 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 |
text = def.tex; scale = def.scale; alignment = def.align; position = def.pos; offset = def.ofs; z_index = def.z; } if def.update then img.update = function() def.update(user, function(prop, val) user:hud_change(img.id, prop, val) end, def) end end return img end; attachMeter = function(self, def) local luser = self.entity local m = {def = def} local w = def.size or 80 local szf = w / 80 ................................................................................ end self:updateLEDs() end; updateLEDs = function(self) local time = minetest.get_gametime() local function updateSide(name, ofs, tx) local del = {} for i, l in ipairs(self.hud.led[name]) do local idx = 0 if time - l.origin > 3 then if l.elt then self.entity:hud_remove(l.elt.id) end self.hud.led.map[l.kind] = nil table.insert(del, i) else local xc = (idx*48 + 400)*ofs if l.elt and next(del) then l.elt:update('offset', {x=xc, y=1}) else local tex = leds[l.kind].icon:blit(hudAdjustBacklight(leds[l.kind].bg)) if tx then tex = lib.image(tex:render()):transform(tx) end if not l.elt then l.elt = self:attachImage { tex = tex:render(); align = {x=ofs, y=-1}; ................................................................................ if time - self.cooldownTimes.alarm > 1.5 then self.cooldownTimes.alarm = time self:suitSound(urg.sound) end end local newLed = { kind = kind; origin = time; } self.hud.led.map[kind] = newLed table.insert(self.hud.led[led.side], newLed) self:updateLEDs() --[[ freq = freq or 3 local urgencies = { [1] = {sound = 'starlit-alarm'}; |
| < < | < | < > > > < | > | | < < |
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 ... 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 .... 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
text = def.tex; scale = def.scale; alignment = def.align; position = def.pos; offset = def.ofs; z_index = def.z; } function img.chg(prop, val) user:hud_change(img.id, prop, val) end img.update = def.update and function() def.update(user, img.chg, def) end or function() end return img end; attachMeter = function(self, def) local luser = self.entity local m = {def = def} local w = def.size or 80 local szf = w / 80 ................................................................................ end self:updateLEDs() end; updateLEDs = function(self) local time = minetest.get_gametime() local function updateSide(name, ofs, tx) local del = {} local idx = 0 for i, l in ipairs(self.hud.led[name]) do if time - l.origin > 3 then if l.elt then self.entity:hud_remove(l.elt.id) end self.hud.led.map[l.kind] = nil table.insert(del, i) else local xc = (idx*80 + 399)*ofs if l.elt and next(del) then l.elt.chg('offset', {x=xc, y=1}) else local tex = leds[l.kind].icon:blit(hudAdjustBacklight(leds[l.kind].bg)) if tx then tex = lib.image(tex:render()):transform(tx) end if not l.elt then l.elt = self:attachImage { tex = tex:render(); align = {x=ofs, y=-1}; ................................................................................ if time - self.cooldownTimes.alarm > 1.5 then self.cooldownTimes.alarm = time self:suitSound(urg.sound) end end local newLed = { kind = kind; origin = time; } self.hud.led.map[kind] = newLed table.insert(self.hud.led[led.side], newLed) self:updateLEDs() --[[ freq = freq or 3 local urgencies = { [1] = {sound = 'starlit-alarm'}; |
Modified mods/vtlib/math.lua from [818384c4da] to [3e36361725].
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
fn.vsep = function(vec) -- separate a vector into a direction + magnitude
return vec:normalize(), vec:length()
end
-- minetest now only provides the version of this function that sqrts the result
-- which is pointlessly wasteful much of the time
fn.vdsq = function(a,b)
local d = vector.subtract(v1,v2)
return (d.x ^ 2) + (d.y ^ 2) + (d.z ^ 2)
end
fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points
-- (cheaper than calculating distance outright)
local d if v2
then d = vector.subtract(v1,v2)
|
| |
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
fn.vsep = function(vec) -- separate a vector into a direction + magnitude
return vec:normalize(), vec:length()
end
-- minetest now only provides the version of this function that sqrts the result
-- which is pointlessly wasteful much of the time
fn.vdsq = function(a,b)
local d = vector.subtract(a,b)
return (d.x ^ 2) + (d.y ^ 2) + (d.z ^ 2)
end
fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points
-- (cheaper than calculating distance outright)
local d if v2
then d = vector.subtract(v1,v2)
|