Comment: | we have always been at war with east minecraft |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4732f8d454ad0b335f1bea1bc365f82e |
User & Date: | lexi on 2025-01-19 19:18:55 |
Other Links: | manifest | tags |
2025-01-19
| ||
19:18 | we have always been at war with east minecraft Leaf check-in: 4732f8d454 user: lexi tags: trunk | |
19:05 | add to lore, add weather data, etc check-in: caec179da9 user: lexi tags: trunk | |
Modified mods/starlit-building/init.lua from [cc61bb3736] to [33f1e7300a].
7 7 --[[ { 8 8 part = { 9 9 ['starlit_building:pipe'] = 'myMod:stage3'; 10 10 }; 11 11 tool = { 12 12 ['starlit:screwdriver'] = 'myMod:otherThing_stage1'; 13 13 ['starlit:saw'] = function(node, tool) 14 - minetest.replace_node(node, {name='myMod:stage1'}) 15 - minetest.drop_item(node, 'starlit_building:pipe') 14 + core.replace_node(node, {name='myMod:stage1'}) 15 + core.drop_item(node, 'starlit_building:pipe') 16 16 end; 17 17 ['myMod:laserWrench'] = { 18 18 allow = function(node, tool) ... end; 19 19 handle = function(node, tool) ... end; 20 20 }; 21 21 }; 22 22 } ]] ................................................................................ 81 81 if e.fab then 82 82 scmID = string.format('%s_schematic', id) 83 83 rev = { 84 84 sw = scmID; 85 85 complexity = e.complexity or 1; 86 86 } 87 87 end 88 - minetest.register_craftitem(id, { 88 + core.register_craftitem(id, { 89 89 short_description = e.name; 90 90 description = starlit.ui.tooltip { 91 91 title = e.name; 92 92 desc = e.desc; 93 93 props = props; 94 94 }; 95 95 stack_max = e.max or (e.mass and math.min(math.max(math.floor(500 / e.mass), 1), 500)) or 10; 96 96 inventory_image = e.img; 97 97 on_place = function(stack, luser, point) 98 - local node = minetest.get_node(point.under) 98 + local node = core.get_node(point.under) 99 99 local function tryBuild() 100 100 local p = B.path[node.name] 101 101 if not p then return nil end 102 102 if (not p.part) or (not p.part[id]) then return nil end 103 103 local n = p.part[id] 104 104 local obj 105 105 if type(n) == 'function' then ................................................................................ 108 108 else 109 109 obj = ItemStack(n) 110 110 stack:take_item(1) 111 111 end 112 112 local pname = obj:get_name() 113 113 local stg = B.stage.db[pname] 114 114 node.name = pname 115 - minetest.swap_node(point.under, node) 115 + core.swap_node(point.under, node) 116 116 -- TODO make a noise 117 117 if stg.onBuild then 118 118 stg.onBuild(point.under, luser, stack) 119 119 end 120 120 return stack 121 121 end 122 122 ................................................................................ 125 125 if not p then return nil end 126 126 if type(p) == 'function' then 127 127 p = p(stack, node, point) 128 128 if p == nil then return nil end 129 129 else 130 130 stack:take_item(1) 131 131 end 132 - minetest.rotate_and_place(ItemStack(p), luser, point, true) 132 + core.rotate_and_place(ItemStack(p), luser, point, true) 133 133 -- TODO make a noise 134 134 return stack 135 135 end 136 136 137 137 return tryBuild() or tryBegin() or stack 138 138 end; 139 139 _starlit = { ................................................................................ 177 177 local grp = e.groups and table.copy(e.groups) or {} 178 178 grp.stage = 1 179 179 local meta = { 180 180 stage = id; 181 181 recover = e.recover; 182 182 } 183 183 for k,v in pairs(e.meta or {}) do meta[k] = v end 184 - minetest.register_node(id, { 184 + core.register_node(id, { 185 185 description = 'Construction'; 186 186 drawtype = (e.box and 'nodebox') 187 187 or (e.mesh and 'mesh') 188 188 or 'regular'; 189 189 paramtype = e.paramtype or (e.box or e.mesh or e.light) and 'light' or nil; 190 190 paramtype2 = e.paramtype2 or 'none'; 191 191 tiles = e.tex;
Modified mods/starlit-eco/init.lua from [f0d21c2132] to [c892dab0f5].
163 163 {-0.100, 'starlit:clear'}; 164 164 { 0.300, 'starlit:cloudy'}; 165 165 { 0.600, 'starlit:precip'}; 166 166 { 0.850, 'starlit:storm'}; 167 167 { 0.900, 'starlit:tstorm'}; 168 168 }; 169 169 }) 170 -minetest.register_craftitem('starlit_eco:fiber', { 170 +core.register_craftitem('starlit_eco:fiber', { 171 171 description = "Plant Fiber"; 172 172 groups = {fiber = 1}; 173 173 inventory_image = lib.image('starlit-eco-plant-fiber.png'):shift(lib.color(0,1,0)):render(); 174 174 _starlit = { 175 175 recover_vary = function(rng, ctx) 176 176 return starlit.type.fab { 177 177 element = { carbon = rng:int(0,1) };
Modified mods/starlit-eco/trees.lua from [d43bf4970e] to [6da5b86eb1].
39 39 base.groups.wood = 1 40 40 base.groups.log = 1 41 41 base.groups.falling_node = 1 42 42 43 43 local live = table.copy(base) 44 44 live.drop = id 45 45 live.groups.alive = 1 46 - minetest.register_node(id, base) 47 - minetest.register_node(id..'_live', live) 46 + core.register_node(id, base) 47 + core.register_node(id..'_live', live) 48 48 end 49 49 50 50 regLog('starlit_eco:lambent_pine_log', { 51 51 description = 'Lambent Pine Log'; 52 52 drawtype = 'normal'; 53 53 tiles = { 54 54 'starlit-eco-tree-lambent-pine-trunk-top.png'; ................................................................................ 71 71 72 72 starlit.item.seed.link('starlit_eco:lambent_pine_seed', { 73 73 name = 'Lambent Pine Seed'; 74 74 tex = lib.image('starlit-eco-plant-seeds.png'):shift{hue=150, sat=-.5, lum=.8}:render(); 75 75 grow = {kind = 'tree', id = 'starlit_eco:lambent_pine'}; 76 76 }) 77 77 78 -minetest.register_node('starlit_eco:lambent_pine_bulb', { 78 +core.register_node('starlit_eco:lambent_pine_bulb', { 79 79 description = 'Lambent Pine Bulb'; 80 80 drawtype = 'nodebox'; 81 81 connects_to = {'starlit_eco:lambent_pine_needles'}; 82 82 node_box = { 83 83 type = 'connected'; 84 84 connect_top = { 85 85 {-.1, .5, -.1, ................................................................................ 103 103 groups = {plant=1, attached_node = 4}; 104 104 tiles = { 105 105 'starlit-eco-tree-lambent-pine-bulb.png'; 106 106 }; 107 107 _starlit = woodProps{}; 108 108 }) 109 109 110 -minetest.register_node('starlit_eco:lambent_pine_needles', { 110 +core.register_node('starlit_eco:lambent_pine_needles', { 111 111 description = 'Lambent Pine Needles'; 112 112 groups = {plant = 1;}; 113 113 drop = ''; 114 114 tiles = { 115 115 'starlit-eco-tree-lambent-pine-needles.png'; 116 116 'starlit-eco-tree-lambent-pine-needles.png'; 117 117 }; ................................................................................ 124 124 tiles = { 125 125 'starlit-eco-tree-starblossom-trunk-top.png'; 126 126 'starlit-eco-tree-starblossom-trunk.png'; 127 127 }; 128 128 _starlit = woodProps{}; 129 129 }) 130 130 131 -minetest.register_node('starlit_eco:starblossom_leaves', { 131 +core.register_node('starlit_eco:starblossom_leaves', { 132 132 description = 'Starblossom Leaves'; 133 133 groups = {plant = 1;}; 134 134 drop = ''; 135 135 tiles = { 136 136 'starlit-eco-tree-starblossom-leaves.png'; 137 137 'starlit-eco-tree-starblossom-leaves.png'; 138 138 }; 139 139 _starlit = leafProps{}; 140 140 }); 141 -minetest.register_node('starlit_eco:starblossom_leaves_shine', { 141 +core.register_node('starlit_eco:starblossom_leaves_shine', { 142 142 description = 'Shining Starblossom Leaves'; 143 143 groups = {plant = 1;}; 144 144 drop = ''; 145 145 paramtype = 'light'; 146 146 light_source = 4; 147 147 tiles = { 148 148 'starlit-eco-tree-starblossom-leaves.png'; ................................................................................ 213 213 fill_ratio = 0.001; 214 214 y_min = 0, y_max = 512; 215 215 }; 216 216 }; 217 217 }; 218 218 } 219 219 220 -minetest.register_abm { 220 +core.register_abm { 221 221 label = "lambent pine fruiting"; 222 222 nodenames = {'starlit_eco:lambent_pine_needles'}; 223 223 neighbors = {'starlit_eco:lambent_pine_log_live'}; 224 224 chance = 40; 225 225 interval = 80; 226 226 catch_up = true; 227 227 action = function(pos, node) 228 228 local po = pos:offset(0,-1,0) 229 - if minetest.get_node(po).name == "air" then 230 - minetest.add_node(po, {name='starlit_eco:lambent_pine_bulb'}) 229 + if core.get_node(po).name == "air" then 230 + core.add_node(po, {name='starlit_eco:lambent_pine_bulb'}) 231 231 end 232 232 end; 233 233 }
Modified mods/starlit-electronics/init.lua from [668ccf7fa8] to [e24965a858].
118 118 return function(stack, ...) 119 119 local function fail() 120 120 error(string.format('object %q is not a %s', stack:get_name(), ty)) 121 121 end 122 122 123 123 if not stack or stack:is_empty() then fail() end 124 124 125 - if minetest.get_item_group(stack:get_name(), ty) == 0 then fail() end 125 + if core.get_item_group(stack:get_name(), ty) == 0 then fail() end 126 126 127 127 return fn(stack, 128 128 stack:get_definition()._starlit[ty], 129 129 stack:get_meta(), ...) 130 130 end 131 131 end 132 132 ................................................................................ 235 235 totalPower = E.battery.charge; 236 236 initialPower = E.battery.capacity; 237 237 dischargeRate = E.battery.dischargeRate; 238 238 wasteHeat = function() return 0 end; 239 239 }; 240 240 241 241 starlit.item.battery.foreach('starlit_electronics:battery-gen', {}, function(id, def) 242 - minetest.register_tool(id, { 242 + core.register_tool(id, { 243 243 short_description = def.name; 244 244 groups = { battery = 1; dynamo = 1; electronic = 1; }; 245 245 inventory_image = def.img or 'starlit-item-battery.png'; 246 246 description = starlit.ui.tooltip { 247 247 title = def.name; 248 248 desc = def.desc; 249 249 color = lib.color(0,.2,1); ................................................................................ 576 576 ----------- 577 577 -- chips -- 578 578 ----------- 579 579 580 580 E.sw = {} 581 581 function E.sw.findSchematicFor(item) 582 582 local id = ItemStack(item):get_name() 583 - local fm = minetest.registered_items[id]._starlit 583 + local fm = core.registered_items[id]._starlit 584 584 if not (fm and fm.reverseEngineer) then return nil end 585 585 local id = fm.reverseEngineer.sw 586 586 return id, starlit.item.sw.db[id] 587 587 end 588 588 589 589 E.chip = { file = {} } 590 590 do local T,G = lib.marshal.t, lib.marshal.g ................................................................................ 649 649 elseif file.kind == 'note' then 650 650 local sz = 0x10 + #file.body.author 651 651 for _, e in pairs(file.body.entries) do 652 652 sz = sz + #e.title + #e.body + 0x10 -- header overhead 653 653 end 654 654 return sz 655 655 elseif file.kind == 'research' then 656 - local re = assert(minetest.registered_items[file.body.itemId]._starlit.reverseEngineer) 656 + local re = assert(core.registered_items[file.body.itemId]._starlit.reverseEngineer) 657 657 return starlit.item.sw.db[re.sw].size * file.body.progress 658 658 elseif file.kind == 'sw' then 659 659 return starlit.item.sw.db[file.body.pgmId].size 660 660 elseif file.kind == 'genome' then 661 661 return 0 -- TODO 662 662 end 663 663 end ................................................................................ 805 805 end 806 806 807 807 function E.chip.update(chip) 808 808 chip:get_meta():set_string('description', E.chip.describe(chip)) 809 809 end 810 810 811 811 starlit.item.chip.foreach('starlit_electronics:chip-gen', {}, function(id, def) 812 - minetest.register_craftitem(id, { 812 + core.register_craftitem(id, { 813 813 short_description = def.name; 814 814 description = E.chip.describe(def, true); 815 815 inventory_image = def.img or 'starlit-item-chip.png'; 816 816 groups = {chip = 1}; 817 817 _starlit = { 818 818 fab = def.fab; 819 819 chip = def; ................................................................................ 833 833 compute = {name = 'Compute Chip', clockRate = 4e9, flash = 24e6, ram = 64e9, powerEfficiency = 1e9, size = 4}; 834 834 data = {name = 'Data Chip', clockRate = 128e3, flash = 2e12, ram = 32e3, powerEfficiency = 1e6, size = 4}; 835 835 lp = {name = 'Low-Power Chip', clockRate = 128e6, flash = 64e6, ram = 1e9, powerEfficiency = 1e11, size = 4}; 836 836 carbon = {name = 'Carbon Chip', clockRate = 64e6, flash = 32e6, ram = 2e6, powerEfficiency = 2e10, size = 2, circ='carbon'}; 837 837 } 838 838 839 839 E.chip.tiers.foreach('starlit_electronics:genChips', {}, function(id, t) 840 - id = t.id or string.format('%s:chip_%s', minetest.get_current_modname(), id) 840 + id = t.id or string.format('%s:chip_%s', core.get_current_modname(), id) 841 841 local circMat = t.circ or 'silicon'; 842 842 starlit.item.chip.link(id, { 843 843 name = t.name; 844 844 clockRate = t.clockRate; 845 845 flash = t.flash; 846 846 ram = t.ram; 847 847 powerEfficiency = t.powerEfficiency; -- cycles per joule ................................................................................ 938 938 pgm = {starlit.item.sw.db[pgm]} 939 939 end 940 940 sw = pgm 941 941 else 942 942 sw = {} 943 943 for i, e in ipairs(chips) do 944 944 if (not e:is_empty()) 945 - and minetest.get_item_group(e:get_name(), 'chip') ~= 0 945 + and core.get_item_group(e:get_name(), 'chip') ~= 0 946 946 then 947 947 for fl, inode in E.chip.files(e) do 948 948 if fl.kind == 'sw' then 949 949 local s = starlit.item.sw.db[fl.body.pgmId] 950 950 table.insert(sw, { 951 951 sw = s, chip = e, chipSlot = i; 952 952 file = fl, inode = inode;
Modified mods/starlit-electronics/sw.lua from [1c1e9dd876] to [922972e287].
32 32 return items, charges 33 33 end 34 34 35 35 return function(user, ctx) 36 36 local function cleanup() 37 37 user.action.prog.shred = nil 38 38 if user.action.sfx.shred then 39 - minetest.sound_fade(user.action.sfx.shred, 1, 0) 39 + core.sound_fade(user.action.sfx.shred, 1, 0) 40 40 user.action.sfx.shred = nil 41 41 end 42 42 if user.action.fx.shred then 43 43 user.action.fx.shred.abort() 44 44 end 45 45 end 46 46 ................................................................................ 50 50 cleanup() 51 51 return false 52 52 end 53 53 local shredTime = 1.0 54 54 local soundPitch = 1.0 -- TODO 55 55 local pdraw = prop.powerDraw or 0 56 56 57 - if minetest.is_protected(what, user.entity:get_player_name()) then return end 58 - local node = minetest.get_node(what) 59 - local nd = minetest.registered_nodes[node.name] 57 + if core.is_protected(what, user.entity:get_player_name()) then return end 58 + local node = core.get_node(what) 59 + local nd = core.registered_nodes[node.name] 60 60 local elt, fab, vary 61 61 if nd._starlit then 62 62 fab = nd._starlit.recover or nd._starlit.fab 63 63 vary = nd._starlit.recover_vary 64 64 end 65 65 if fab then 66 66 if fab.flag then ................................................................................ 86 86 if p < pdx then 87 87 cleanup() 88 88 return false 89 89 elseif not user.action.prog.shred then 90 90 cleanup() -- kill danglers 91 91 -- begin 92 92 user.action.prog.shred = 0 93 - user.action.sfx.shred = minetest.sound_play('starlit-nano-shred', { 93 + user.action.sfx.shred = core.sound_play('starlit-nano-shred', { 94 94 object = user.entity; 95 95 max_hear_distance = prop.range*2; 96 96 loop = true; 97 97 pitch = soundPitch; 98 98 }) 99 99 user.action.fx.shred = starlit.fx.nano.shred(user, what, prop, shredTime, node) 100 100 else 101 101 user.action.prog.shred = user.action.prog.shred + ctx.how.delta or 0 102 102 end 103 103 --print('shred progress: ', user.action.prog.shred) 104 104 if user.action.prog.shred >= shredTime then 105 - minetest.remove_node(what) 106 - minetest.check_for_falling(what) 105 + core.remove_node(what) 106 + core.check_for_falling(what) 107 107 --print('shred complete') 108 108 user:suitSound 'starlit-success' 109 109 if fab then 110 110 local vf = fab 111 111 if vary then 112 - local rng = (starlit.world.seedbank+0xa891f62)[minetest.hash_node_position(what)] 112 + local rng = (starlit.world.seedbank+0xa891f62)[core.hash_node_position(what)] 113 113 vf = vf + vary(rng, {}) 114 114 end 115 115 local items, charges = fabToItemsAndCharges(vf) 116 116 for i, it in ipairs(items) do user:give(it) end 117 117 -- TODO give gasses, liquids 118 118 end 119 119 cleanup() ................................................................................ 253 253 run = function(user, ctx) 254 254 end; 255 255 --[[ 256 256 bgProc = function(user, ctx, interval, runState) 257 257 if runState.flags.compiled == true then return false end 258 258 -- only so many nanides to go around 259 259 runState.flags.compiled = true 260 - local time = minetest.get_gametime() 260 + local time = core.get_gametime() 261 261 local cyclesLeft = ctx.comp.cycles * interval 262 262 263 263 for id, e in ipairs(ctx.file.body.conf) do 264 264 if e.key == 'job' then 265 265 local t = J.dec(e.value) 266 266 local remove = false 267 267 local r = starlit.item.sw.db[t.schematic]
Modified mods/starlit-material/init.lua from [158d4b1720] to [3f132c9f77].
1 1 local lib = starlit.mod.lib 2 2 local M = { 3 3 canisterSizes = lib.registry.mk 'starlit_material:canister-size'; 4 4 } 5 5 M.canisterSizes.foreach('starlit_material:canister_link', {}, function(id, sz) 6 - starlit.item.canister.link(minetest.get_current_modname() .. ':canister_' .. id, { 6 + starlit.item.canister.link(core.get_current_modname() .. ':canister_' .. id, { 7 7 name = sz.name; 8 8 slots = sz.slots; 9 9 vol = sz.vol; -- too big for suit? 10 10 desc = sz.desc; 11 11 }) 12 12 end) 13 13 M.canisterSizes.meld {
Modified mods/starlit-tech/init.lua from [91056054d4] to [9e988e1fe2].
14 14 local grp = { 15 15 object = 1; 16 16 attached_node = 1; 17 17 } 18 18 if def.group then 19 19 for k,v in pairs(def.group((i/stages))) do grp[k]=v end 20 20 end 21 - minetest.register_node(stID(i), { 21 + core.register_node(stID(i), { 22 22 short_description = def.name; 23 23 description = starlit.ui.tooltip { 24 24 title = def.name; 25 25 desc = def.desc; 26 26 color = def.color; 27 27 props = { 28 28 {title = 'Burn Remaining', desc=lib.math.timespec(stageTimeout * i), affinity=i > (stages/2) and 'good' or 'bad'}; ................................................................................ 40 40 }; 41 41 tiles = def.tile((i/stages)); 42 42 paramtype = 'light'; 43 43 paramtype2 = 'wallmounted'; 44 44 wallmounted_rotate_vertical = true; 45 45 light_source = math.floor(lib.math.lerp(i/stages, 0, def.glow)); 46 46 on_construct = i ~= 0 and function(pos) 47 - local t = minetest.get_node_timer(pos) 47 + local t = core.get_node_timer(pos) 48 48 t:start(stageTimeout) 49 49 if def.ctor then def.ctor(pos, (i/stages)) end 50 50 end or nil; 51 51 on_destruct = def.dtor and function(pos) 52 52 def.dtor(pos, (i/stages)) 53 53 end or nil; 54 54 on_timer = i ~= 0 and function(pos) 55 - local me = minetest.get_node(pos) 56 - minetest.swap_node(pos, {name=stID(i-1), param2=me.param2}) 55 + local me = core.get_node(pos) 56 + core.swap_node(pos, {name=stID(i-1), param2=me.param2}) 57 57 return i > 1 58 58 end or nil; 59 59 _starlit = (function() 60 60 local meta = { 61 61 mass = def.mass; 62 62 reverseEngineer = { 63 63 complexity = 1; ................................................................................ 154 154 radiate = function(rp, pos) 155 155 return 15 * f 156 156 end; 157 157 }; 158 158 } end; 159 159 } 160 160 161 -minetest.register_node('starlit_tech:crate', { 161 +core.register_node('starlit_tech:crate', { 162 162 short_description = 'Crate'; 163 163 description = starlit.ui.tooltip { 164 164 title = 'Crate'; 165 165 desc = 'A sturdy but lightweight aluminum storage crate.'; 166 166 props = { {title='Mass', affinity='info', desc='100g'} }; 167 167 }; 168 168 drawtype = 'nodebox'; ................................................................................ 199 199 time = { 200 200 shred = 1; 201 201 shredPower = 3; 202 202 }; 203 203 }; 204 204 }; 205 205 on_construct = function(pos) 206 - local m = minetest.get_meta(pos) 206 + local m = core.get_meta(pos) 207 207 local inv = m:get_inventory() 208 208 inv:set_size('starlit:contents', 12) 209 209 end; 210 210 on_rightclick = function(pos, node, luser) 211 211 if not luser then return end 212 212 local user = starlit.activeUsers[luser:get_player_name()] 213 213 user:openUI('starlit:box', 'index', {
Modified mods/starlit/effect.lua from [9a580a99bf] to [ee92b6e11c].
103 103 elseif d.pos then -- find effects anchored here and people in range 104 104 for id,effect in pairs(starlit.effect.active) do 105 105 if not effect.anchor then goto skip end -- this intentionally excludes attached effects 106 106 if ineffectrange(effect,d.pos,d.range) then 107 107 effects[#effects+1] = {v=effect,i=id} 108 108 end 109 109 ::skip::end 110 - local ppl = minetest.get_objects_inside_radius(d.pos,d.range) 110 + local ppl = core.get_objects_inside_radius(d.pos,d.range) 111 111 if #targets == 0 then targets = ppl else 112 112 for _,p in pairs(ppl) do targets[#targets+1] = p end 113 113 end 114 114 end 115 115 116 116 -- iterate over targets to remove from any effect's influence 117 117 for _,t in pairs(targets) do ................................................................................ 137 137 if v == effect then starlit.effect.active[k] = nil break end 138 138 end 139 139 end 140 140 end 141 141 end 142 142 143 143 starlit.effect.ensorcelled = function(player,effect) 144 - if type(player) == 'string' then player = minetest.get_player_by_name(player) end 144 + if type(player) == 'string' then player = core.get_player_by_name(player) end 145 145 for _,s in pairs(starlit.effect.active) do 146 146 if effect and (s.name ~= effect) then goto skip end 147 147 for _,sub in pairs(s.subjects) do 148 148 if sub.player == player then return s end 149 149 end 150 150 ::skip::end 151 151 return false ................................................................................ 163 163 end 164 164 end 165 165 until idx >= #starlit.effect.active 166 166 end 167 167 end 168 168 169 169 -- when a new effect is created, we analyze it and make the appropriate calls 170 --- to minetest.after to queue up the events. each job returned needs to be 170 +-- to core.after to queue up the events. each job returned needs to be 171 171 -- saved in 'jobs' so they can be canceled if the effect is disjoined. no polling 172 172 -- necessary :D 173 173 174 174 starlit.effect.cast = function(proto) 175 175 local s = table.copy(proto) 176 176 s.jobs = s.jobs or {} s.vfx = s.vfx or {} s.sfx = s.sfx or {} 177 177 s.impacts = s.impacts or {} s.subjects = s.subjects or {} 178 178 s.delay = s.delay or 0 179 179 s.visual = function(subj, def) 180 180 s.vfx[#s.vfx + 1] = { 181 - handle = minetest.add_particlespawner(def); 181 + handle = core.add_particlespawner(def); 182 182 subject = subj; 183 183 } 184 184 end 185 185 s.visual_caster = function(def) -- convenience function 186 186 local d = table.copy(def) 187 187 d.attached = s.caster 188 188 s.visual(nil, d) ................................................................................ 206 206 s.impacts[#s.impacts+1] = rec 207 207 etbl[#etbl+1] = rec 208 208 end 209 209 return etbl 210 210 end 211 211 s.abort = function() 212 212 for _,j in ipairs(s.jobs) do j:cancel() end 213 - for _,v in ipairs(s.vfx) do minetest.delete_particlespawner(v.handle) end 213 + for _,v in ipairs(s.vfx) do core.delete_particlespawner(v.handle) end 214 214 for _,i in ipairs(s.sfx) do s.silence(i) end 215 215 for _,i in ipairs(s.impacts) do i.effect:stop() end 216 216 end 217 217 s.release_subject = function(si) 218 218 local t = s.subjects[si] 219 219 for _,f in pairs(s.sfx) do if f.subject == t then s.silence(f) end end 220 220 for _,f in pairs(s.impacts) do if f.subject == t then f.effect:stop() end end 221 221 for _,f in pairs(s.vfx) do 222 - if f.subject == t then minetest.delete_particlespawner(f.handle) end 222 + if f.subject == t then core.delete_particlespawner(f.handle) end 223 223 end 224 224 s.subjects[si] = nil 225 225 end 226 226 local interpret_timespec = function(when) 227 227 if when == nil then return 0 end 228 228 local t if type(when) == 'number' then 229 229 t = s.duration * when ................................................................................ 232 232 end 233 233 if t then return math.min(s.duration,math.max(0,t)) end 234 234 235 235 log.err('invalid timespec ' .. dump(when)) 236 236 return 0 237 237 end 238 238 s.queue = function(when,fn) 239 - local elapsed = s.starttime and minetest.get_server_uptime() - s.starttime or 0 239 + local elapsed = s.starttime and core.get_server_uptime() - s.starttime or 0 240 240 local timepast = interpret_timespec(when) 241 241 if not timepast then timepast = 0 end 242 242 local timeleft = s.duration - timepast 243 243 local howlong = (s.delay + timepast) - elapsed 244 244 if howlong < 0 then 245 245 log.err('cannot time-travel! queue() called with `when` specifying timepoint that has already passed') 246 246 howlong = 0 247 247 end 248 - s.jobs[#s.jobs+1] = minetest.after(howlong, function() 248 + s.jobs[#s.jobs+1] = core.after(howlong, function() 249 249 -- this is somewhat awkward. since we're using a non-polling approach, we 250 250 -- need to find a way to account for a caster or subject walking into an 251 251 -- existing antimagic field, or someone with an existing antimagic aura 252 252 -- walking into range of the anchor. so every time a effect effect would 253 253 -- take place, we first check to see if it's in range of something nasty 254 254 if not s.disjunction and -- avoid self-disjunction 255 255 ((s.caster and starlit.effect.probe(s.caster:get_pos()).disjunction) or ................................................................................ 286 286 for _,sub in pairs(s.subjects) do addobj(sub.player,sub) end 287 287 elseif spec.where == 'pos' then specs[#specs+1] = { spec = {pos = s.anchor} } 288 288 else specs[#specs+1] = { spec = {pos = spec.where} } end 289 289 290 290 for _,sp in pairs(specs) do 291 291 sp.spec.gain = sp.spec.gain or spec.gain 292 292 local so = { 293 - handle = minetest.sound_play(spec.sound, sp.spec, spec.ephemeral); 293 + handle = core.sound_play(spec.sound, sp.spec, spec.ephemeral); 294 294 ctl = spec; 295 295 -- object = sp.obj; 296 296 subject = sp.subject; 297 297 } 298 298 stbl[#stbl+1] = so 299 299 s.sfx[#s.sfx+1] = so 300 300 end ................................................................................ 308 308 for _,snd in pairs(snds) do s.silence(snd) end 309 309 end) 310 310 end 311 311 end) 312 312 end 313 313 s.silence = function(sound) 314 314 if not sound.handle then return end 315 - if sound.ctl.fade == 0 then minetest.sound_stop(sound.handle) 316 - else minetest.sound_fade(sound.handle,sound.ctl.fade or 1,0) end 315 + if sound.ctl.fade == 0 then core.sound_stop(sound.handle) 316 + else core.sound_fade(sound.handle,sound.ctl.fade or 1,0) end 317 317 end 318 318 local startqueued, termqueued = false, false 319 319 local myid = #starlit.effect.active+1 320 320 s.cancel = function() 321 321 s.abort() 322 322 starlit.effect.active[myid] = nil 323 323 end ................................................................................ 365 365 iteration = iteration; 366 366 iterationcount = itercount; 367 367 timeleft = timeleft; 368 368 timeelapsed = s.duration - timeleft; 369 369 lastreturn = lastreturn; 370 370 } 371 371 if nr ~= false and iteration < itercount then 372 - s.jobs[#s.jobs+1] = minetest.after(int.period, 372 + s.jobs[#s.jobs+1] = core.after(int.period, 373 373 function() iterate(nr) end) 374 374 end 375 375 end 376 376 if int.after 377 377 then s.queue(int.after, iterate) 378 378 else s.queue({whence=0, secs=s.period}, iterate) 379 379 end ................................................................................ 385 385 end 386 386 end 387 387 if s.sounds then 388 388 for when,what in pairs(s.sounds) do s.play(when,what) end 389 389 end 390 390 starlit.effect.active[myid] = s 391 391 if not termqueued then 392 - s.jobs[#s.jobs+1] = minetest.after(s.delay + s.duration, function() 392 + s.jobs[#s.jobs+1] = core.after(s.delay + s.duration, function() 393 393 if s.terminate then s:terminate() end 394 394 starlit.effect.active[myid] = nil 395 395 end) 396 396 end 397 - s.starttime = minetest.get_server_uptime() 397 + s.starttime = core.get_server_uptime() 398 398 return s 399 399 end 400 400 401 -minetest.register_on_dieplayer(function(player) 401 +core.register_on_dieplayer(function(player) 402 402 starlit.effect.disjoin{target=player} 403 403 end)
Modified mods/starlit/element.lua from [f0333e36f4] to [79d7647b1a].
54 54 indsz, indsz, 55 55 indsz, indsz, 56 56 indicator); 57 57 end 58 58 end 59 59 60 60 M.element.foreach('starlit:gen-forms', {}, function(id, m) 61 - local eltID = F('%s:element_%s', minetest.get_current_modname(), id) 61 + local eltID = F('%s:element_%s', core.get_current_modname(), id) 62 62 -- local eltName = F('Elemental %s', lib.str.capitalize(m.name)) 63 63 local tt = function(t, d, g) 64 64 return starlit.ui.tooltip { 65 65 title = t, desc = d; 66 66 color = lib.color(0.1,0.2,0.1); 67 67 props = { 68 68 {title = 'Mass', desc = lib.math.si('g', g), affinity='info'} ................................................................................ 78 78 m.form = m.form or {} 79 79 80 80 81 81 if not (m.gas or m.liquid) then 82 82 local brickID = eltID .. '_brick' 83 83 local brickName = F('%s Brick', lib.str.capitalize(m.name)) 84 84 m.form.brick = brickID 85 - minetest.register_craftitem(brickID, { 85 + core.register_craftitem(brickID, { 86 86 short_description = brickName; 87 87 description = tt(brickName, F('A small brick of %s, ready to be worked by a matter compiler', m.name), 1); 88 88 inventory_image = img(lib.image 'starlit-item-brick.png'); 89 89 wield_image = lib.image 'starlit-item-brick.png':colorize(m.color):render(); 90 90 stack_max = 500; 91 91 groups = {element=1, brick=1}; 92 92 _starlit = { ................................................................................ 101 101 }; 102 102 }; 103 103 }); 104 104 end 105 105 106 106 --[[ 107 107 local chunk = F('starlit-element-%s-powder.png', id); 108 - minetest.register_craftitem(eltID, { 108 + core.register_craftitem(eltID, { 109 109 short_description = eltName; 110 110 description = tt(eltName, F('A 1g chunk of elemental %s, ready to be worked by a cold matter compiler', m.name), 1); 111 111 inventory_image = iblit(chunk); 112 112 wield_image = powder; 113 113 stack_max = 1000; -- 1kg 114 114 groups = {element = 1, chunk = 1}; 115 115 _starlit = { ................................................................................ 127 127 end) 128 128 129 129 130 130 M.metal.foreach('starlit:gen-forms', {}, function(id, m) 131 131 if m.elemental then -- avoid multiple forms for same material 132 132 m.form = M.element.db[m.elemental].form; 133 133 else 134 - local baseID = F('%s:metal_%s_', minetest.get_current_modname(), id) 134 + local baseID = F('%s:metal_%s_', core.get_current_modname(), id) 135 135 local brickID = baseID .. 'brick' 136 136 local brickName = F('%s Brick', lib.str.capitalize(m.name)) 137 137 m.form = m.form or {} 138 138 m.form.brick = brickID 139 139 local tt = function(t, d, g) 140 140 return starlit.ui.tooltip { 141 141 title = t, desc = d; ................................................................................ 155 155 end 156 156 local iblit = mkEltIndicator(mcomp) 157 157 local function img(s) 158 158 return iblit(s:colorize(m.color):render()) 159 159 end 160 160 161 161 local mass = 1 162 - minetest.register_craftitem(brickID, { 162 + core.register_craftitem(brickID, { 163 163 short_description = brickName; 164 164 description = tt(brickName, F('A small brick of %s, ready to be worked by a matter compiler', m.name), mass); 165 165 inventory_image = img(lib.image('starlit-item-brick.png')); 166 166 wield_image = lib.image 'starlit-item-brick.png':colorize(m.color):render(); 167 167 groups = {metal = 1, brick = 1}; 168 168 stack_max = 500; 169 169 _starlit = { ................................................................................ 226 226 color = lib.color(0.2,0.1,0.1); 227 227 props = props; 228 228 }; 229 229 end 230 230 231 231 starlit.item.canister = lib.registry.mk 'starlit:canister'; 232 232 starlit.item.canister.foreach('starlit:item-gen', {}, function(id, c) 233 - minetest.register_craftitem(id, { 233 + core.register_craftitem(id, { 234 234 short_description = c.name; 235 235 description = canisterDesc(nil, c); 236 236 inventory_image = c.image or 'starlit-item-element-canister.png'; 237 237 groups = {canister = 1}; 238 238 stack_max = 1; 239 239 _starlit = { 240 240 canister = c;
Modified mods/starlit/fab.lua from [06631e46d8] to [7c2e295411].
139 139 }; 140 140 -- crystal = { 141 141 -- op = fQuant; 142 142 -- }; 143 143 item = { 144 144 name = {"item", "items"}; 145 145 string = function(x, n) 146 - local i = minetest.registered_items[x] 146 + local i = core.registered_items[x] 147 147 return tostring(n) .. 'x ' .. i.short_description 148 148 end; 149 149 image = function(x, n) 150 150 return ItemStack(x):get_definition().inventory_image 151 151 end; 152 152 inventory = function(x, n, stack) 153 153 x = ItemStack(x)
Modified mods/starlit/food.lua from [c58f501acb] to [09c96accb0].
33 33 desc = f.desc; 34 34 props = props; 35 35 color = f.color; 36 36 }; 37 37 end 38 38 39 39 F.foreach('starlit:gen-food', {}, function(id, f) 40 - minetest.register_item(id, { 40 + core.register_item(id, { 41 41 type = f.itemType or 'none'; 42 42 inventory_image = f.tex; 43 43 short_description = f.name; 44 44 description = foodTip(nil, f); 45 45 on_use = function(st, luser) 46 46 local user = starlit.activeUsers[luser:get_player_name()] 47 47 st:take_item(1) ................................................................................ 55 55 recover = f.recover; 56 56 mass = f.mass; 57 57 }; 58 58 }) 59 59 end) 60 60 61 61 starlit.item.seed.foreach('starlit:gen-seed', {}, function(id, s) 62 - minetest.register_item(id, { 62 + core.register_item(id, { 63 63 type = 'none'; 64 64 inventory_image = s.tex; 65 65 short_description = s.name; 66 66 description = starlit.ui.tooltip { 67 67 title = s.name; 68 68 color = s.color; 69 69 desc = s.desc;
Modified mods/starlit/init.lua from [277b90dbc5] to [ae90c8058c].
1 1 -- [ʞ] starlit/init.lua 2 2 -- ~ lexi hale <lexi@hale.su> 3 3 -- ? basic setup, game rules, terrain 4 4 -- © EUPL v1.2 5 5 6 -local T = minetest.get_translator 'starlit' 6 +local T = core.get_translator 'starlit' 7 7 8 8 -- TODO enforce latest engine version 9 9 10 10 local mod = { 11 11 -- subordinate mods register here 12 12 lib = vtlib; 13 13 -- vtlib should be accessed as starlit.mod.lib by starlit modules for the sake of proper encapsulation. vtlib should simply be a provider, not a hardcoded dependency 14 14 } 15 15 local lib = mod.lib 16 16 17 17 18 18 starlit = { 19 - ident = minetest.get_current_modname(); 19 + ident = core.get_current_modname(); 20 20 mod = mod; 21 21 translator = T; 22 22 23 23 constant = { 24 - light = { --minetest units 24 + light = { --luanti units 25 25 dim = 3; 26 26 lamp = 7; 27 27 bright = 10; 28 28 brightest = 14; -- only sun and growlights 29 29 }; 30 30 heat = { -- celsius 31 31 freezing = 0; ................................................................................ 35 35 thermalConductivity = 0.05; -- κ 36 36 }; 37 37 rad = { 38 38 }; 39 39 40 40 phys = { 41 41 --- HACK HACK HAAAAAAAAAAACK 42 - engineGravity = minetest.settings:get('movement_gravity') or 9.81 42 + engineGravity = core.settings:get('movement_gravity') or 9.81 43 43 }; 44 44 }; 45 45 46 46 activeUsers = { 47 47 -- map of username -> user object 48 48 }; 49 49 activeUI = { ................................................................................ 71 71 72 72 -- standardized effects 73 73 fx = {}; 74 74 75 75 type = {}; 76 76 world = { 77 77 defaultScenario = 'starlit_scenario:imperialExpat'; 78 - seedbank = lib.math.seedbank(minetest.get_mapgen_setting 'seed'); 78 + seedbank = lib.math.seedbank(core.get_mapgen_setting 'seed'); 79 79 mineral = lib.registry.mk 'starlit:mineral'; 80 80 material = { -- raw materials 81 81 element = lib.registry.mk 'starlit:element'; 82 82 -- elements are automatically sorted into the following categories 83 83 -- if they match. however, it's possible to have a metal/gas/liquid 84 84 -- that *isn't* a pure element, so these need separate registries 85 85 -- for alloys and mixtures like steel and water ................................................................................ 177 177 }; 178 178 179 179 jobs = {}; 180 180 } 181 181 182 182 -- TODO deal with core.DEFAULT_PHYSICS once it hits master 183 183 184 -starlit.cfgDir = minetest.get_worldpath() .. '/' .. starlit.ident 184 +starlit.cfgDir = core.get_worldpath() .. '/' .. starlit.ident 185 185 186 186 local logger = function(module) 187 187 local function argjoin(arg, nxt, ...) 188 188 if arg and not nxt then return tostring(arg) end 189 189 if not arg then return "(nil)" end 190 190 return tostring(arg) .. ' ' .. argjoin(nxt, ...) 191 191 end 192 192 local lg = {} 193 193 local setup = function(fn, lvl) 194 194 lvl = lvl or fn 195 195 local function emit(...) 196 196 local call = (fn == 'fatal') and error 197 - or function(str) minetest.log(lvl, str) end 197 + or function(str) core.log(lvl, str) end 198 198 if module 199 199 then call(string.format('[%s :: %s] %s',starlit.ident,module,argjoin(...))) 200 200 else call(string.format('[%s] %s',starlit.ident,argjoin(...))) 201 201 end 202 202 end 203 203 lg[fn ] = function(...) emit(...) end 204 204 lg[fn .. 'f'] = function(...) emit(string.format(...)) end -- convenience fn ................................................................................ 212 212 end 213 213 214 214 starlit.logger = logger 215 215 216 216 local log = logger() 217 217 218 218 function starlit.evaluate(name, ...) 219 - local path = minetest.get_modpath(minetest.get_current_modname()) 219 + local path = core.get_modpath(core.get_current_modname()) 220 220 local filename = string.format('%s/%s', path, name) 221 221 log.info('loading', filename) 222 222 local chunk, err = loadfile(filename, filename) 223 223 if not chunk then error(err) end 224 224 return chunk(...) 225 225 end 226 226 227 227 function starlit.include(name, ...) -- semantic variant used for loading modules 228 228 return starlit.evaluate(name..'.lua', ...) 229 229 end 230 230 231 231 function starlit.region.radiator.scan(pos,node) 232 232 local R = starlit.region 233 - local phash = minetest.hash_node_position(pos) 233 + local phash = core.hash_node_position(pos) 234 234 if R.radiator.sources[phash] then return end -- already loaded 235 - node = node or minetest.get_node(pos) 235 + node = node or core.get_node(pos) 236 236 237 - local def = minetest.registered_nodes[node.name] 237 + local def = core.registered_nodes[node.name] 238 238 local cl = def._starlit and def._starlit.radiator 239 239 if not cl then return nil end 240 240 local min,max = cl.maxEffectArea and cl.maxEffectArea(pos) or nil 241 241 if not min then 242 242 assert(cl.radius, 'no radius callback for radiator') 243 243 local r = cl.radius(pos) 244 244 local vr = vector.new(r,r,r) 245 245 min,max = pos-vr, pos+vr 246 246 end 247 - local id = R.radiator.store:insert_area(min,max, minetest.pos_to_string(pos)) 247 + local id = R.radiator.store:insert_area(min,max, core.pos_to_string(pos)) 248 248 R.radiator.sources[phash] = id 249 249 end 250 250 251 251 function starlit.region.radiator.unload(pos) 252 252 local R = starlit.region 253 - local phash = minetest.hash_node_position(pos) 253 + local phash = core.hash_node_position(pos) 254 254 local id = R.radiator.sources[phash] 255 255 R.radiator.store:remove_area(id) 256 256 R.radiator.sources[phash] = nil 257 257 end 258 258 259 -minetest.register_lbm { 259 +core.register_lbm { 260 260 label = 'build radiator index'; 261 261 name = 'starlit:loadradiatorboxes'; 262 262 nodenames = {'group:radiator'}; 263 263 run_at_every_load = true; 264 264 action = function(pos, node, dt) 265 265 starlit.region.radiator.scan(pos, node) 266 266 end; ................................................................................ 267 267 -- NOTE: temp emitter nodes are responsible for decaching themselves in their on_destruct cb 268 268 } 269 269 270 270 271 271 function starlit.startJob(id, interval, job) 272 272 local lastRun 273 273 local function start() 274 - starlit.jobs[id] = minetest.after(interval, function() 275 - local t = minetest.get_gametime() 274 + starlit.jobs[id] = core.after(interval, function() 275 + local t = core.get_gametime() 276 276 local d = lastRun and t - lastRun or nil 277 277 lastRun = t 278 278 local continue = job(d, interval) 279 279 if continue == true or continue == nil then 280 280 start() 281 281 elseif continue ~= false then 282 282 interval = continue ................................................................................ 307 307 starlit.include 'element' 308 308 309 309 starlit.include 'terrain' 310 310 starlit.include 'interfaces' 311 311 starlit.include 'compile' 312 312 starlit.include 'suit' 313 313 314 --- minetest.settings:set('movement_gravity', starlit.world.planet.gravity) -- ??? seriously??? 314 +-- core.settings:set('movement_gravity', starlit.world.planet.gravity) -- ??? seriously??? 315 315 -- THIS OVERRIDES THE GLOBAL SETTING *AND PERSISTS IT* WHAT IN THE SATANIC FUCK 316 316 317 317 --------------- 318 318 -- callbacks -- 319 319 --------------- 320 --- here we connect our types up to the minetest API 320 +-- here we connect our types up to the luanti API 321 321 322 322 local function userCB(fn) 323 323 return function(luser, ...) 324 324 local name = luser:get_player_name() 325 325 local user = starlit.activeUsers[name] 326 326 return fn(user, ...) 327 327 end 328 328 end 329 329 330 -minetest.register_on_joinplayer(function(luser, lastLogin) 330 +core.register_on_joinplayer(function(luser, lastLogin) 331 331 -- TODO check that necessary CSMs are installed 332 332 local user = starlit.type.user(luser) 333 333 334 334 if lastLogin == nil then 335 335 user:onSignup() 336 336 end 337 337 user:onJoin() 338 338 339 339 starlit.activeUsers[user.name] = user 340 340 end) 341 341 342 -minetest.register_on_leaveplayer(function(luser) 342 +core.register_on_leaveplayer(function(luser) 343 343 starlit.activeUsers[luser:get_player_name()]:onPart() 344 344 end) 345 345 346 -minetest.register_on_player_receive_fields(function(luser, formid, fields) 346 +core.register_on_player_receive_fields(function(luser, formid, fields) 347 347 local name = luser:get_player_name() 348 348 local user = starlit.activeUsers[name] 349 349 if not user then return false end 350 350 if formid == '' then -- main menu 351 351 return starlit.ui.userMenuDispatch(user,fields) 352 352 end 353 353 local ui = starlit.interface.db[formid] ................................................................................ 362 362 user:onRespond(ui, state, fields) 363 363 if fields.quit then 364 364 starlit.activeUI[name] = nil 365 365 end 366 366 return true 367 367 end) 368 368 369 -minetest.register_on_respawnplayer(userCB(function(user) 369 +core.register_on_respawnplayer(userCB(function(user) 370 370 return user:onRespawn() 371 371 end)) 372 372 373 -minetest.register_on_dieplayer(userCB(function(user, reason) 373 +core.register_on_dieplayer(userCB(function(user, reason) 374 374 return user:onDie(reason) 375 375 end)) 376 376 377 -minetest.register_on_punchnode(function(pos,node,puncher,point) 377 +core.register_on_punchnode(function(pos,node,puncher,point) 378 378 local user = starlit.activeUsers[puncher:get_player_name()] 379 379 local oldTgt = user.action.tgt 380 380 user.action.tgt = point 381 381 if bit.band(user.action.bits, 0x80)==0 then 382 382 user.action.bits = bit.bor(user.action.bits, 0x80) 383 383 --user:trigger('primary', {state = 'init'}) 384 384 else ................................................................................ 403 403 user:trigger('retarget', {oldTgt = oldTgt}) 404 404 end 405 405 end 406 406 -- sigh 407 407 --[[ 408 408 core.noneitemdef_default.on_place = function(...) 409 409 if not triggerPower(...) then 410 - minetest.item_place(...) 410 + core.item_place(...) 411 411 end 412 412 end 413 413 core.noneitemdef_default.on_use = function(...) triggerPower(...) end 414 414 core.noneitemdef_default.on_secondary_use = function(...) triggerPower(...) end 415 415 ]] 416 -minetest.register_item(":", { 416 +core.register_item(":", { 417 417 type = "none", 418 418 wield_image = "wieldhand.png", 419 419 wield_scale = {x=1,y=1,z=2.5}, 420 420 on_secondary_use = function(...) triggerPower(...) end; 421 421 -- on_use = function(...) print'base' end; 422 422 after_use = function(i,u,n,p) 423 423 if (u:is_player()) then triggerPower(i,u,p) end 424 424 end; 425 425 }) 426 -minetest.register_item("starlit:_hand_dig", { 426 +core.register_item("starlit:_hand_dig", { 427 427 type = "none", 428 428 wield_image = "wieldhand.png", 429 429 wield_scale = {x=1,y=1,z=2.5}, 430 430 tool_capabilities = { 431 431 groupcaps = { 432 432 object = {maxlevel=1, times = {.10,.20,.40}}; 433 433 plant = {maxlevel=1, times = {.50}}; ................................................................................ 434 434 435 435 -- sand, dirt, gravel 436 436 looseClump = {maxlevel=1, times = {1.5, 2.5}}; 437 437 }; 438 438 } 439 439 }) 440 440 441 -minetest.register_on_player_inventory_action(function(luser, act, inv, p) 441 +core.register_on_player_inventory_action(function(luser, act, inv, p) 442 442 local name = luser:get_player_name() 443 443 local user = starlit.activeUsers[name] 444 444 -- allow UIs to update on UI changes 445 445 local state = starlit.activeUI[name] 446 446 if state then 447 447 local ui = starlit.interface.db[state.form] 448 448 ui:cb('onMoveItem', user, act, inv, p) 449 449 end 450 450 end) 451 451 452 -minetest.register_on_player_hpchange(function(luser, delta, cause) 452 +core.register_on_player_hpchange(function(luser, delta, cause) 453 453 local user = starlit.activeUsers[luser:get_player_name()] 454 454 if cause.type == 'fall' then 455 455 delta = user:damageModifier('bluntForceTrauma', (delta * 50)) 456 456 -- justification: a short fall can do around 457 457 -- five points of damage, which is nearly 50% 458 458 -- of the default hp_max. since we crank up 459 459 -- hp by a factor of 50~40, damage should be 460 460 -- cranked by similarly 461 461 end 462 462 return delta 463 463 end, true) 464 464 465 -function minetest.handle_node_drops(pos, drops, digger) 465 +function core.handle_node_drops(pos, drops, digger) 466 466 local function jitter(pos) 467 467 local function r(x) return x+math.random(-0.01, 0.01) end 468 468 return vector.new( 469 469 r(pos.x), 470 470 r(pos.y), 471 471 r(pos.z) 472 472 ) 473 473 end 474 474 for i, it in ipairs(drops) do 475 475 if type(it) == 'string' then it = ItemStack(it) end 476 476 if not it:is_empty() then 477 - local ent = minetest.add_item(jitter(pos), it) 477 + local ent = core.add_item(jitter(pos), it) 478 478 if ent ~= nil then -- avoid crash when dropping unknown item 479 479 local dp = vector.new(0,0,0) 480 480 if digger then dp = digger:get_pos() end 481 481 local delta = dp - ent:get_pos() 482 482 ent:add_velocity(vector.new(delta.x,0,delta.z)); 483 483 end 484 484 end 485 485 end 486 486 end 487 487 488 488 489 489 -- TODO timer iterates live UI 490 490
Modified mods/starlit/interfaces.lua from [42263b381c] to [7199aa7738].
565 565 if q.quit then 566 566 user:suitSound 'starlit-quit' -- TODO better sound 567 567 end 568 568 end; 569 569 render = function(state, user) 570 570 local body = {kind='vert', w=6; mode='hw', spacing=.5, padding=1 } 571 571 for i, l in ipairs(state.ctx.inv) do 572 - local inv = minetest.get_meta(l.pos):get_inventory() 572 + local inv = core.get_meta(l.pos):get_inventory() 573 573 local w = l.w or 6 574 574 if l.label then 575 575 table.insert(body, {kind = 'hbar'; text = l.label, w=w+.5, h = .5}) 576 576 end 577 577 table.insert(body, {kind = 'list'; 578 578 w = w, h = inv:get_size(l.id)/w; 579 579 node = l.pos, inv = l.id;
Modified mods/starlit/species.lua from [e0959a01e2] to [236ca7459a].
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 + user.cooldownTimes.stamina = core.get_gametime() 52 52 p.cb = p.cb + cost*d 53 53 if p.cb >= 5 then 54 54 user:statDelta('stamina', -p.cb) 55 55 p.cb = 0 56 56 if user:effectiveStat 'stamina' < cost then halt() end 57 57 end 58 58 end
Modified mods/starlit/suit.lua from [963193f502] to [d40c92ebbb].
195 195 end 196 196 197 197 a.suit[name] = img 198 198 end 199 199 end 200 200 end 201 201 202 - minetest.register_tool(id, { 202 + core.register_tool(id, { 203 203 short_description = def.name; 204 204 description = starlit.ui.tooltip { 205 205 title = def.name; 206 206 desc = def.desc; 207 207 color = lib.color(.1, .7, 1); 208 208 }; 209 209 groups = { ................................................................................ 313 313 }; 314 314 starlit_suit_canisters = { 315 315 suitSlot = true; 316 316 itemClass = 'canister'; 317 317 }; 318 318 } 319 319 320 -minetest.register_allow_player_inventory_action(function(luser, act, inv, p) 320 +core.register_allow_player_inventory_action(function(luser, act, inv, p) 321 321 local user = starlit.activeUsers[luser:get_player_name()] 322 322 local function grp(i,g) 323 - return minetest.get_item_group(i:get_name(), g) ~= 0 323 + return core.get_item_group(i:get_name(), g) ~= 0 324 324 end 325 325 local function checkBaseRestrictions(list) 326 326 local restrictions = slotProps[list] 327 327 if not restrictions then return nil, true end 328 328 if restrictions.suitSlot then 329 329 if user:naked() then return restrictions, false end 330 330 end ................................................................................ 350 350 return true 351 351 end 352 352 local function itemCanLeave(item, list) 353 353 local rst, ok = checkBaseRestrictions(list) 354 354 if not ok then return false end 355 355 if rst == nil then return true end 356 356 357 - if minetest.get_item_group(item:get_name(), 'specialInventory') then 357 + if core.get_item_group(item:get_name(), 'specialInventory') then 358 358 359 359 end 360 360 361 361 if rst.maintenanceNode then return false end 362 362 return true 363 363 end 364 364 ................................................................................ 371 371 if not itemFits(p.stack, p.listname) then return 0 end 372 372 elseif act == 'take' then 373 373 if not itemCanLeave(p.stack, p.listname) then return 0 end 374 374 end 375 375 return true 376 376 end) 377 377 378 -minetest.register_on_player_inventory_action(function(luser, act, inv, p) 378 +core.register_on_player_inventory_action(function(luser, act, inv, p) 379 379 local user = starlit.activeUsers[luser:get_player_name()] 380 380 local function slotChange(slot,a,item) 381 381 local s = slotProps[slot] 382 382 if slot == 'starlit_suit' then 383 383 user:updateSuit() 384 384 if user:naked() then 385 385 starlit.type.suit.purgeInventories(user.entity)
Modified mods/starlit/terrain.lua from [eeb268d7fe] to [6e0c0d7cf5].
30 30 max_items = 3; 31 31 items = { 32 32 {rarity = 2, items = {'starlit:soil_clump'}}; 33 33 {rarity = 3, items = {'starlit:soil_clump'}}; 34 34 {rarity = 4, items = {'starlit:soil_clump'}}; 35 35 }; 36 36 } 37 -minetest.register_node('starlit:soil', { 37 +core.register_node('starlit:soil', { 38 38 description = T 'Soil'; 39 39 tiles = {'starlit-terrain-soil.png'}; 40 40 groups = {looseClump = 2, soil = 1}; 41 41 drop = soilDrop; 42 42 sounds = soilSounds; 43 43 _starlit = { 44 44 kind = 'block'; 45 45 elements = {}; 46 46 recover = soilRec; 47 47 }; 48 48 }) 49 49 50 50 51 -minetest.register_node('starlit:sand', { 51 +core.register_node('starlit:sand', { 52 52 description = T 'Sand'; 53 53 tiles = {'starlit-terrain-sand.png'}; 54 54 groups = {looseClump = 1, sand = 1, falling_node = 1}; 55 55 drop = ''; 56 56 sounds = sandSounds; 57 57 _starlit = { 58 58 kind = 'block'; 59 59 fab = starlit.type.fab { element = { silicon = 25 } }; 60 60 }; 61 61 }) 62 62 63 -minetest.register_node('starlit:lifesilt', { 63 +core.register_node('starlit:lifesilt', { 64 64 description = T 'Lifesilt'; 65 65 tiles = {'starlit-terrain-lifesilt.png'}; 66 66 groups = {looseClump = 1, lifesilt = 1, falling_node = 1}; 67 67 drop = ''; 68 68 sounds = sandSounds; 69 69 _starlit = { 70 70 kind = 'block'; 71 71 recover = starlit.type.fab { element = { carbon = 16, silicon = 16, rubidium = 4 } }; 72 72 }; 73 73 }) 74 74 75 -minetest.register_craftitem('starlit:soil_clump', { 75 +core.register_craftitem('starlit:soil_clump', { 76 76 short_description = T 'Soil'; 77 77 description = starlit.ui.tooltip { 78 78 title = T 'Soil'; 79 79 desc = 'A handful of nutrient-packed soil, suitable for growing plants'; 80 80 color = lib.color(0.3,0.2,0.1); 81 81 }; 82 82 inventory_image = 'starlit-item-soil.png'; 83 83 groups = {looseClump = 2, soil = 1}; 84 84 on_place = function(me, luser, point) 85 85 if me:get_count() < 3 then return end 86 - if minetest.place_node(point.above, {name = 'starlit:soil'}, luser) then 86 + if core.place_node(point.above, {name = 'starlit:soil'}, luser) then 87 87 me:take_item(3) 88 88 end 89 89 return me 90 90 end; 91 91 _starlit = { 92 92 recover = starlit.type.fab { element = { carbon = 25 / 4 } }; 93 93 }; ................................................................................ 99 99 items = { 100 100 { 101 101 items = {'starlit:soil'}, rarity = 2; 102 102 tool_groups = { 'shovel', 'trowel' }; 103 103 }; 104 104 }; 105 105 } 106 - minetest.register_node(def.name, { 106 + core.register_node(def.name, { 107 107 description = T 'Greengraze'; 108 108 tiles = { 109 109 def.img .. '.png'; 110 110 'starlit-terrain-soil.png'; 111 111 { 112 112 name = 'starlit-terrain-soil.png^' .. def.img ..'-overlay.png'; 113 113 tileable_vertical = false; ................................................................................ 136 136 desc = T 'Undergloam'; 137 137 -- fungal carpet 138 138 img = 'starlit-terrain-undergloam'; 139 139 recover = soilRec; 140 140 } 141 141 142 142 for _, w in pairs {false,true} do 143 - minetest.register_node('starlit:liquid_water' .. (w and '_flowing' or ''), { 143 + core.register_node('starlit:liquid_water' .. (w and '_flowing' or ''), { 144 144 description = T 'Water'; 145 145 drawtype = 'liquid'; 146 146 waving = 3; 147 147 tiles = { 148 148 { 149 149 -- name = "default_water_source_animated.png"; 150 150 name = "starlit-water.png"; ................................................................................ 185 185 groups = {water = 3, liquid = 3}; 186 186 }); 187 187 end 188 188 189 189 190 190 starlit.world.mineral.foreach('starlit:mineral-generate', {}, function(node,m) 191 191 local grp = {mineral = 1} 192 - minetest.register_node(node, { 192 + core.register_node(node, { 193 193 short_description = m.name; 194 194 description = starlit.ui.tooltip { 195 195 title = m.name; 196 196 desc = m.desc; 197 197 color = m.tone; 198 198 }; 199 199 tiles = m.tiles or ................................................................................ 213 213 }) 214 214 if not m.excludeOre then 215 215 local seed = 0 216 216 -- grp.ore = 1 217 217 for i = 1, #m.name do 218 218 seed = seed*50 + string.byte(m.name, i) 219 219 end 220 - minetest.register_ore { 220 + core.register_ore { 221 221 ore = node; 222 222 ore_type = m.dist.kind; 223 223 wherein = m.dist.among; 224 224 clust_scarcity = m.dist.rare; 225 225 clust_num_ores = m.dist.ores; 226 226 clust_size = m.dist.clust; 227 227 y_min = m.dist.height[1], y_max = m.dist.height[2]; ................................................................................ 303 303 time = { shred = 3; }; 304 304 cost = { shredPower = 3; }; 305 305 }; 306 306 }) 307 307 308 308 -- map generation 309 309 310 -minetest.register_alias('mapgen_stone', 'starlit:mineral_feldspar') 311 -minetest.register_alias('mapgen_water_source', 'starlit:liquid_water') 312 -minetest.register_alias('mapgen_river_water_source', 'starlit:liquid_water') 310 +core.register_alias('mapgen_stone', 'starlit:mineral_feldspar') 311 +core.register_alias('mapgen_water_source', 'starlit:liquid_water') 312 +core.register_alias('mapgen_river_water_source', 'starlit:liquid_water') 313 313
Modified mods/starlit/ui.lua from [01dfc2a3de] to [3ce8488360].
46 46 return state, created 47 47 end; 48 48 render = function(self, state, user) 49 49 return self.pages[state.page].render(state, user) 50 50 end; 51 51 show = function(self, user) 52 52 local state = self:begin(user) 53 - minetest.show_formspec(user.name, self.id,self:render(state, user)) 53 + core.show_formspec(user.name, self.id,self:render(state, user)) 54 54 end; 55 55 open = function(self, user, page, ...) 56 56 user:suitSound 'starlit-nav' 57 57 self:begin(user, page, ...) 58 58 self:show(user) 59 59 end; 60 60 close = function(self, user) 61 61 local state = starlit.activeUI[user.name] 62 62 if state and state.form == self.id then 63 63 self:cb('onClose', user) 64 64 starlit.activeUI[user.name] = nil 65 - minetest.close_formspec(user.name, self.id) 65 + core.close_formspec(user.name, self.id) 66 66 end 67 67 end; 68 68 }; 69 69 construct = function(p) 70 70 if not p.id then error('UI missing id') end 71 71 p.pages = p.pages or {} 72 72 return p ................................................................................ 98 98 hue = 260, sat = 0, lum = 0 99 99 }; 100 100 } 101 101 local lines = state.lines 102 102 local cmod = string.format('^[hsl:%s:%s:%s', 103 103 state.color.hue, state.color.sat*0xff, state.color.lum*0xff) 104 104 105 - local E = minetest.formspec_escape 105 + local E = core.formspec_escape 106 106 if state.padding/2 > state.x then state.x = state.padding/2 end 107 107 if state.padding/2 > state.y then state.y = state.padding/2 end 108 108 109 109 local function btnColorDef(sel) 110 110 local function climg(state,img) 111 111 local selstr 112 112 if sel == nil then
Modified mods/starlit/user.lua from [9accce5f34] to [1a0e392600].
6 6 -- client. it provides for initial signup and join, 7 7 -- managing the HUD, skinning the player model, 8 8 -- effecting weather changes, etc. 9 9 10 10 local lib = starlit.mod.lib 11 11 12 12 local function hudAdjustBacklight(img) 13 - local night = math.abs(minetest.get_timeofday() - .5) * 2 13 + local night = math.abs(core.get_timeofday() - .5) * 2 14 14 local opacity = night*0.8 15 15 return img:fade(opacity) 16 16 end 17 17 18 18 local userStore = lib.marshal.metaStore { 19 19 persona = { 20 20 key = 'starlit:persona'; ................................................................................ 66 66 starlit.type.user = lib.class { 67 67 name = 'starlit:user'; 68 68 leds = leds; 69 69 construct = function(ident) 70 70 local name, luser 71 71 if type(ident) == 'string' then 72 72 name = ident 73 - luser = minetest.get_player_by_name(name) 73 + luser = core.get_player_by_name(name) 74 74 else 75 75 luser = ident 76 76 name = luser:get_player_name() 77 77 end 78 78 return { 79 79 entity = luser; 80 80 name = name; ................................................................................ 113 113 } 114 114 end; 115 115 __index = { 116 116 -------------- 117 117 -- overlays -- 118 118 -------------- 119 119 updateOverlays = function(self) 120 - -- minetest: because fuck you, that's why 120 + -- luanti: because fuck you, that's why 121 121 local engineGravity = starlit.constant.phys.engineGravity 122 122 local targetGravity = starlit.world.planet.gravity 123 123 local phys = { 124 124 speed = self.pheno:trait('speed',1); 125 125 jump = self.pheno:trait('jump',1); 126 126 gravity = targetGravity / engineGravity; 127 127 speed_climb = 1; ................................................................................ 433 433 self.hud.elt.time = self:attachTextBox { 434 434 name = 'time'; 435 435 align = {x=0, y=1}; 436 436 pos = {x=0.5, y=1}; 437 437 ofs = {x=0,y=-95}; 438 438 text = function(user) 439 439 local cal = starlit.world.time.calendar[user.pref.calendar] 440 - return cal.time(minetest.get_timeofday()) 440 + return cal.time(core.get_timeofday()) 441 441 end; 442 442 } 443 443 self.hud.elt.temp = self:attachMeter { 444 444 name = 'temp'; 445 445 align = {x=1, y=-1}; 446 446 pos = {x=0, y=1}; 447 447 ofs = {x=20, y=-20}; ................................................................................ 527 527 updateHUD = function(self) 528 528 for name, e in pairs(self.hud.elt) do 529 529 if e.update then e.update() end 530 530 end 531 531 self:updateLEDs() 532 532 end; 533 533 updateLEDs = function(self) 534 - local time = minetest.get_gametime() 534 + local time = core.get_gametime() 535 535 local function updateSide(name, ofs, tx) 536 536 local del = {} 537 537 local idx = 0 538 538 for i, l in ipairs(self.hud.led[name]) do 539 539 if time - l.origin > 3 then 540 540 if l.elt then self.entity:hud_remove(l.elt.id) end 541 541 self.hud.led.map[l.kind] = nil ................................................................................ 605 605 inv:set_stack('hand', 1, hnd) 606 606 end; 607 607 608 608 --------------------- 609 609 -- intel-gathering -- 610 610 --------------------- 611 611 clientInfo = function(self) 612 - return minetest.get_player_information(self.name) 612 + return core.get_player_information(self.name) 613 613 end; 614 614 species = function(self) 615 615 return starlit.world.species.index[self.persona.species] 616 616 end; 617 617 -- can the suit heater sustain its current internal temperature in an area of t°C 618 618 tempCanSustain = function(self, t) 619 619 if self:naked() then return false end ................................................................................ 687 687 688 688 -- i feel like there has to be a better way 689 689 local posrng = starlit.world.seedbank[0x13f19] -- TODO player-specific seed 690 690 local cx = posrng:int(-500,500) --math.random(-500,500) 691 691 local iter, startPoint = 1 692 692 repeat local temp = -100 693 693 local cz = posrng:int(-500,500) 694 - local cy = minetest.get_spawn_level(cx, cz) 694 + local cy = core.get_spawn_level(cx, cz) 695 695 if cy then 696 696 startPoint = vector.new(cx,cy,cz) 697 697 temp = starlit.world.climate.eval(startPoint,.5,.5).surfaceTemp 698 698 end 699 699 iter = iter + 1 700 700 if iter > 100 then break end -- avoid infiniloop in pathological conditions 701 701 until temp > -2 ................................................................................ 705 705 onDie = function(self, reason) 706 706 local inv = self.entity:get_inventory() 707 707 local where = self.entity:get_pos() 708 708 local function dropInv(lst) 709 709 local l = inv:get_list(lst) 710 710 for i, o in ipairs(l) do 711 711 if o and not o:is_empty() then 712 - minetest.item_drop(o, self.entity, where) 712 + core.item_drop(o, self.entity, where) 713 713 end 714 714 end 715 715 inv:set_list(lst, {}) 716 716 end 717 717 dropInv 'main' 718 718 dropInv 'starlit_suit' 719 719 self:updateSuit() ................................................................................ 825 825 -- environment suit & body -- 826 826 ----------------------------- 827 827 suitStack = function(self) 828 828 return self.entity:get_inventory():get_stack('starlit_suit', 1) 829 829 end; 830 830 suitSound = function(self, sfx) 831 831 -- trigger a sound effect from the player's suit computer 832 - minetest.sound_play(sfx, {object=self.entity, max_hear_distance=4}, true) 832 + core.sound_play(sfx, {object=self.entity, max_hear_distance=4}, true) 833 833 end; 834 834 suitPowerStateSet = function(self, state, silent) 835 835 -- necessary to enable reacting to power state changes 836 836 -- e.g. to play sound effects, display warnings 837 837 local os 838 838 self:forSuit(function(s) 839 839 os=s:powerState() ................................................................................ 1008 1008 return true 1009 1009 end 1010 1010 return false 1011 1011 end; 1012 1012 1013 1013 alarm = function(self, urgency, kind, minFreq) 1014 1014 minFreq = minFreq or 1.5 1015 - local time = minetest.get_gametime() 1015 + local time = core.get_gametime() 1016 1016 local led = leds[kind] 1017 1017 1018 1018 local ul = self.hud.led.map[kind] 1019 1019 if ul then 1020 1020 if time - ul.origin > minFreq then 1021 1021 ul.origin = time 1022 1022 else return end ................................................................................ 1048 1048 1049 1049 --[[ 1050 1050 freq = freq or 3 1051 1051 local urgencies = { 1052 1052 [1] = {sound = 'starlit-alarm'}; 1053 1053 [2] = {sound = 'starlit-alarm-urgent'}; 1054 1054 } 1055 - local gt = minetest.get_gametime() 1055 + local gt = core.get_gametime() 1056 1056 local urg = urgencies[urgency] or urgencies[#urgencies] 1057 1057 1058 1058 if gt - self.cooldownTimes.alarm < freq then return end 1059 1059 1060 1060 self.cooldownTimes.alarm = gt 1061 1061 self:suitSound(urg.sound) 1062 1062 ................................................................................ 1070 1070 } 1071 1071 elt.ofs.x = elt.ofs.x + where.ofs.x 1072 1072 elt.ofs.y = elt.ofs.y + where.ofs.y 1073 1073 local attached = self:attachImage(elt) 1074 1074 table.insert(self.hud.alarm, attached) 1075 1075 1076 1076 -- HATE. HATE. HAAAAAAAAAAATE 1077 - minetest.after(freq/2, function() 1077 + core.after(freq/2, function() 1078 1078 for k,v in pairs(self.hud.alarm) do 1079 1079 self.entity:hud_remove(v.id) 1080 1080 end 1081 1081 self.hud.alarm={} 1082 1082 end) 1083 1083 end]] 1084 1084 end; ................................................................................ 1096 1096 --------------- 1097 1097 -- inventory -- 1098 1098 --------------- 1099 1099 give = function(self, item) 1100 1100 item = ItemStack(item) 1101 1101 local inv = self.entity:get_inventory() 1102 1102 local function is(grp) 1103 - return minetest.get_item_group(item:get_name(), grp) ~= 0 1103 + return core.get_item_group(item:get_name(), grp) ~= 0 1104 1104 end 1105 1105 -- TODO notif popups 1106 1106 if is 'specialInventory' then 1107 1107 --[[ 1108 1108 if is 'powder' then 1109 1109 if self:naked() then return item end 1110 1110 local cans = inv:get_list 'starlit_suit_canisters' ................................................................................ 1120 1120 else 1121 1121 return inv:add_item('main', item) 1122 1122 end 1123 1123 end; 1124 1124 thrustUpon = function(self, item) 1125 1125 local r = self:give(st) 1126 1126 if not r:is_empty() then 1127 - return minetest.add_item(self.entity:get_pos(), r) 1127 + return core.add_item(self.entity:get_pos(), r) 1128 1128 end 1129 1129 end; 1130 1130 consume = function(self, stack, n) 1131 1131 n = n or 1 1132 1132 if n == 0 then n = stack:get_count() end 1133 1133 local fd = stack:take_item(n) 1134 1134 local stats = starlit.world.food.effectiveStats(fd) ................................................................................ 1215 1215 u:statDelta('health', -5*biointerval) 1216 1216 end 1217 1217 1218 1218 if water == 0 then -- dying of thirst 1219 1219 u:statDelta('health', -20*biointerval) 1220 1220 end 1221 1221 1222 - if sp < 1.0 and minetest.get_gametime() - u.cooldownTimes.stamina > 5.0 then 1222 + if sp < 1.0 and core.get_gametime() - u.cooldownTimes.stamina > 5.0 then 1223 1223 u:statDelta('stamina', (u:phenoTrait('staminaRegen',1) * penaltyFromFatigue) / heatPenalty) 1224 1224 -- print('stam', u:effectiveStat 'stamina', u:phenoTrait('staminaRegen',1) / heatPenalty, heatPenalty) 1225 1225 end 1226 1226 1227 1227 local morale, mp = u:effectiveStat 'morale' 1228 1228 local pr = u:phenoTrait 'numinaRegen' 1229 1229 u:statDelta('numina', pr * penaltyFromFatigue * mp) ................................................................................ 1240 1240 manv = 0x020; 1241 1241 snk = 0x040; 1242 1242 dig = 0x080; 1243 1243 put = 0x100; 1244 1244 zoom = 0x200; 1245 1245 } 1246 1246 -- this is the painful part 1247 -minetest.register_globalstep(function(delta) 1247 +core.register_globalstep(function(delta) 1248 1248 local doNothing,mustInit,mustHalt = 0,1,2 1249 1249 for id, user in pairs(starlit.activeUsers) do 1250 1250 local ent = user.entity 1251 1251 local bits = ent:get_player_control_bits() 1252 1252 1253 1253 local function what(b) 1254 1254 if bit.band(bits, b) ~= 0 and bit.band(user.action.bits, b) == 0 then
Modified mods/starlit/world.lua from [de51a702a5] to [e94ad91b55].
1 1 local lib = starlit.mod.lib 2 2 local world = starlit.world 3 3 4 4 function world.date() 5 - local days = minetest.get_day_count() 5 + local days = core.get_day_count() 6 6 local year = math.floor(days / world.planet.orbit); 7 7 local day = days % world.planet.orbit; 8 8 return { 9 9 year = year, day = day; 10 10 season = day / world.planet.orbit + 0.5; -- begin summer 11 11 } 12 12 end ................................................................................ 17 17 local heatRange = {min = -50, max = 50} -- translate mt temps into real temps 18 18 19 19 -- this function provides the basis for temperature calculation, 20 20 -- which is performed by adding this value to the ambient temperature, 21 21 -- determined by querying nearby group:heatSource items in accordance 22 22 -- with the inverse-square law 23 23 function world.climate.eval(pos, tod, season) 24 - local data = minetest.get_biome_data(pos) 25 - local biome = world.ecology.biomes.db[minetest.get_biome_name(data.biome)] 24 + local data = core.get_biome_data(pos) 25 + local biome = world.ecology.biomes.db[core.get_biome_name(data.biome)] 26 26 -- print('climate:', dump(data)) 27 27 local heat, humid = data.heat, data.humidity 28 28 heat = lerp(heat/100, heatRange.min, heatRange.max) 29 - tod = tod or minetest.get_timeofday() 29 + tod = tod or core.get_timeofday() 30 30 heat = lerp(math.abs(tod - 0.5)*2, heat, heat + biome.nightTempDelta) 31 31 -- print('base heat', heat) 32 32 33 33 local td = world.date() 34 34 heat = heat + gradient(biome.seasonalTemp, season or td.season) 35 35 -- print('seasonal heat', heat) 36 36 if pos.y > 0 then ................................................................................ 47 47 48 48 local vdsq = lib.math.vdsq 49 49 function world.climate.temp(pos, timeshift) --> irradiance at pos in W 50 50 local cl = world.climate.eval(pos) 51 51 local radCenters = starlit.region.radiator.store:get_areas_for_pos(pos, false, true) 52 52 local irradiance = 0 53 53 for _,e in pairs(radCenters) do 54 - local rpos = minetest.string_to_pos(e.data) 55 - local rdef = assert(minetest.registered_nodes[assert(minetest.get_node(rpos)).name]) 54 + local rpos = core.string_to_pos(e.data) 55 + local rdef = assert(core.registered_nodes[assert(core.get_node(rpos)).name]) 56 56 local rc = rdef._starlit.radiator 57 57 local r_max = rc.radius(rpos) 58 58 59 59 local dist_sq = vdsq(rpos,pos) 60 60 if dist_sq <= r_max^2 then 61 61 -- cheap bad way 62 - -- if minetest.line_of_sight(rpos,pos) then 62 + -- if core.line_of_sight(rpos,pos) then 63 63 -- 64 64 -- expensive way 65 65 local obstruct = 0 66 66 local ray = Raycast(rpos, pos, true, true) 67 67 for p in ray do 68 68 if p.type == 'node' then obstruct = obstruct + 1 end 69 69 end ................................................................................ 85 85 end 86 86 local w = world.climate.weatherAt(pos, timeshift) 87 87 88 88 return irradiance + cl.surfaceTemp 89 89 end 90 90 91 91 function world.ecology.biomeAt(pos) 92 - return world.ecology.biomes.db[minetest.get_biome_name(minetest.get_biome_data(pos).biome)] 92 + return world.ecology.biomes.db[core.get_biome_name(core.get_biome_data(pos).biome)] 93 93 end 94 94 95 95 96 -minetest.after(0, function() 97 - world.climate.weatherMap.kind = minetest.get_perlin { 96 +core.after(0, function() 97 + world.climate.weatherMap.kind = core.get_perlin { 98 98 seed = 0x925afe; 99 99 octaves = 2; 100 100 spread = vector.new(256,256,120); 101 101 }; 102 - world.climate.weatherMap.severity = minetest.get_perlin { 102 + world.climate.weatherMap.severity = core.get_perlin { 103 103 seed = 0x39de1d; 104 104 octaves = 1; 105 105 spread = vector.new(256,256,60); 106 106 }; 107 107 end) 108 108 109 109 function world.climate.weatherAt(pos, timeshift) 110 110 timeshift = timeshift or 0 111 - local wv = world.climate.weatherMap.kind:get_3d(vector.new(pos.x, pos.z, minetest.get_gametime() + timeshift)) 112 - local sev = world.climate.weatherMap.severity:get_3d(vector.new(pos.x, pos.z, minetest.get_gametime() + timeshift)) 111 + local wv = world.climate.weatherMap.kind:get_3d(vector.new(pos.x, pos.z, core.get_gametime() + timeshift)) 112 + local sev = world.climate.weatherMap.severity:get_3d(vector.new(pos.x, pos.z, core.get_gametime() + timeshift)) 113 113 local b = world.ecology.biomeAt(pos) 114 114 local w = 'starlit:clear' 115 115 for i,v in ipairs(b.weather) do 116 116 if wv < v[1] then 117 117 w = v[2] 118 118 break 119 119 end ................................................................................ 194 194 world.climate.weather.link('starlit:meteorShower', { 195 195 name = 'Meteor Shower'; 196 196 danger = 2; 197 197 }) 198 198 199 199 world.ecology.biomes.foreach('starlit:biome-gen', {}, function(id, b) 200 200 b.def.name = id 201 - minetest.register_biome(b.def) 201 + core.register_biome(b.def) 202 202 end) 203 203 204 204 world.ecology.plants.foreach('starlit:plant-gen', {}, function(id, b) 205 205 local stageCt = #b.stages 206 206 local function stageID(n) 207 207 if n == stageCt then return id end 208 208 return id .. string.format('_stage_%s', n) ................................................................................ 244 244 end; 245 245 }; 246 246 } 247 247 if st.swap then 248 248 base.node_dig_prediction = "" 249 249 function base.after_dig_node(pos, node, digger) 250 250 node.name = stageID(st.swap) 251 - minetest.swap_node(pos, node) 251 + core.swap_node(pos, node) 252 252 return true 253 253 end 254 254 end 255 255 if st.biolum then base.light_source = st.biolum; end 256 256 return base 257 257 end 258 258 for i, v in ipairs(b.stages) do 259 259 local n = regStage(i, v) 260 - minetest.register_node(stageID(i), n) 260 + core.register_node(stageID(i), n) 261 261 b.stageNodes[i] = stageID(i) 262 262 end 263 263 b.fullyGrown = stageID(stageCt) 264 264 265 265 local dec = { 266 266 deco_type = 'simple'; 267 267 decoration = b.stageNodes; 268 268 height = 1; 269 269 param2 = b.meshOpt or 0; 270 270 } 271 271 for k,v in pairs(b.decoration) do dec[k] = v end 272 - b.decoration = minetest.register_decoration(dec) 272 + b.decoration = core.register_decoration(dec) 273 273 end) 274 274 275 275 local toward = lib.math.toward 276 276 local hfinterval = 1.5 277 277 starlit.startJob('starlit:temps', hfinterval, function(delta) 278 278 279 279 -- our base thermal conductivity (κ) is measured in °C/°C/s. say the ................................................................................ 285 285 -- d = Tₑ − Tₚ = -40°C 286 286 -- ΔT = κ×d = -.4°C/s 287 287 -- too cold: 288 288 -- x = beginning of danger zone 289 289 -- κ × (x - Tₚ) = y where y < Tₚ 290 290 -- our final change in temperature is computed as tΔC where t is time 291 291 local kappa = starlit.constant.heat.thermalConductivity 292 - local now = minetest.get_gametime() 292 + local now = core.get_gametime() 293 293 for name,user in pairs(starlit.activeUsers) do 294 294 local tr = user:species().tempRange 295 295 local t = starlit.world.climate.temp(user.entity:get_pos()) 296 296 297 297 local weather,wsev = starlit.world.climate.weatherAt(user.entity:get_pos()) 298 298 local wfac 299 299 if user.env.weather == nil ................................................................................ 379 379 world.ecology.trees.foreach('starlit:tree-gen', {}, function(id, t) 380 380 for i,td in ipairs(t.decorate) do 381 381 local dec = { 382 382 deco_type = 'lsystem'; 383 383 treedef = t.def; 384 384 } 385 385 for k,v in pairs(td) do dec[k]=v end 386 - minetest.register_decoration(dec) 386 + core.register_decoration(dec) 387 387 end 388 388 end) 389 389 390 -minetest.register_abm { 390 +core.register_abm { 391 391 label = "plant growth"; 392 392 nodenames = {'group:plant_grow'}; 393 393 chance = 15; 394 394 interval = 20; 395 395 catch_up = true; 396 396 action = function(pos, node) 397 - local def = minetest.registered_nodes[node.name]._starlit.plant 397 + local def = core.registered_nodes[node.name]._starlit.plant 398 398 -- 5 W: maximum power for UV lamps 399 399 -- 7 W: maximum solar power 400 - local uv = (minetest.get_natural_light(pos) / 15) * 7 400 + local uv = (core.get_natural_light(pos) / 15) * 7 401 401 -- TODO compute artificial contribution 402 402 local req = lib.tbl.defaults({ 403 403 uv = 3; 404 404 soil = 'soil'; 405 405 temp = -10; 406 406 humid = nil; 407 407 }, def.growReq); 408 408 409 409 -- TODO check other reqs 410 410 411 411 if uv > req.uv then 412 412 local plant = starlit.world.ecology.plants.db[def.id] 413 413 local nextStage = plant.stageNodes[def.stage + 1] 414 - minetest.swap_node(pos, {name=nextStage}) 414 + core.swap_node(pos, {name=nextStage}) 415 415 end 416 416 end; 417 417 }
Modified mods/vtlib/color.lua from [d9e5a5527c] to [f14f6eaefb].
125 125 end; 126 126 127 127 int = function(self) 128 128 return bit.bor(bit.lshift(self:int24(), 8), math.floor(0xff*(self.alpha or 1.0))) 129 129 end; 130 130 131 131 fmt = function(self, text) return 132 - minetest.colorize(self:hex(), text) 132 + core.colorize(self:hex(), text) 133 133 end; 134 134 135 135 bg = function(self, text) return 136 - text .. minetest.get_background_escape_sequence(self:hex()) 136 + text .. core.get_background_escape_sequence(self:hex()) 137 137 end; 138 138 139 139 lum = function(self) return 140 140 (self.red + self.green + self.blue) / 3 141 141 end; 142 142 143 143 pair = function(self) --> bg, fg
Modified mods/vtlib/dbg.lua from [3d3bef9b5d] to [8f550c074a].
6 6 local lastmod, lastarea 7 7 8 8 function dbg.debugger(area) 9 9 local depth = 0 10 10 local d = {} 11 11 function d.enter() depth = depth+1 end 12 12 function d.exit() depth = depth-1 end 13 - local mod = minetest.get_current_modname() 13 + local mod = core.get_current_modname() 14 14 if dbg.aloud then 15 15 function d.report(fmt, ...) 16 16 local where = debug.getinfo(2) 17 17 local caller = debug.getinfo(3) 18 18 if mod and (lastmod ~= mod or lastarea ~= area) then 19 19 local ms = mod or '' 20 20 if area then ms = ms .. '.' .. area end
Modified mods/vtlib/init.lua from [d021d078eb] to [d81d22bdc5].
1 -local ident = minetest.get_current_modname() 2 -local path = minetest.get_modpath(ident) 1 +local ident = core.get_current_modname() 2 +local path = core.get_modpath(ident) 3 3 4 4 local lib = {} 5 5 _G[ident] = lib 6 6 7 7 local function 8 8 component(name) 9 9 local p = string.format('%s/%s.lua', path, name)
Modified mods/vtlib/item.lua from [29827ac7a0] to [3c399f0296].
12 12 count = b:get_count() - a:get_count(); 13 13 } 14 14 end 15 15 end 16 16 end 17 17 18 18 -- it is extremely unfortunate this function needs to exist. 19 --- minetest needs to export its matching capabilities already 19 +-- luanti needs to export its matching capabilities already 20 20 fn.groupmatch = function(identity,item,exact) 21 21 if exact == nil then exact = true end 22 22 local count 23 23 if type(identity) == 'table' then 24 24 count = identity.count 25 25 identity = identity.name 26 26 else ................................................................................ 37 37 end 38 38 39 39 if lib.str.beginswith(identity, 'group:') then 40 40 local stack = ItemStack(item) 41 41 local groups = lib.str.explode(string.sub(identity,7), ',') 42 42 for _,g in pairs(groups) do 43 43 local rn,rv = lib.tbl.split(g,'=') 44 - local gv = minetest.get_item_group(stack:get_name(), rn) 44 + local gv = core.get_item_group(stack:get_name(), rn) 45 45 if rv then 46 46 if gv ~= tonumber(rv) then return false, stack end 47 47 else 48 48 if (not gv) or gv == 0 then return false, stack end 49 49 end 50 50 end 51 51
Modified mods/vtlib/marshal.lua from [979397aff5] to [63566b8bdf].
91 91 end 92 92 93 93 return encoder 94 94 end 95 95 96 96 function m.metaStore(map, prefix) 97 97 report('generating metaStore for %s', dump(map)) 98 - if prefix == true then prefix = minetest.get_current_modname() end 98 + if prefix == true then prefix = core.get_current_modname() end 99 99 local function keyFor(k) 100 100 k = map[k].key 101 101 if prefix then return prefix .. ':' .. k end 102 102 return k 103 103 end 104 104 105 105 return function(obj)
Modified mods/vtlib/math.lua from [65dcc21fc6] to [3b6ca155c9].
1 1 local lib = ... 2 2 local fn = {} 3 3 4 4 fn.vsep = function(vec) -- separate a vector into a direction + magnitude 5 5 return vec:normalize(), vec:length() 6 6 end 7 7 8 --- minetest now only provides the version of this function that sqrts the result 8 +-- luanti now only provides the version of this function that sqrts the result 9 9 -- which is pointlessly wasteful much of the time 10 10 fn.vdsq = function(a,b) 11 11 local d = vector.subtract(a,b) 12 12 return (d.x ^ 2) + (d.y ^ 2) + (d.z ^ 2) 13 13 end 14 14 15 15 fn.vdcomp = function(dist,v1,v2) -- compare the distance between two points
Modified mods/vtlib/node.lua from [75e0d781d2] to [aa93f93a5c].
64 64 z = pos.z + r(0 - range, range); 65 65 } 66 66 end 67 67 for name, inv in pairs(meta.inventory) do 68 68 if only and not lib.tbl.has(only,name) then goto skip end 69 69 for _, item in pairs(inv) do 70 70 if not item:is_empty() then 71 - minetest.add_item(offset(pos,0.4), item) 71 + core.add_item(offset(pos,0.4), item) 72 72 end 73 73 end 74 74 ::skip::end 75 75 end; 76 76 77 77 local force = function(pos,preload_for) 78 - local n = minetest.get_node_or_nil(pos) 78 + local n = core.get_node_or_nil(pos) 79 79 if preload_for then lib.node.preload(pos,preload_for) end 80 80 if n then return n end 81 81 82 - minetest.load_area(pos) 83 - return minetest.get_node(pos) 82 + core.load_area(pos) 83 + return core.get_node(pos) 84 84 end; 85 85 86 86 local amass = function(startpoint,names,directions) 87 87 if not directions then directions = ofs.neighbors end 88 88 local check = function(n) 89 89 return lib.tbl.has(names, n.name, function(check,against) 90 90 return lib.item.groupmatch(against,check) ................................................................................ 123 123 until i > #stack 124 124 return nodes, positions 125 125 end; 126 126 127 127 local is_air = function(pos) 128 128 local n = force(pos) 129 129 if n.name == 'air' then return true end 130 - local d = minetest.registered_nodes[n.name] 130 + local d = core.registered_nodes[n.name] 131 131 if not d then return false end 132 132 return (d.walkable == false) and (d.drawtype == 'airlike' or d.buildable_to == true) 133 133 end; 134 134 135 135 local is_clear = function(pos) 136 136 if not lib.node.is_air(pos) then return false end 137 - local ents = minetest.get_objects_inside_radius(pos,0.5) 137 + local ents = core.get_objects_inside_radius(pos,0.5) 138 138 if #ents > 0 then return false end 139 139 return true 140 140 end; 141 141 142 142 local function boxwarp(nb, mogrifier, par) 143 143 if nb == nil then 144 144 return ................................................................................ 184 184 end 185 185 end; 186 186 187 187 is_air = is_air; 188 188 is_clear = is_clear; 189 189 190 190 insert = function(item, slot, npos, user, inv) 191 - inv = inv or minetest.get_meta(npos):get_inventory() 191 + inv = inv or core.get_meta(npos):get_inventory() 192 192 if inv:room_for_item(slot,item) then 193 193 inv:add_item(slot,item) 194 194 else repeat 195 195 if user then 196 196 local ui = user:get_inventory() 197 197 if ui:room_for_item('main', item) then 198 198 ui:add_item('main', item) 199 199 break 200 200 end 201 201 end 202 - minetest.add_item(npos, item) 202 + core.add_item(npos, item) 203 203 until true end 204 204 end; 205 205 206 206 install_bed = function(bed, where, dir) 207 207 local bottom = bed .. '_bottom' 208 208 local top = bed .. '_top' 209 209 local d 210 210 if type(dir) == 'number' then 211 211 d = dir 212 - dir = minetest.facedir_to_dir(d) 212 + dir = core.facedir_to_dir(d) 213 213 else 214 - d = minetest.dir_to_facedir(dir) 214 + d = core.dir_to_facedir(dir) 215 215 end 216 216 if not is_clear(where) and is_clear(where - dir) then return false end 217 - minetest.set_node(where, {name = top, param2 = d}) 218 - minetest.set_node(where - dir, {name = bottom, param2 = d}) 217 + core.set_node(where, {name = top, param2 = d}) 218 + core.set_node(where - dir, {name = bottom, param2 = d}) 219 219 return true 220 220 end; 221 221 222 222 get_arrival_point = function(pos) 223 223 local try = function(p) 224 224 local air = lib.node.is_clear 225 225 if air(p) then ................................................................................ 236 236 end 237 237 end; 238 238 239 239 240 240 forneighbor = function(pos, n, fn) 241 241 for _,p in pairs(n) do 242 242 local sum = vector.add(pos, p) 243 - local n = minetest.get_node(sum) 243 + local n = core.get_node(sum) 244 244 if n.name == 'ignore' then 245 - minetest.load_area(sum) 246 - n = minetest.get_node(sum) 245 + core.load_area(sum) 246 + n = core.get_node(sum) 247 247 end 248 248 if fn(sum, n) == false then break end 249 249 end 250 250 end; 251 251 252 252 amass = amass; 253 253 ................................................................................ 258 258 x = math.floor(pos.x / 16); 259 259 y = math.floor(pos.y / 16); 260 260 z = math.floor(pos.z / 16); 261 261 } 262 262 end; 263 263 264 264 preload = function(pos, user) 265 - minetest.load_area(pos) 265 + core.load_area(pos) 266 266 user:send_mapblock(lib.node.blockpos(pos)) 267 267 end; 268 268 269 269 discharger = function(pos) 270 270 local below = force(vector.subtract(pos,{x=0,y=1,z=0})) 271 271 if below.name == 'hopper:hopper' 272 272 or below.name == 'hopper:hopper_side' then 273 - local hopper = minetest.get_meta(below):get_inventory() 273 + local hopper = core.get_meta(below):get_inventory() 274 274 return function(i) 275 275 if hopper:room_for_item('main',i) then 276 276 return hopper:add_item('main',i), true 277 277 end 278 278 return i, false 279 279 end 280 280 else ................................................................................ 287 287 max_items = 1; 288 288 items = { 289 289 { items = {id} }; 290 290 }; 291 291 } 292 292 local next_apn = tbl.after_place_node 293 293 tbl.after_place_node = function(...) local pos, who, stack = ... 294 - minetest.get_meta(pos):from_table(stack:get_meta():to_table()) 294 + core.get_meta(pos):from_table(stack:get_meta():to_table()) 295 295 if next_apn then return next_apn(...) end 296 296 end 297 297 local next_pm = tbl.preserve_metadata 298 298 tbl.preserve_metadata = function(...) local pos, node, meta, drops = ... 299 299 drops[1]:get_meta():from_table({fields = meta}) 300 300 if next_pm then return next_pm(...) end 301 301 end 302 302 return tbl 303 303 end; 304 304 reg_autopreserve = function(id, tbl) 305 - minetest.register_node(id, lib.node.autopreserve(id, tbl)) 305 + core.register_node(id, lib.node.autopreserve(id, tbl)) 306 306 end; 307 307 308 308 boxwarp = boxwarp; 309 309 boxwarped = boxwarped; 310 310 }
Modified mods/vtlib/obj.lua from [7fd77150af] to [42f785b164].
2 2 -- from the game API 3 3 4 4 local fn = {} 5 5 local lib = ... 6 6 7 7 -- WARNING: INEFFICIENT AS FUCK 8 8 fn.identify = function(objref) --> objectid 9 - for _, o in pairs(minetest.get_connected_players()) do 9 + for _, o in pairs(core.get_connected_players()) do 10 10 if objref == o then return o:get_player_name(), 'player' end 11 11 end 12 - for id, le in pairs(minetest.luaentities) do 12 + for id, le in pairs(core.luaentities) do 13 13 if le.object == objref then return id, 'entity' end 14 14 end 15 15 end 16 16 17 17 fn.handle = lib.class { 18 18 __newindex = function(self,key,newval) 19 19 local hnd if self.player 20 - then hnd = minetest.get_player_by_name(self._id) 21 - else hnd = minetest.luaentities[self._id] 20 + then hnd = core.get_player_by_name(self._id) 21 + else hnd = core.luaentities[self._id] 22 22 end 23 23 if key == 'id' then 24 24 if type(newval) == 'string' then 25 - local p = minetest.get_player_by_name(newval) 25 + local p = core.get_player_by_name(newval) 26 26 if p then 27 27 self._id = newval 28 28 self.player = true 29 29 return 30 30 end 31 31 end 32 - if minetest.luaentities[newval] then 32 + if core.luaentities[newval] then 33 33 self._id = newval 34 34 self.player = false 35 35 else error('attempted to assign invalid ID to entity handle') end 36 36 elseif key == 'obj' then 37 37 local no, kind = fn.identify(newval) 38 38 if no then 39 39 self._id = no ................................................................................ 44 44 else error('attempted to assign invalid ObjectRef to entity handle') end 45 45 elseif key == 'stack' and self.kind == 'item' then 46 46 hnd:set_item(newval) 47 47 end 48 48 end; 49 49 __index = function(self,key) 50 50 local hnd if self.player then 51 - hnd = minetest.get_player_by_name(self._id) 51 + hnd = core.get_player_by_name(self._id) 52 52 else 53 - hnd = minetest.luaentities[self._id] 53 + hnd = core.luaentities[self._id] 54 54 end 55 55 if key == 'online' then 56 56 return hnd ~= nil 57 57 elseif key == 'id' then 58 58 if self.player then return nil 59 59 else return self._id end 60 60 elseif key == 'obj' then ................................................................................ 85 85 return maxy-miny, miny 86 86 else return 0 end 87 87 end 88 88 end 89 89 end; 90 90 construct = function(h) 91 91 local kind, id 92 - if type(h) == 'string' and minetest.get_player_by_name(h) ~= nil then 92 + if type(h) == 'string' and core.get_player_by_name(h) ~= nil then 93 93 kind = 'player'; 94 94 id = h 95 - elseif minetest.luaentities[h] then 95 + elseif core.luaentities[h] then 96 96 kind = 'entity'; 97 97 id = h 98 98 else id, kind = fn.identify(h) end 99 99 100 100 if not id then 101 101 error('attempted to construct object handle from invalid value') 102 102 end
Modified mods/vtlib/str.lua from [ded7121fc6] to [b2f5363bf4].
14 14 ['\xf2'] = '\2'; 15 15 ['\xf3'] = '\3'; 16 16 ['\xf4'] = '\0'; 17 17 }; 18 18 } 19 19 20 20 local utf8 21 -if _G.minetest then 22 - if minetest.global_exists 'utf8' then 21 +if _G.core then 22 + if core.global_exists 'utf8' then 23 23 utf8 = _G.utf8 24 24 end 25 25 else 26 26 utf8 = _G.utf8 27 27 end 28 28 if not utf8 then -- sigh 29 29 utf8 = {} ................................................................................ 202 202 end 203 203 return str 204 204 end; 205 205 206 206 meta_armor = function(str,mark_struct) 207 207 -- binary values stored in metadata need to be sanitized so 208 208 -- they don't contain values that will disrupt parsing of the 209 - -- KV store, as minetest (stupidly) uses in-band signalling 209 + -- KV store, as luanti (stupidly) uses in-band signalling 210 210 local sanitized = string.gsub(str, '.', function(char) 211 211 if sanitable.from[char] then 212 212 return '\xfe' .. sanitable.from[char] 213 213 else return char end 214 214 end) 215 215 if sanitized ~= str and mark_struct then 216 216 -- use different type code to mark struct headers for
Modified mods/vtlib/ui.lua from [765cced2b5] to [77b0e87fc7].
10 10 self.curs.y = math.max(h, self.curs.y + self.curs.maxh) 11 11 self.curs.maxh = 0 12 12 end; 13 13 attach = function(self, elt, x, y, w, h, ...) 14 14 local content = '' 15 15 if self.width - self.curs.x < w then self:nl() end 16 16 for _, v in pairs{...} do 17 - content = content .. ';' .. minetest.formspec_escape(tostring(v)) 17 + content = content .. ';' .. core.formspec_escape(tostring(v)) 18 18 end 19 19 self.src = self.src .. string.format('%s[%f,%f;%f,%f%s]', elt, x,y, w,h, content) 20 20 if h > self.curs.maxh then self.curs.maxh = h end 21 21 end; 22 22 add = function(self, elt, w, h, ...) 23 23 local ax, ay = self.curs.x, self.curs.y 24 24 self:attach(elt, ax,ay, w,h, ...) ................................................................................ 45 45 -- takes a configuration table mapping affinities to colors. 46 46 -- 'neutral' is the only required affinity 47 47 return function(a) 48 48 local color = a.color and a.color:readable(0.65, 1.0) 49 49 if color == nil then color = l.color(.5,.5,.5) end 50 50 local str = a.title 51 51 if a.desc then 52 - str = str .. '\n' .. color:fmt(minetest.wrap_text(a.desc,60)) 52 + str = str .. '\n' .. color:fmt(core.wrap_text(a.desc,60)) 53 53 end 54 54 if a.props then 55 55 -- str = str .. '\n' 56 56 for _,prop in pairs(a.props) do 57 57 local c 58 58 if prop.color and l.color.id(prop.color) then 59 59 c = prop.color:readable(0.6, 1.0) ................................................................................ 65 65 66 66 str = str .. '\n ' .. c:fmt('* ') 67 67 68 68 if prop.title then 69 69 str = str .. c:brighten(1.2):fmt(prop.title) .. ': ' 70 70 end 71 71 72 - local lines = minetest.wrap_text(prop.desc, 55, true) 72 + local lines = core.wrap_text(prop.desc, 55, true) 73 73 str = str .. c:fmt(lines[1]) 74 74 for i=2,#lines do 75 75 str = str .. '\n' .. string.rep(' ',5) .. c:fmt(lines[i]) 76 76 end 77 77 end 78 78 end 79 79 return color:darken(0.8):bg(str) 80 80 end; 81 81 end; 82 82 }
Modified starlit.ct from [ee106030ea] to [f4a136801c].
42 42 ~~~ 43 43 $ curl https://c.hale.su/starlit/tarball/starlit.tar.gz | tar x 44 44 $ curl https://c.hale.su/starlit/uv/asset.cpxz | xzcat | cpio -i 45 45 ~~~ 46 46 eventually i might make proper release tarballs available that bundle the game and assets together, but the game isn't stable enough to do that yet. 47 47 48 48 ## engine 49 -starlit is developed against a bleeding-edge version of minetest. it definitely won't work with anything older than v5.7, and ideally you should build directly from master. 49 +starlit is developed against a bleeding-edge version of Luanti. it definitely won't work with anything older than v5.7, and ideally you should build directly from master. 50 50 51 -starlit is best used with a patched version of minetest, though it is compatible with vanilla. the recommended patches are: 51 +starlit is best used with a patched version of Luanti, though it is compatible with vanilla. the recommended patches are: 52 52 53 53 * [>p11143 11143] - fix third-person view orientation 54 54 55 55 p11143: https://github.com/minetest/minetest/pull/11143.diff 56 56 57 57 ### shadows 58 -i was delighted to see dynamic shadows land in minetest, and i hope the implementation will eventually mature. however, as it stands, there are severe issues with shadows that make them essentially incompatible with complex meshes like the Starlit player character meshes. for the sake of those who don't mind these glitches, Starlit does enable shadows, but i unfortunately have to recommend that you disable them until the minetest devs get their act together on this feature. 58 +i was delighted to see dynamic shadows land in Luanti, and i hope the implementation will eventually mature. however, as it stands, there are severe issues with shadows that make them essentially incompatible with complex meshes like the Starlit player character meshes. for the sake of those who don't mind these glitches, Starlit does enable shadows, but i unfortunately have to recommend that you disable them until the Luanti devs get their act together on this feature. 59 59 60 60 ## gameplay 61 -starlit is somewhat unusual in how it uses the minetest engine. it's a voxel game but not of the minecraft variety. you do have some control over your environment, but it's limited and exerting it is much more expensive than you might be used to -- the focus of the game is figuring out how to work with nature, not against it. Farthest Shadow has little patience for those who do not show her the respect a living world is due, and she is unconcerned with human virtues like "mercy" or "fairness" or "proportionate retribution". 61 +starlit is somewhat unusual in how it uses the Luanti engine. it's a voxel game but not of the minecraft variety. you do have some control over your environment, but it's limited and exerting it is much more expensive than you might be used to -- the focus of the game is figuring out how to work with nature, not against it. Farthest Shadow has little patience for those who do not show her the respect a living world is due, and she is unconcerned with human virtues like "mercy" or "fairness" or "proportionate retribution". 62 62 63 63 this is to say, starlit is [*mean], by design. 64 64 65 65 * chance plays an important role. your escape pod might land in the midst of a lush, temperate forest with plenty of nearby shipwrecks to scavenge. or it might land in the exact geographic center of a vast, harsh desert that your suit's cooling systems can't protect you from, ten klicks from anything of value. "unfair", you say? tough. Farthest Shadow doesn't care about your feelings. 66 66 * death is much worse than a slap on the wrist. when you die, you drop your possessions and your suit, and respawn naked at your spawn point. this is a serious danger, as you might be kilometers away from your spawn point -- and there's no guarantee someone else won't take your suit before you can find your way back to it. good luck crossing long distances without climate control! if you haven't carefully prepared for this eventuality by keeping a spare suit by your spawn point, death can be devastating, to the point of making the game unsurvivable without another player's help. 67 67 68 68 ### scenarios 69 -your starting character configuration depends on the scenario you select. (right now this is configured in minetest settings, which is intensely awkward, but i don't have a better solution). the scenario controls your species, sex, and starting inventory. [*neither species nor sex is cosmetic]; e.g. human females are physically weaker but psionically stronger than males. the current playable scenarios are: 69 +your starting character configuration depends on the scenario you select. (right now this is configured in Luanti settings, which is intensely awkward, but i don't have a better solution). the scenario controls your species, sex, and starting inventory. [*neither species nor sex is cosmetic]; e.g. human females are physically weaker but psionically stronger than males. the current playable scenarios are: 70 70 71 71 #### Imperial Expat 72 72 [*phenotype]: human female 73 73 [*starting gear]: Commune survival kit 74 74 > Hoping to escape a miserable life deep in the grinding gears of the capitalist machine for the bracing freedom of the frontier, you sought entry as a colonist to the new Commune world of Thousand Petal. Fate -- which is to say, terrorists -- intervened, and you wound up stranded on Farthest Shadow with little more than the nanosuit on your back, ship blown to tatters and your soul thoroughly mauled by the explosion of a twisted alien artifact -- which SOMEONE neglected to inform you your ride would be carrying. 75 75 > At least you got some handy psionic powers out of this whole clusterfuck. Hopefully they're safe to use. 76 76 ................................................................................ 159 159 a Ritual is triggered directly from the psionics menu. as the name implies, these are complex, powerful abilities that require large amounts of Psi and time to meditate before they trigger, and any interruption will cancel the ability (though it will not restore any lost psi). the most famous Ritual is of course Conjoin Metric, which Starlit astropaths use in conjunction with powerful amplifiers to perform long-distance FTL jumps -- but without centuries of dedication to the art, the best you can hope for if you manage to learn this storied power is to move yourself a few kilometers. 160 160 161 161 a Contextual ability is triggered in a specific situation, usually by interacting with a certain kind of object. Contextual abilities often require specialized equipment, to the point that many Starlit practitioners maintain their own Psionics Lab. 162 162 163 163 ## legal 164 164 starlit source code (*.lua, *.conf, *.txt, *.csd files) is released under the GNU AGPLv3. 165 165 assets (images, sounds, models, and anything else in the repo that doesn't qualify as source code) are released under the CC-BY-NC-SA 3.0 license. 166 -sound files with the prefix `default-` are taken from Minetest Game, whose assets are available under the CC-BY-SA 3.0 license. 166 +sound files with the prefix `default-` are taken from Luanti Game, whose assets are available under the CC-BY-SA 3.0 license.