Overview
Comment: | make proper keg recipe canonical |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3f5aae21c084c8e2117fc06c1cd6069f |
User & Date: | lexi on 2021-07-10 21:15:56 |
Other Links: | manifest | tags |
Context
2021-07-10
| ||
21:18 | fix dumbass typo check-in: cf762654b2 user: lexi tags: trunk | |
21:15 | make proper keg recipe canonical check-in: 3f5aae21c0 user: lexi tags: trunk | |
21:15 | add defensive check against recipes that change types check-in: 5386806605 user: lexi tags: trunk | |
Changes
Modified cookbook.lua from [207e1d6da6] to [3a273fe491].
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
local props = minetest.registered_items[ItemStack(item):get_name()]._sorcery if props and props.recipe then return props.recipe end return {} end local modofname = function(id) local item = minetest.registered_nodes[id] if item == nil or item.mod_origin == '??' or not item.mod_origin then local sep = string.find(id,':') if sep == nil then return nil end -- uh oh return string.sub(id, 1, sep - 1) end return item.mod_origin end ................................................................................ return false end end local props = minetest.registered_items[name]._sorcery local module = modofname(name) return not (excluded or sorcery.lib.tbl.has(constants.blacklist_mods,module) or (props and props.recipe and props.recipe.secret) or (restrict and ( (restrict.pred and restrict.pred { mod = module, item = name, props = props } ~= true) or (restrict.mod and module ~= restrict.mod) or (restrict.group and (minetest.get_item_group(name, restrict.group) == 0)) |
|
|
|
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
local props = minetest.registered_items[ItemStack(item):get_name()]._sorcery if props and props.recipe then return props.recipe end return {} end local modofname = function(id) local item = minetest.registered_items[id] if item == nil or item.mod_origin == '??' or not item.mod_origin then local sep = string.find(id,':') if sep == nil then return nil end -- uh oh return string.sub(id, 1, sep - 1) end return item.mod_origin end ................................................................................ return false end end local props = minetest.registered_items[name]._sorcery local module = modofname(name) return not ( sorcery.lib.tbl.has(constants.blacklist_mods,module) or (props and props.recipe and props.recipe.secret) or (restrict and ( (restrict.pred and restrict.pred { mod = module, item = name, props = props } ~= true) or (restrict.mod and module ~= restrict.mod) or (restrict.group and (minetest.get_item_group(name, restrict.group) == 0)) |
Modified keg.lua from [f0cb8863c3] to [09c523dc33].
1 2 3 4 5 6 7 8 9 .. 46 47 48 49 50 51 52 53 54 55 56 57 58 59 ... 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
local constants = { keg_volume = sorcery.liquid.constants.glasses_per_bottle * 600 } local hitbox = function(yo) return { type = 'fixed'; fixed = { -0.4, -0.5 + yo, -0.45; 0.4, 0.2 + yo, 0.5; ................................................................................ tiles = { 'default_bronze_block.png'; 'default_wood.png'; 'default_steel_block.png'; }; selection_box = hitbox(keg.ofs or 0); collision_box = keg.cb or hitbox(keg.ofs or 0); drop = { -- preserve_metadata will not work without this! max_items = 1; items = { { items = { keg.id } }; }; }; ................................................................................ replacements = { {'screwdriver:screwdriver', 'screwdriver:screwdriver'}; }; } minetest.register_craft { output = "sorcery:keg_stand"; recipe = { {'','sorcery:keg',''}; {'sorcery:screw_steel','group:wood','sorcery:screw_steel'}; {'sorcery:screw_steel','screwdriver:screwdriver','sorcery:screw_steel'}; }; replacements = {{'screwdriver:screwdriver', 'screwdriver:screwdriver'}}; } minetest.register_craft { output = "sorcery:keg"; type = 'shapeless'; recipe = { 'sorcery:keg_stand', 'screwdriver:screwdriver' }; replacements = { {'screwdriver:screwdriver', 'screwdriver:screwdriver'}; {'sorcery:keg_stand', 'sorcery:screw_steel 4'}; }; } |
> > > > > > > > > > | < < < < |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 .. 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ... 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
local constants = { keg_volume = sorcery.liquid.constants.glasses_per_bottle * 600 keg_recipe = { {'','sorcery:keg',''}; {'sorcery:screw_steel','group:wood','sorcery:screw_steel'}; {'sorcery:screw_steel','screwdriver:screwdriver','sorcery:screw_steel'}; }; } local hitbox = function(yo) return { type = 'fixed'; fixed = { -0.4, -0.5 + yo, -0.45; 0.4, 0.2 + yo, 0.5; ................................................................................ tiles = { 'default_bronze_block.png'; 'default_wood.png'; 'default_steel_block.png'; }; selection_box = hitbox(keg.ofs or 0); collision_box = keg.cb or hitbox(keg.ofs or 0); _sorcery = { recipe = { canonical = constants.keg_recipe; }; }; drop = { -- preserve_metadata will not work without this! max_items = 1; items = { { items = { keg.id } }; }; }; ................................................................................ replacements = { {'screwdriver:screwdriver', 'screwdriver:screwdriver'}; }; } minetest.register_craft { output = "sorcery:keg_stand"; recipe = constants.keg_recipe; replacements = {{'screwdriver:screwdriver', 'screwdriver:screwdriver'}}; } minetest.register_craft { output = "sorcery:keg"; type = 'shapeless'; recipe = { 'sorcery:keg_stand', 'screwdriver:screwdriver' }; replacements = { {'screwdriver:screwdriver', 'screwdriver:screwdriver'}; {'sorcery:keg_stand', 'sorcery:screw_steel 4'}; }; } |