sorcery  Check-in [65759dbfde]

Overview
Comment:updates
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 65759dbfde9defcb84d6999c9836b777cbdaa996403529e4cdcf87e18ba77cb0
User & Date: lexi on 2020-08-30 22:47:46
Other Links: manifest | tags
Context
2020-09-24
23:07
add blood god, add gravitator, add hand-drawn ore images, add mana hud display for enchanted items, various tweaks and enhancements check-in: f165d9e39f user: lexi tags: trunk
2020-08-30
22:47
updates check-in: 65759dbfde user: lexi tags: trunk
14:46
rename improperly namespaced files check-in: 76581a64d9 user: lexi tags: trunk
Changes

Modified compat.lua from [b94ab7bfcd] to [c2cb3e762c].

    32     32   else
    33     33   	minetest.register_craftitem('sorcery:ash', {
    34     34   		description = 'Ash';
    35     35   		inventory_image = 'sorcery_iron_powder.png^[colorize:#FFFFFF:100';
    36     36   	})
    37     37   	minetest.register_alias('new_campfire:ash', 'sorcery:ash')
    38     38   end
           39  +
           40  +-- xdecor offers a conflicting and somewhat poorly designed enchantment
           41  +-- mechanism; make it inaccessible but don't fuck up already existing
           42  +-- enchanters in the world
           43  +minetest.clear_craft { output='xdecor:enchanter'; }
    39     44   
    40     45   return {
    41     46   	defp = function(name)
    42     47   		return minetest.registered_items[name] or minetest.registered_aliases[name]
    43     48   	end;
    44     49   }

Modified displacer.lua from [54869bc440] to [e06af858b3].

   309    309   			on_construct = m.construct;
   310    310   			on_rightclick = mode ~= 'gem' and n.button or nil;
   311    311   			on_punch = n.button and function(pos,node,puncher)
   312    312   				if puncher and puncher:get_wielded_item():is_empty() then
   313    313   					n.button(pos)
   314    314   				end
   315    315   			end or nil;
   316         -			after_place_node = function(...) autoselect(...) end;
          316  +			after_place_node = function(...)
          317  +				autoselect(...)
          318  +				-- these are not ley devices but they still affect the
          319  +				-- energy consumption of the ley device they are attached
          320  +				-- to, so we need to manually run the notification routine
          321  +				-- when they are placed or dug
          322  +				sorcery.ley.notify(...)
          323  +			end;
   317    324   			allow_metadata_inventory_put = m.allowput;
   318    325   			_sorcery = {
   319    326   				attune = (mode == 'attune') and n.attune or nil;
   320    327   			};
   321    328   			after_dig_node = function(...)
   322    329   				autoselect(...)
   323    330   				sorcery.lib.node.purge_container(...)
          331  +				sorcery.lib.node.notifyneighbors(...)
   324    332   			end;
   325    333   			groups = {
   326    334   				cracky = 2;
   327    335   				sorcery_magitech = 1;
   328    336   			};
   329    337   		})
   330    338   	end
   331    339   end

