Differences From
Artifact [1ac6a2a876]:
245 245 text = def.tex;
246 246 scale = def.scale;
247 247 alignment = def.align;
248 248 position = def.pos;
249 249 offset = def.ofs;
250 250 z_index = def.z;
251 251 }
252 - if def.update then
253 - img.update = function()
254 - def.update(user, function(prop, val)
255 - user:hud_change(img.id, prop, val)
256 - end, def)
257 - end
252 + function img.chg(prop, val)
253 + user:hud_change(img.id, prop, val)
258 254 end
255 + img.update = def.update and function()
256 + def.update(user, img.chg, def)
257 + end or function() end
259 258 return img
260 259 end;
261 260 attachMeter = function(self, def)
262 261 local luser = self.entity
263 262 local m = {def = def}
264 263 local w = def.size or 80
265 264 local szf = w / 80
................................................................................
528 527 end
529 528 self:updateLEDs()
530 529 end;
531 530 updateLEDs = function(self)
532 531 local time = minetest.get_gametime()
533 532 local function updateSide(name, ofs, tx)
534 533 local del = {}
534 + local idx = 0
535 535 for i, l in ipairs(self.hud.led[name]) do
536 - local idx = 0
537 536 if time - l.origin > 3 then
538 537 if l.elt then self.entity:hud_remove(l.elt.id) end
539 538 self.hud.led.map[l.kind] = nil
540 539 table.insert(del, i)
541 540 else
542 - local xc = (idx*48 + 400)*ofs
541 + local xc = (idx*80 + 399)*ofs
543 542 if l.elt and next(del) then
544 - l.elt:update('offset', {x=xc, y=1})
543 + l.elt.chg('offset', {x=xc, y=1})
545 544 else
546 545 local tex = leds[l.kind].icon:blit(hudAdjustBacklight(leds[l.kind].bg))
547 546 if tx then tex = lib.image(tex:render()):transform(tx) end
548 547 if not l.elt then
549 548 l.elt = self:attachImage {
550 549 tex = tex:render();
551 550 align = {x=ofs, y=-1};
................................................................................
1031 1030
1032 1031 if time - self.cooldownTimes.alarm > 1.5 then
1033 1032 self.cooldownTimes.alarm = time
1034 1033 self:suitSound(urg.sound)
1035 1034 end
1036 1035 end
1037 1036
1038 -
1039 1037 local newLed = {
1040 1038 kind = kind;
1041 1039 origin = time;
1042 1040 }
1043 1041 self.hud.led.map[kind] = newLed
1044 1042 table.insert(self.hud.led[led.side], newLed)
1045 -
1046 1043
1047 1044 self:updateLEDs()
1048 1045
1049 1046 --[[
1050 1047 freq = freq or 3
1051 1048 local urgencies = {
1052 1049 [1] = {sound = 'starlit-alarm'};