sorcery  Check-in [3f5aae21c0]

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: 3f5aae21c084c8e2117fc06c1cd6069fef263c3518ad438c46785891a5a2e872
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     49   	local props = minetest.registered_items[ItemStack(item):get_name()]._sorcery
    50     50   	if props and props.recipe then
    51     51   		return props.recipe
    52     52   	end
    53     53   	return {}
    54     54   end
    55     55   local modofname = function(id)
    56         -	local item = minetest.registered_nodes[id]
           56  +	local item = minetest.registered_items[id]
    57     57   	if item == nil or item.mod_origin == '??' or not item.mod_origin then
    58     58   		local sep = string.find(id,':')
    59     59   		if sep == nil then return nil end -- uh oh
    60     60   		return string.sub(id, 1, sep - 1)
    61     61   	end
    62     62   	return item.mod_origin
    63     63   end
................................................................................
    72     72   			return false
    73     73   		end
    74     74   	end
    75     75   
    76     76   	local props = minetest.registered_items[name]._sorcery
    77     77   	local module = modofname(name)
    78     78   
    79         -	return not (excluded
    80         -		or sorcery.lib.tbl.has(constants.blacklist_mods,module)
           79  +	return not (
           80  +		    sorcery.lib.tbl.has(constants.blacklist_mods,module)
    81     81   		or (props and props.recipe and props.recipe.secret)
    82     82   		or (restrict and (
    83     83   			(restrict.pred and restrict.pred {
    84     84   				mod = module, item = name, props = props
    85     85   			} ~= true)
    86     86   		 or (restrict.mod   and module ~= restrict.mod)
    87     87   		 or (restrict.group and (minetest.get_item_group(name, restrict.group) == 0))

Modified keg.lua from [f0cb8863c3] to [09c523dc33].

     1      1   local constants = {
     2      2   	keg_volume = sorcery.liquid.constants.glasses_per_bottle * 600
            3  +	keg_recipe = {
            4  +		{'','sorcery:keg',''};
            5  +		{'sorcery:screw_steel','group:wood','sorcery:screw_steel'};
            6  +		{'sorcery:screw_steel','screwdriver:screwdriver','sorcery:screw_steel'};
            7  +	};
     3      8   }
     4      9   
     5     10   local hitbox = function(yo) return {
     6     11   	type = 'fixed';
     7     12   	fixed = {
     8     13   		-0.4, -0.5 + yo, -0.45;
     9     14   		 0.4,  0.2 + yo,  0.5;
................................................................................
    46     51   		tiles = {
    47     52   			'default_bronze_block.png';
    48     53   			'default_wood.png';
    49     54   			'default_steel_block.png';
    50     55   		};
    51     56   		selection_box = hitbox(keg.ofs or 0);
    52     57   		collision_box = keg.cb or hitbox(keg.ofs or 0);
           58  +		_sorcery = {
           59  +			recipe = {
           60  +				canonical = constants.keg_recipe;
           61  +			};
           62  +		};
    53     63   		drop = {
    54     64   			-- preserve_metadata will not work without this!
    55     65   			max_items = 1;
    56     66   			items = {
    57     67   				{ items = { keg.id } };
    58     68   			};
    59     69   		};
................................................................................
   209    219   	replacements = {
   210    220   		{'screwdriver:screwdriver', 'screwdriver:screwdriver'};
   211    221   	};
   212    222   }
   213    223   
   214    224   minetest.register_craft {
   215    225   	output = "sorcery:keg_stand";
   216         -	recipe = {
   217         -		{'','sorcery:keg',''};
   218         -		{'sorcery:screw_steel','group:wood','sorcery:screw_steel'};
   219         -		{'sorcery:screw_steel','screwdriver:screwdriver','sorcery:screw_steel'};
   220         -	};
          226  +	recipe = constants.keg_recipe;
   221    227   	replacements = {{'screwdriver:screwdriver', 'screwdriver:screwdriver'}};
   222    228   }
   223    229   
   224    230   minetest.register_craft {
   225    231   	output = "sorcery:keg";
   226    232   	type = 'shapeless';
   227    233   	recipe = { 'sorcery:keg_stand', 'screwdriver:screwdriver' };
   228    234   	replacements = {
   229    235   		{'screwdriver:screwdriver', 'screwdriver:screwdriver'};
   230    236   		{'sorcery:keg_stand', 'sorcery:screw_steel 4'};
   231    237   	};
   232    238   }