Overview
Comment: | ui latency/performance improvements, bugfixes |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f1e68eb97e0b1041ad71b87fc27e985e |
User & Date: | lexi on 2024-05-03 13:40:20 |
Other Links: | manifest | tags |
Context
2024-05-03
| ||
15:31 | genericize impacts check-in: 467a75e0dc user: lexi tags: trunk | |
13:40 | ui latency/performance improvements, bugfixes check-in: f1e68eb97e user: lexi tags: trunk | |
00:10 | add sprint, improve bio job, rebalance stamina regen, various fixes check-in: cade6683f7 user: lexi tags: trunk | |
Changes
Modified mods/starlit-eco/init.lua from [0a9075eccb] to [fb6e06be08].
7 7 -- W Sp Su Au W 8 8 seasonalTemp = {-50, -10, 5, 5, -20, -50}; 9 9 def = { 10 10 node_top = 'starlit:greengraze', depth_top = 1; 11 11 node_filler = 'starlit:soil', depth_filler = 4; 12 12 node_riverbed = 'starlit:sand', depth_riverbed = 4; 13 13 y_min = 0; 14 - y_max = 512; 15 - heat_point = 20; 16 - humidity_point = 35; 14 + y_max = 56; 15 + heat_point = 50; 16 + humidity_point = 40; 17 17 }; 18 18 }) 19 19 20 20 world.ecology.biomes.link('starlit:forest', { 21 21 nightTempDelta = -20; 22 22 waterTempDelta = 0; 23 23 -- W Sp Su Au W ................................................................................ 24 24 seasonalTemp = {-40, -8, 10, 10, -14, -40}; 25 25 def = { 26 26 node_top = 'starlit:greengraze', depth_top = 1; 27 27 node_filler = 'starlit:soil', depth_filler = 4; 28 28 node_riverbed = 'starlit:sand', depth_riverbed = 4; 29 29 y_min = 0; 30 30 y_max = 256; 31 - heat_point = 50; 32 - humidity_point = 40; 31 + heat_point = 60; 32 + humidity_point = 45; 33 33 }; 34 34 }) 35 35 36 36 world.ecology.biomes.link('starlit:desert', { 37 37 nightTempDelta = -40; 38 38 waterTempDelta = 0; 39 39 -- W Sp Su Au W ................................................................................ 52 52 world.ecology.biomes.link('starlit:ocean', { 53 53 nightTempDelta = -35; 54 54 waterTempDelta = 5; 55 55 seasonalTemp = {0}; -- no seasonal variance 56 56 def = { 57 57 y_max = 3; 58 58 y_min = -512; 59 - heat_point = 50; 59 + heat_point = 60; 60 60 humidity_point = 70; 61 61 node_top = 'starlit:sand', depth_top = 1; 62 62 node_filler = 'starlit:sand', depth_filler = 3; 63 63 }; 64 64 }) 65 65 66 66 world.ecology.biomes.link('starlit:shiverdeep', { 67 67 nightTempDelta = -25; 68 68 waterTempDelta = 5; 69 69 -- W Sp Su Au W 70 70 seasonalTemp = {-70, -30, 0, -60, -70}; 71 71 def = { 72 72 y_max = 70; 73 - y_min = 1; 74 - heat_point = 0; 75 - humidity_point = 5; 73 + y_min = 0; 74 + heat_point = 20; 75 + humidity_point = 30; 76 76 node_water_top = 'starlit:ice', depth_water_top = 1; 77 77 node_top = 'starlit:undergloam', depth_top = 1; 78 78 node_filler = 'starlit:soil', depth_filler = 2; 79 79 }; 80 80 }) 81 81 82 82 world.ecology.biomes.link('starlit:silthaven', { ................................................................................ 83 83 nightTempDelta = -5; 84 84 waterTempDelta = 5; 85 85 -- W Sp Su Au W 86 86 seasonalTemp = {-15, 5, 15, 7, -15}; 87 87 def = { 88 88 y_max = 30; 89 89 y_min = 0; 90 - heat_point = 15; 91 - humidity_point = 35; 90 + heat_point = 30; 91 + humidity_point = 30; 92 92 -- node_top = 'starlit:undergloam', depth_top = 1; 93 93 node_filler = 'starlit:lifesilt', depth_filler = 5; 94 94 }; 95 95 }) 96 96 97 97 world.ecology.biomes.link('starlit:barrens', { 98 98 nightTempDelta = -20; 99 99 waterTempDelta = 5; 100 100 -- W Sp Su Au W 101 101 seasonalTemp = {-30, -20, 0, -20, -30}; 102 102 def = { 103 103 y_max = 512; 104 - y_min = 0; 104 + y_min = -512; 105 105 heat_point = 0; 106 106 humidity_point = 0; 107 107 }; 108 108 }) 109 109 minetest.register_craftitem('starlit_eco:fiber', { 110 110 description = "Plant Fiber"; 111 111 groups = {fiber = 1};
Modified mods/starlit/species.lua from [7816834c67] to [47cb5f4a38].
44 44 end 45 45 elseif ctx.how.state == 'prog' then 46 46 local d = ctx.how.delta 47 47 local p = user.action.prog.sprint 48 48 -- is the player currently holding any of WASD 49 49 local isMoving = bit.band(0x0f, user.entity:get_player_control_bits()) ~= 0 50 50 if p and isMoving then 51 + user.cooldownTimes.stamina = minetest.get_gametime() 51 52 p.cb = p.cb + cost*d 52 - if p.cb >= 10 then 53 - user:statDelta('stamina', -10) 54 - if user:effectiveStat 'stamina' < 10 then halt() end 53 + if p.cb >= 5 then 54 + user:statDelta('stamina', -p.cb) 55 + p.cb = 0 56 + if user:effectiveStat 'stamina' < cost then halt() end 55 57 end 56 58 end 57 59 elseif ctx.how.state == 'halt' then 58 60 halt() 59 61 end 60 62 end; 61 63 }; ................................................................................ 88 90 local invis = lib.image '[fill:1x1:0,0:#00000000' 89 91 local plate = adorn.suit and adorn.suit.plate or invis 90 92 local lining = adorn.suit and adorn.suit.lining or invis 91 93 92 94 return {lining, plate, skin, skin, eye, hair} 93 95 end; 94 96 stats = { 95 - psiRegen = 1.3; 96 - psiPower = 1.2; 97 97 psi = 1.2; 98 98 nutrition = .8; -- women have smaller stomachs 99 99 hydration = .8; 100 100 morale = 0.8; -- you are not She-Bear Grylls 101 + irradiation = 0.8; -- you are smaller, so it takes less rads to kill ya 101 102 }; 102 103 traits = { 103 104 health = 400; 104 105 lungCapacity = .6; 105 - irradiation = 0.8; -- you are smaller, so it takes less rads to kill ya 106 106 sturdiness = 0; -- women are more fragile and thus susceptible to blunt force trauma 107 107 metabolism = .150; -- kCal/s 108 108 painTolerance = 0.4; 109 109 dehydration = 10e-4; -- L/s 110 110 speed = 1.1; 111 - staminaRegen = 30.0; 111 + staminaRegen = 10.0; 112 + psiRegen = 1.3; 113 + psiPower = 1.2; 112 114 }; 113 115 }; 114 116 male = { 115 117 name = 'Human Male'; 116 118 eyeHeight = 1.6; 117 119 stats = { 118 - psiRegen = 1.0; 119 - psiPower = 1.0; 120 120 psi = 1.0; 121 121 nutrition = 1.0; 122 122 hydration = 1.0; 123 - staminaRegen = 20; -- men are strong but have inferior endurance 123 + staminaRegen = 7; -- men are strong but have inferior endurance 124 124 }; 125 125 traits = { 126 126 health = 500; 127 127 painTolerance = 1.0; 128 128 lungCapacity = 1.0; 129 129 sturdiness = 0.3; 130 130 metabolism = .150; -- kCal/s 131 131 dehydration = 15e-4; -- L/s 132 132 speed = 1.0; 133 + psiRegen = 1.0; 134 + psiPower = 1.0; 133 135 }; 134 136 }; 135 137 }; 136 138 traits = {}; 137 139 abilities = {bioAbilities.sprint}; 138 140 }; 139 141 }
Modified mods/starlit/stats.lua from [0892085f88] to [255a217522].
24 24 starlit.world.stats = { 25 25 psi = {min = 0, max = 500, base = 0, desc = U('ψ', 10), color = C(320), name = 'Numina'}; 26 26 -- numina is measured in daψ 27 27 warmth = {min = -1000, max = 1000, base = 0, desc = U('°C', 10, true), color = C(5), name = 'Warmth'}; 28 28 -- warmth in measured in d°C 29 29 fatigue = {min = 0, max = 76 * 60, base = 0, desc = U('hr', 60, true), color = C(288,.3,.5), name = 'Fatigue', srzType = T.decimal}; 30 30 -- fatigue is measured in minutes one needs to sleep to cure it 31 - stamina = {min = 0, max = 40 * 100, base = true, desc = U('m', 100), color = C(88), name = 'Stamina'}; 31 + stamina = {min = 0, max = 10 * 20, base = true, desc = U('m', 100), color = C(88), name = 'Stamina'}; 32 32 -- stamina is measured in how many 10th-nodes (== cm) one can sprint 33 33 nutrition = {min = 0, max = 8000, base = 0, desc = U('kCal', 1, true), color = C(43,.5,.4), name = 'Nutrition', srzType = T.decimal}; 34 34 -- hunger is measured in kcalories one must consume to cure it. at 0, you start dying 35 35 hydration = {min = 0, max = 4, base = 0, desc = U('L', 1), color = C(217, .25,.4), name = 'Hydration', srzType = T.decimal}; 36 36 -- thirst is measured in L of H²O required to cure it 37 37 morale = {min = 0, max = 10 * 24 * 60, base = true, desc = U('hr', 60, true), color = C(0,0,.8), name = 'Morale', srzType = T.decimal}; 38 38 -- morale is measured in minutes. e.g. at base rate morale degrades by
Modified mods/starlit/user.lua from [e60d6be4a9] to [788077fd8e].
36 36 name = luser:get_player_name() 37 37 end 38 38 return { 39 39 entity = luser; 40 40 name = name; 41 41 hud = { 42 42 elt = {}; 43 + bar = {}; 43 44 }; 44 45 tree = {}; 45 46 action = { 46 47 bits = 0; -- for control deltas 47 48 prog = {}; -- for recording action progress on a node; reset on refocus 48 49 tgt = {type='nothing'}; 49 50 sfx = {}; ................................................................................ 56 57 psi = {primary = nil, secondary = nil}; 57 58 maneuver = nil; 58 59 }; 59 60 pref = { 60 61 calendar = 'commune'; 61 62 }; 62 63 overlays = {}; 64 + cooldownTimes = { 65 + stamina = 0; 66 + }; 63 67 } 64 68 end; 65 69 __index = { 66 70 -------------- 67 71 -- overlays -- 68 72 -------------- 69 73 updateOverlays = function(self) ................................................................................ 131 135 132 136 if dt[stat]+base > max then dt[stat] = max-base 133 137 elseif dt[stat]+base < min then dt[stat] = min-base end 134 138 self:pushPersona() 135 139 end 136 140 137 141 138 - self:updateHUD() 142 + local sb = self.hud.bar[stat] 143 + if sb then sb:update() end 144 +-- self:updateHUD() 139 145 -- TODO trigger relevant animations? 140 146 end; 141 147 statRange = function(self, stat) --> min, max, base 142 148 return starlit.world.species.statRange( 143 149 self.persona.species, self.persona.speciesVariant, stat) 144 150 end; 145 151 effectiveStat = function(self, stat) ................................................................................ 315 321 return bar, {x=3 * def.size, y=16} -- x*2??? what 316 322 end; 317 323 createHUD = function(self) 318 324 local function basicStat(statName) 319 325 return function(user, bar) 320 326 return self:effectiveStat(statName) 321 327 end 328 + end 329 + local function attachBasicStat(def) 330 + local statName = def.stat 331 + def.stat = basicStat(def.stat) 332 + local b = self:attachStatBar(def) 333 + self.hud.bar[statName] = b 334 + return b 322 335 end 323 336 local function batteryLookup(user) 324 337 local max = user:suitPowerCapacity() 325 338 if max == 0 then return 0, 0 end 326 339 local ch = user:suitCharge() 327 340 return (ch/max)*100, ch/max 328 341 end 329 342 local function C(h,s,l) return {hue=h,sat=s,lum=l} end 330 343 local hbofs = (1+self.entity:hud_get_hotbar_itemcount()) * 25 331 344 local bpad = 8 332 - self.hud.elt.health = self:attachStatBar { 333 - name = 'health', stat = basicStat 'health'; 334 - color = C(340,0,.3), size = 100; 345 + self.hud.elt.health = attachBasicStat { 346 + name = 'health', stat = 'health'; 347 + color = C(10,0,.3), size = 100; 335 348 pos = {x=0.5, y=1}, ofs = {x = -hbofs, y=-48 - bpad}; 336 349 dir = 1; 337 350 align = {x=-1, y=-1}; 338 351 } 339 - self.hud.elt.stamina = self:attachStatBar { 340 - name = 'stamina', stat = basicStat 'stamina'; 352 + self.hud.elt.stamina = attachBasicStat { 353 + name = 'stamina', stat = 'stamina'; 341 354 color = C(60,0,.2), size = 100; 342 355 pos = {x=0.5, y=1}, ofs = {x = -hbofs, y=-24 - bpad}; 343 356 dir = 1; 344 357 align = {x=-1, y=-1}; 345 358 } 346 359 self.hud.elt.bat = self:attachStatBar { 347 360 name = 'battery', stat = batteryLookup; 348 361 color = C(190,0,.2), size = 100; 349 362 pos = {x=0.5, y=1}, ofs = {x = hbofs - 4, y=-48 - bpad}; 350 363 dir = 0; 351 364 align = {x=1, y=-1}; 352 365 } 353 - self.hud.elt.psi = self:attachStatBar { 354 - name = 'psi', stat = basicStat 'psi'; 366 + self.hud.elt.psi = attachBasicStat { 367 + name = 'psi', stat = 'psi'; 355 368 color = C(320,0,.2), size = 100; 356 369 pos = {x=0.5, y=1}, ofs = {x = hbofs - 4, y=-24 - bpad}; 357 370 dir = 0; 358 371 align = {x=1, y=-1}; 359 372 } 360 373 self.hud.elt.time = self:attachTextBox { 361 374 name = 'time'; ................................................................................ 394 407 measure = function(user) 395 408 local hot = self:effectiveStat 'irradiation' 396 409 local color = self:uiColor():lerp(lib.color(0.3, 1, 0), math.min(1, hot/5)) 397 410 local txt = string.format("%sGy", math.floor(hot)) 398 411 return (hot/5), txt, color 399 412 end; 400 413 } 414 + 415 + -- special-case the meters 416 + self.hud.bar.irradiation = self.hud.elt.geiger 417 + self.hud.bar.warmth = self.hud.elt.temp 418 + 401 419 self.hud.elt.crosshair = self:attachImage { 402 420 name = 'crosshair'; 403 421 tex = ''; 404 422 pos = {x=.5, y=.5}; 405 423 scale = {x=1,y=1}; 406 424 ofs = {x=0, y=0}; 407 425 align = {x=0, y=0}; ................................................................................ 424 442 ofs = {x=0, y=0}; 425 443 align = {x=0, y=-1}; 426 444 z = -1; 427 445 update = function(user, set) 428 446 set('text', hudAdjustBacklight(hudCenterBG):render()) 429 447 end; 430 448 }; 449 + self:updateHUD() 431 450 end; 432 451 deleteHUD = function(self) 433 452 for name, e in pairs(self.hud.elt) do 434 453 self:hud_delete(e.id) 435 454 end 436 455 end; 437 456 updateHUD = function(self) ................................................................................ 726 745 local suit = self:getSuit() 727 746 suit:establishInventories(self.entity) 728 747 729 748 if self:suitCharge() <= 0 then 730 749 self:suitPowerStateSet 'off' 731 750 end 732 751 end 733 - self:updateHUD() 752 +-- self:updateHUD() 753 + self.hud.elt.bat:update() 734 754 end; 735 755 reconfigureSuit = function(self) 736 756 -- and here's where things get ugly 737 757 -- you can't have an inventory inside another item. to hack around this, 738 758 -- we use the player as the location of the suit inventories, and whenever 739 759 -- there's a change in the content of these inventories, this function is 740 760 -- called to serialize those inventories out to the suit stack ................................................................................ 906 926 local fd = stack:take_item(n) 907 927 local stats = starlit.world.food.effectiveStats(fd) 908 928 909 929 return stack 910 930 end; 911 931 }; 912 932 } 933 + 934 +local clockInterval = 1.0 935 +starlit.startJob('starlit:clock', clockInterval, function(delta) 936 + for id, u in pairs(starlit.activeUsers) do 937 + u.hud.elt.time:update() 938 + end 939 +end) 913 940 914 941 local biointerval = 1.0 915 942 starlit.startJob('starlit:bio', biointerval, function(delta) 916 943 for id, u in pairs(starlit.activeUsers) do 917 944 if u:effectiveStat 'health' ~= 0 then 918 945 local bmr = u:phenoTrait 'metabolism' * biointerval 919 946 -- TODO apply modifiers ................................................................................ 942 969 local tempPenalty = tempDiff/3 943 970 moralePenalty = moralePenalty + tempPenalty 944 971 heatPenalty = heatPenalty + tempPenalty 945 972 end 946 973 947 974 -- penalize heavy phys. activity 948 975 local stamina, sp = u:effectiveStat 'stamina' 976 + local fatigue, fp = u:effectiveStat 'fatigue' 949 977 fatiguePenalty = fatiguePenalty * (1 + 9*(1-sp)) 978 + local penaltyFromFatigue = 1 - fp 950 979 951 980 local food = u:effectiveStat 'nutrition' 952 981 local water = u:effectiveStat 'hydration' 953 982 local rads = u:effectiveStat 'irradiation' 954 983 if food < 1000 then moralePenalty = moralePenalty + (1 - (food/1000)) * 5 end 955 984 if water < 1 then moralePenalty = moralePenalty + (1 - (water/1)) * 10 end 956 985 ................................................................................ 967 996 u:statDelta('health', -5*biointerval) 968 997 end 969 998 970 999 if water == 0 then -- dying of thirst 971 1000 u:statDelta('health', -20*biointerval) 972 1001 end 973 1002 974 - if sp < 1.0 then 975 - u:statDelta('stamina', u:phenoTrait('staminaRegen',1) / heatPenalty) 1003 + if sp < 1.0 and minetest.get_gametime() - u.cooldownTimes.stamina > 5.0 then 1004 + u:statDelta('stamina', (u:phenoTrait('staminaRegen',1) * penaltyFromFatigue) / heatPenalty) 976 1005 -- print('stam', u:effectiveStat 'stamina', u:phenoTrait('staminaRegen',1) / heatPenalty, heatPenalty) 977 1006 end 1007 + 1008 + local morale, mp = u:effectiveStat 'morale' 1009 + local pr = u:phenoTrait 'psiRegen' 1010 + u:statDelta('psi', pr * penaltyFromFatigue * mp) 978 1011 end 979 1012 end 980 1013 end) 981 1014 982 1015 local cbit = { 983 1016 up = 0x001; 984 1017 down = 0x002;