Comment: | bug fixes, add disc textures, get lathe fully operational finally |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
efb9d9d1b9b3db57153e03dc9b01ef33 |
User & Date: | lexi on 2021-07-08 17:06:16 |
Other Links: | manifest | tags |
2021-07-08
| ||
21:52 | add tree lathe recipes check-in: 56a2b90c1b user: lexi tags: trunk | |
17:06 | bug fixes, add disc textures, get lathe fully operational finally check-in: efb9d9d1b9 user: lexi tags: trunk | |
14:32 | bug fixes, improve disc texture, improve recipes, you can now pour blood directly into a trough when you draw it with a consecrated dagger check-in: a66c0f02c7 user: lexi tags: trunk | |
Modified lathe.lua from [f27b9cba36] to [75f9e0d88f].
31 31 local R = sorcery.lathe.recipes 32 32 sorcery.lathe.get = function(pos,idx,howmany) 33 33 local inv = minetest.get_meta(pos):get_inventory() 34 34 local tool = inv:get_stack('tool',1) 35 35 local tech = sorcery.lathe.tooltech(tool) 36 36 if not tech then return nil end 37 37 local wkpc = inv:get_stack('workpiece',1) 38 - howmany = howmany or wkpc:get_count() 39 38 local rec = R[wkpc:get_name()][tech][idx] 40 39 local outn = ItemStack(rec.output):get_count() 41 - local ntimes = math.floor(howmany / (rec.mass or 1)) 40 + howmany = howmany or math.floor(wkpc:get_count()/(rec.mass or 1))*outn 41 + local ntimes = math.floor(howmany / outn) 42 + 43 + local tmat = sorcery.itemclass.get(tool,'material') 44 + local wmat = sorcery.itemclass.get(wkpc,'material') 45 + local dur = 100 46 + local lfac = 1 47 + if tmat then 48 + local dur = tmat.data.durability or dur 49 + lfac = (wmat and wmat.data.level or 1) / 50 + (tmat.data.maxlevel or tmat.data.level or 1) 51 + end 52 + local ch = 65535 / dur 53 + local wear = 2 * (ch * rec.cost * ntimes * lfac); 42 54 return { 43 55 tool = tool, wkpc = wkpc; 44 56 cost = rec.cost * ntimes; 57 + wear = wear; 45 58 ntimes = ntimes; 46 - tqty = math.floor(howmany / outn) * (rec.mass or 1), outn = outn; 47 - gqty = ntimes * outn; 59 + tqty = ntimes * (rec.mass or 1), outn = outn; 48 60 tech = tech; 49 61 rec = rec; 50 62 inv = inv; 51 63 } 52 64 end 53 65 54 66 sorcery.lathe.update = function(pos) ................................................................................ 75 87 local rec = R[wkpc:get_name()][tech] 76 88 tech = sorcery.lathe.techs[tech] 77 89 78 90 -- fill in the preview slots 79 91 local j = 1 80 92 for i=1, inv:get_size 'preview' do 81 93 local stk = ItemStack() 82 - if rec[i] and minetest.registered_items[ItemStack(rec[i].output):get_name()] and (rec[i].mass == nil or rec[i].mass <= wkpc:get_count()) then 83 - local l = sorcery.lathe.get(pos, i, wkpc:get_count()) 84 - local max = l.ntimes --math.floor(wkpc:get_count() / (rec[i].mass or 1)) 94 + local os = rec[i] and ItemStack(rec[i].output) 95 + if rec[i] and minetest.registered_items[os:get_name()] and (rec[i].mass == nil or rec[i].mass <= wkpc:get_count()) then 96 + local l = sorcery.lathe.get(pos, i) 97 + local max = l.ntimes 98 + --math.floor(wkpc:get_count() / (rec[i].mass or 1)) 85 99 if tech.dmg then 86 - -- TODO count remaining tool uses 100 + local lw = l.wear 101 + while lw + tool:get_wear() > 65535 do 102 + max = max - 1 103 + if max == 0 then break end 104 + lw = sorcery.lathe.get(pos, i, max).wear 105 + end 87 106 elseif tech.consume then 88 107 max = math.min(max, tool:get_count()) 89 108 end 90 109 if max > 0 then 91 110 stk = ItemStack(rec[i].output) 92 - stk:set_count(stk:get_count() * max) 111 + local ct = math.min(stk:get_count() * max, stk:get_stack_max()) 112 + ct = ct - (ct % os:get_count()) 113 + stk:set_count(ct) 93 114 end 94 115 end 95 116 inv:set_stack('preview',i,stk) 96 117 j = j + 1 97 118 end 98 119 99 120 -- make sure remaining slots are clear ................................................................................ 130 151 local m = minetest.get_meta(pos) 131 152 local i = m:get_inventory() 132 153 i:set_size('workpiece', 1); 133 154 i:set_size('tool', 1); 134 155 i:set_size('preview', 8); 135 156 m:set_string('formspec', [[ 136 157 formspec_version[3] size[10.25,8] 137 - list[context;tool;1.50,1;1,1] 138 - list[context;workpiece;3,1;1,1] 158 + list[context;tool;1.25,1;1,1] 159 + list[context;workpiece;2.75,1;1,1] 139 160 list[context;preview;5.25,0.25;4,2] 140 161 list[current_player;main;0.25,3;8,4] 141 162 142 163 listring[current_player;main] listring[context;workpiece] 143 164 listring[current_player;main] listring[context;tool] 144 165 listring[current_player;main] listring[context;preview] 145 166 listring[current_player;main] ................................................................................ 178 199 on_metadata_inventory_put = sorcery.lathe.update; 179 200 on_metadata_inventory_take = function(pos, list, idx, stack, user) 180 201 if list == 'preview' then 181 202 local l = sorcery.lathe.get(pos,idx,stack:get_count()) 182 203 if sorcery.lathe.techs[l.tech].consume then 183 204 l.tool:take_item(l.cost) 184 205 elseif sorcery.lathe.techs[l.tech].dmg then 185 - local mat = sorcery.itemclass.get(l.tool,'material') 186 - local mmat = sorcery.itemclass.get(l.wkpc,'metal') 187 - local dur = 100 188 - local lfac = 1 189 - if mat then 190 - local dur = mat.data.durability or dur 191 - lfac = (mmat and mmat.data.level or 1) / 192 - (mat.data.maxlevel or mat.data.level or 1) 193 - end 194 - local ch = 65535 / dur 195 - l.tool:add_wear(ch * l.cost * lfac) 206 + l.tool:add_wear(l.wear) 196 207 end 197 208 l.wkpc:take_item(l.tqty) 198 209 l.inv:set_stack('tool', 1, l.tool) 199 210 l.inv:set_stack('workpiece', 1, l.wkpc) 200 211 if l.rec.leftover then 201 212 sorcery.lib.node.insert(ItemStack(l.rec.leftover), 'workpiece', pos, user, l.inv) 202 213 end
Modified metal.lua from [43593523a3] to [69d743e332].
35 35 value = fragments_per_ingot; 36 36 }; 37 37 ['morelights_vintage:brass_block'] = { 38 38 id = 'brass'; data = sorcery.data.metals.brass; 39 39 value = fragments_per_ingot * 9; 40 40 }; 41 41 } 42 +local fmt = string.format 42 43 43 44 local tools, armors = sorcery.matreg.tools, sorcery.matreg.armors 44 45 -- for name, metal in pairs(sorcery.data.metals) do 45 46 sorcery.register.metals.foreach('sorcery:generate',{},function(name,metal) 46 47 local ingot = metal.ingot or 'sorcery:' .. name .. '_ingot' 47 48 local block = metal.block or 'sorcery:' .. name .. 'block' 48 49 local screw = 'sorcery:screw_' .. name ................................................................................ 94 95 grindcost = 2, grindvalue = 1; 95 96 value = 0.5; 96 97 }; 97 98 }; 98 99 }) 99 100 minetest.register_craftitem(disc, { 100 101 description = sorcery.lib.str.capitalize(name) .. ' Disc'; 101 - inventory_image = sorcery.lib.image('sorcery_disc.png'):multiply(sorcery.lib.color(metal.tone)):render(); 102 + inventory_image = fmt('sorcery_disc_%s.png', name); 102 103 groups = { metal = 1; sorcery_disc = 1; sorcery_tech_component = 1; }; 103 104 _sorcery = { 104 105 material = { 105 106 id = name, data = metal; 106 107 powder = powder; 107 108 grindvalue = (3*4) / 2; 108 109 value = 4 * (2/3);
Modified recipes.lua from [3da7013b08] to [f4ffdfcd69].
165 165 recipe = { 166 166 {'','sorcery:gem_emerald',''}; 167 167 {'',mtlp('silver','disc'),''}; 168 168 {'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'}; 169 169 }; 170 170 } 171 171 172 -print(dump{ 173 - output = 'sorcery:tuning_disc'; 174 - recipe = { 175 - {'','sorcery_gem:emerald',''}; 176 - {'',mtlp('silver','disc'),''}; 177 - {'sorcery:inverter_coil','sorcery:warding_plate','sorcery:inverter_coil'}; 178 - }; 179 -}) 180 - 181 172 minetest.register_craft { 182 173 output = 'sorcery:farcaster'; 183 174 recipe = { 184 175 {ingot('gold'),ingot('iridium'),ingot('gold')}; 185 176 {'sorcery:core_mandatic','default:diamondblock','sorcery:tuning_disc'}; 186 177 {ingot('gold'),ingot('iridium'),ingot('gold')}; 187 178 };
Added textures/sorcery_disc_aluminum.png version [256f4dd766].
cannot compute difference between binary files
Added textures/sorcery_disc_brass.png version [103517ac67].
cannot compute difference between binary files
Added textures/sorcery_disc_bronze.png version [ac125cbc55].
cannot compute difference between binary files
Added textures/sorcery_disc_cobalt.png version [f7bc51f3c8].
cannot compute difference between binary files
Added textures/sorcery_disc_copper.png version [bd262561de].
cannot compute difference between binary files
Added textures/sorcery_disc_draconium.png version [44d851abb6].
cannot compute difference between binary files
Added textures/sorcery_disc_duridium.png version [ebf16dfeb1].
cannot compute difference between binary files
Added textures/sorcery_disc_electrum.png version [837e29a879].
cannot compute difference between binary files
Added textures/sorcery_disc_eternium.png version [e3780ee115].
cannot compute difference between binary files
Added textures/sorcery_disc_gold.png version [a10cbf9395].
cannot compute difference between binary files
Added textures/sorcery_disc_impervium.png version [0d454327bd].
cannot compute difference between binary files
Added textures/sorcery_disc_iridium.png version [9a3e75045c].
cannot compute difference between binary files
Added textures/sorcery_disc_levitanium.png version [4130ad9b4d].
cannot compute difference between binary files
Added textures/sorcery_disc_lithium.png version [bc972a091c].
cannot compute difference between binary files
Added textures/sorcery_disc_platinum.png version [2263fac066].
cannot compute difference between binary files
Added textures/sorcery_disc_silver.png version [24263ad780].
cannot compute difference between binary files
Added textures/sorcery_disc_steel.png version [c212e5c1db].
cannot compute difference between binary files
Added textures/sorcery_disc_tin.png version [8bb0dbd577].
cannot compute difference between binary files
Added textures/sorcery_disc_tungsten.png version [bd340f51d3].
cannot compute difference between binary files
Added textures/sorcery_disc_tyrannium.png version [0c7ec910aa].
cannot compute difference between binary files
Added textures/sorcery_disc_unobtanium.png version [908a2781fc].
cannot compute difference between binary files
Added textures/sorcery_disc_vidrium.png version [61f07965e9].
cannot compute difference between binary files