Modified enchanter.lua from [cca22cad27] to [59f5727496].

   301    301   for i=1,10 do
   302    302   	minetest.register_node('sorcery:air_flash_' .. i, {
   303    303   		drawtype = 'airlike';
   304    304   		pointable = false; walkable = false;
   305    305   		buildable_to = true;
   306    306   		sunlight_propagates = true;
   307    307   		light_source = i + 4;
          308  +		groups = {
          309  +			air = 1, sorcery_air = 1;
          310  +			not_in_creative_inventory = 1;
          311  +		};
   308    312   		on_construct = function(pos)
   309    313   			minetest.get_node_timer(pos):start(0.05)
   310    314   		end;
   311    315   		on_timer = function(pos)
   312    316   			if i <= 2 then minetest.remove_node(pos) else
   313    317   				minetest.set_node(pos, {name='sorcery:air_flash_1'})
   314    318   				return true
................................................................................
   416    420   	else
   417    421   		sorcery.enchant.set(tool,ench,true)
   418    422   	end
   419    423   	puncher:set_wielded_item(tool)
   420    424   
   421    425   	-- perform leyline checks and call notify if necessary
   422    426   	if minetest.get_item_group(node.name, 'sorcery_ley_device') ~= 0 then
   423         -		for _,p in pairs(sorcery.ley.txofs) do
   424         -			local sum = vector.add(pos,p)
   425         -			if minetest.get_item_group(minetest.get_node(sum).name, 'sorcery_ley_device') ~= 0 then
   426         -				sorcery.ley.notify(sum)
   427         -			end
   428         -		end
          427  +		sorcery.lib.node.notifyneighbors(pos)
   429    428   	end
   430    429   end)
   431    430   
   432    431   minetest.register_chatcommand('enchants', {
   433    432   	description = 'Log information about the currently held object\'s enchantment';
   434    433   	privs = { server = true };
   435    434   	func = function(caller,params)

Modified lib/node.lua from [ea0569acf8] to [3ae145b117].

    88     88   				end
    89     89   			end
    90     90   			checked[#checked+1] = pos
    91     91   			i = i + 1
    92     92   		until i > #stack
    93     93   		return nodes, positions
    94     94   	end;
           95  +
           96  +	forneighbor = function(pos, n, fn)
           97  +		for _,p in pairs(n) do
           98  +			local sum = vector.add(pos, p)
           99  +			fn(sum, minetest.get_node(sum))
          100  +		end
          101  +	end;
          102  +
          103  +	-- when items have already been removed; notify cannot be relied on
          104  +	-- to reach the entire network; this function accounts for the gap
          105  +	notifyneighbors = function(pos)
          106  +		sorcery.lib.node.forneighbor(pos, sorcery.ley.txofs, function(pos,node)
          107  +			if minetest.get_item_group(node.name,'sorcery_ley_device') ~= 0 then
          108  +				sorcery.ley.notify(sum)
          109  +			end
          110  +		end)
          111  +	end;
          112  +
          113  +	blockpos = function(pos)
          114  +		return {
          115  +			x = math.floor(pos.x / 16);
          116  +			y = math.floor(pos.y / 16);
          117  +			z = math.floor(pos.z / 16);
          118  +		}
          119  +	end;
          120  +
          121  +	preload = function(pos, user)
          122  +		minetest.load_area(pos)
          123  +		user:send_mapblock(sorcery.lib.node.blockpos(pos))
          124  +	end;
    95    125   }

Modified portal.lua from [2352fa593a] to [5fb5b13994].

   212    212   
   213    213   local portal_destination_evaluate = function(circuit,pos)
   214    214   	-- evaluation of the local network occurs before this function
   215    215   	-- is ever even called, so we only need to worry about the
   216    216   	-- farcaster-related transmission costs
   217    217   	for i,c in pairs(circuit) do
   218    218   		if vector.equals(c.pos,pos) then
   219         -			print('found destination in circuit table',i,dump(c))
   220    219   			-- the destination is listed in the circuit table
   221    220   			for j,r in pairs(c.route) do
   222    221   				local nc = sorcery.ley.netcaps(pos,1)
   223         -				print('checking route for sufficient energy to power farcasters', j, nc.freepower)
          222  +				-- print('checking route for sufficient energy to power farcasters', j, nc.freepower)
   224    223   				if nc.freepower < constants.portal_jump_cost_per_farcaster then
   225    224   					return false -- only one route to any given portal node
   226    225   					-- will be listed in the circuit table, so bail early
   227    226   					-- maybe in the future farcasters should charge up,
   228    227   					-- and power should be deducted when they are used?
   229    228   				end
   230    229   			end
................................................................................
   234    233   		end
   235    234   	end
   236    235   	return false
   237    236   end
   238    237   
   239    238   local portal_pick_destination = function(dev,circuit,partner)
   240    239   	if partner then
   241         -		print('paired: evaluating partner')
   242    240   		if portal_destination_evaluate(circuit,partner)
   243    241   			then return partner end
   244         -		print('partner failed eval')
   245    242   	end
   246    243   
   247    244   	local scrambled = sorcery.lib.tbl.scramble(circuit)
   248    245   	for i=1,#scrambled do
   249         -		print('evaluating destination',i,dump(scrambled[i]))
   250    246   		if portal_destination_evaluate(circuit,scrambled[i].pos)
   251    247   			then return scrambled[i].pos end
   252         -		print('eval failed')
   253    248   	end
   254         -	print('no viable destinations in net')
   255    249   end
   256    250   
   257    251   -- minetest.register_lbm {
   258    252   -- 	name = 'sorcery:activate_portals';
   259    253   -- 	label = 'activate portals';
   260    254   -- 	run_at_every_load = true;
   261    255   -- 	nodenames = { 'sorcery:portal_node' };
................................................................................
   292    286   					partner = tune.partner
   293    287   					break
   294    288   				end
   295    289   			end
   296    290   		end
   297    291   
   298    292   		if cap.self.minpower ~= cap.self.powerdraw then
   299         -			print("not enough power")
          293  +			-- print("not enough power")
   300    294   			return true
   301    295   		end
   302    296   
   303    297   		-- clean out user table
   304    298   		for name,user in pairs(portal_context.users) do
   305    299   			if user and vector.equals(user.portal, pos) then
   306    300   				local found = false
................................................................................
   327    321   						user.time = 0
   328    322   						user.portal = pos
   329    323   					end
   330    324   					local cap = sorcery.ley.netcaps(pos,delta)
   331    325   					local jc = (constants.portal_jump_cost_local*delta)
   332    326   					if not user.dest and cap.freepower >= jc  then
   333    327   						user.dest = portal_pick_destination(dev,crc,partner)
          328  +						sorcery.lib.node.preload(user.dest, u.object)
   334    329   					end
   335         -					if not user.dest then goto skippad else
   336         -						minetest.load_area(user.dest)
   337         -					end
          330  +					if not user.dest then goto skippad end
   338    331   					local fac = (user.time / constants.portal_jump_time);
   339    332   					minetest.add_particlespawner {
   340    333   						time = 1, amount = 100 + (fac * 200);
   341    334   						minsize = 0.2 + fac*0.7, maxsize = 0.4 + fac*0.9;
   342    335   						minvel = {y = 0.2, x=0,z=0}, maxvel = {y = 0.5, x=0,z=0};
   343    336   						minacc = {y = 0.0, x=0,z=0}, maxacc = {y = 0.3, x=0,z=0};
   344    337   						minpos = vector.add(n.pad,{x = -0.5, y = 0.5, z = -0.5});

Modified potions.lua from [f457c3868d] to [bf24fbd87b].

    38     38   		sounds = default.node_sound_glass_defaults();
    39     39   	}
    40     40   	if extra then for k,v in pairs(extra) do node[k] = v end end
    41     41   	if not node.groups then node.groups = {} end
    42     42   	node.groups.dig_immediate = 3;
    43     43   	node.groups.attached_node = 1;
    44     44   	node.groups.vessel = 1;
           45  +	node.groups.not_in_creative_inventory = 1;
    45     46   	minetest.register_node("sorcery:"..name, node)
    46     47   end
    47     48   
    48     49   sorcery.register_oil = function(name,label,desc,color,imgvariant,extra)
    49     50   	local image = 'xdecor_bowl.png^(sorcery_oil_' .. (imgvariant or 'dull') .. '.png^[colorize:'..tostring(color)..':140)'
    50     51   	sorcery.data.register.infusion_leftover('sorcery:' .. name, 'xdecor:bowl')
    51     52   	extra.description = label;

Modified tnodes.lua from [a23f444ae8] to [1f5f95dd4b].

     3      3   		drawtype = 'airlike';
     4      4   		light_source = 5 + math.ceil(i * (11/minetest.LIGHT_MAX));
     5      5   		sunlight_propagates = true;
     6      6   		buildable_to = true;
     7      7   		pointable = false;
     8      8   		walkable = false;
     9      9   		floodable = true;
    10         -		groups = { air = 1; sorcery_air = 1; };
           10  +		groups = { air = 1; sorcery_air = 1; not_in_creative_inventory = 1; };
    11     11   		on_construct = function(pos)
    12     12   			local meta = minetest.get_meta(pos)
    13     13   			meta:set_float('duration',10)
    14     14   			meta:set_float('timeleft',10)
    15     15   			meta:set_int('power',minetest.LIGHT_MAX)
    16     16   			minetest.get_node_timer(pos):start(1)
    17     17   		end;

Modified wands.lua from [4ea63112cb] to [54442c247e].

   408    408   			title = sorcery.wands.util.basename(kind);
   409    409   			desc = sorcery.wands.util.basedesc(kind);
   410    410   		};
   411    411   		inventory_image = basis.img.whole:render();
   412    412   		groups = {
   413    413   			tool = 1;
   414    414   			sorcery_wand = 1;
          415  +			not_in_creative_inventory = 1;
   415    416   		};
   416    417   		node_dig_prediction = "";
   417    418   		on_use = wand_cast;
   418    419   		on_secondary_use = function(stack,user,target)
   419    420   			return wand_cast(stack,user,nil)
   420    421   		end;
   421    422   		-- on_place if we need to use rightclick