starlit  Diff

Differences From Artifact [1a0e392600]:

To Artifact [8da9d84fa1]:


   214    214   			return val, (val - min) / d
   215    215   		end;
   216    216   
   217    217   		---------------
   218    218   		-- phenotype --
   219    219   		---------------
   220    220   		lookupSpecies = function(self)
   221         -			return starlit.world.species.lookup(self.persona.species, self.persona.speciesVariant)
          221  +			return starlit.world.species.lookup(
          222  +				self.persona.species,
          223  +				self.persona.speciesVariant)
   222    224   		end;
   223    225   		phenoTrait = function(self, trait, dflt)
   224    226   -- 			local s,v = self:lookupSpecies()
   225    227   -- 			return v.traits[trait] or s.traits[trait] or 0
   226    228   			return self.pheno:trait(trait, dflt)
   227    229   		end;
   228    230   		damageModifier = function(self, kind, amt)
................................................................................
   352    354   			local luser = self.entity
   353    355   			local bar = {def = def}
   354    356   			local img = lib.image 'starlit-ui-bar.png'
   355    357   			local colorized = img
   356    358   			if type(def.color) ~= 'function' then
   357    359   				colorized = colorized:shift(def.color)
   358    360   			end
          361  +
          362  +			local function adjustNumber(n)
          363  +				-- produce a value that is realized as whole number
          364  +				-- of images, rather than half-images
          365  +				return math.floor(n/2)*2;
          366  +			end
   359    367   
   360    368   			bar.id = luser:hud_add {
   361    369   				type = 'statbar';
   362    370   				position = def.pos;
   363    371   				offset = def.ofs;
   364    372   				name = def.name;
          373  +				number = adjustNumber(def.size);
   365    374   				text = colorized:render();
   366    375   				text2 = img:tint{hue=0, sat=-1, lum = -0.5}:fade(0.5):render();
   367         -				number = def.size;
   368    376   				item = def.size;
   369    377   				direction = def.dir;
   370    378   				alignment = def.align;
   371    379   				size = {x=4,y=24};
   372    380   			}
   373    381   			bar.update = function()
   374    382   				local sv, sf = def.stat(self, bar, def)
   375         -				luser:hud_change(bar.id, 'number', def.size * sf)
          383  +				luser:hud_change(bar.id, 'number', adjustNumber(def.size * sf))
   376    384   				if type(def.color) == 'function' then
   377    385   					local clr = def.color(sv, luser, sv, sf)
   378    386   					luser:hud_change(bar.id, 'text', img:tint(clr):render())
   379    387   				end
   380    388   			end
   381         -			return bar, {x=3 * def.size, y=16} -- x*2??? what
          389  +			return bar, {x=3 * def.size, y=16} -- x*3??? what
   382    390   		end;
   383    391   		createHUD = function(self)
   384    392   			local function basicStat(statName)
   385    393   				return function(user, bar)
   386    394   					return self:effectiveStat(statName)
   387    395   				end
   388    396   			end