starlit  Diff

Differences From Artifact [ae90c8058c]:

To Artifact [ae88cd06e3]:


    92     92   			trees = lib.registry.mk 'starlit:trees';
    93     93   			biomes = lib.registry.mk 'starlit:biome';
    94     94   		};
    95     95   		climate = {
    96     96   			weather = lib.registry.mk 'starlit:weather';
    97     97   			weatherMap = {}
    98     98   		};
           99  +		psi = lib.registry.mk 'starlit:psi';
    99    100   		scenario = {};
   100    101   		planet = {
   101    102   			gravity = 7.44;
   102    103   			orbit = 189; -- 1 year is 189 days
   103    104   			revolve = 20; -- 1 day is 20 irl minutes
   104    105   		};
   105    106   		fact = lib.registry.mk 'starlit:fact';
................................................................................
   458    459   		-- of the default hp_max. since we crank up
   459    460   		-- hp by a factor of 50~40, damage should be
   460    461   		-- cranked by similarly
   461    462   	end
   462    463   	return delta
   463    464   end, true)
   464    465   
   465         -function core.handle_node_drops(pos, drops, digger)
   466         -	local function jitter(pos)
          466  +do 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         -	for i, it in ipairs(drops) do
   475         -		if type(it) == 'string' then it = ItemStack(it) end
   476         -		if not it:is_empty() then
   477         -			local ent = core.add_item(jitter(pos), it)
   478         -			if ent ~= nil then -- avoid crash when dropping unknown item
   479         -				local dp = vector.new(0,0,0)
   480         -				if digger then dp = digger:get_pos() end
   481         -				local delta = dp - ent:get_pos()
   482         -				ent:add_velocity(vector.new(delta.x,0,delta.z));
          474  +
          475  +	function starlit.throwItem(luser, stack)
          476  +			local ent = core.add_item(jitter(luser:get_pos()), stack)
          477  +			a = luser:get_look_dir()
          478  +			a = a * math.random(1, 10);
          479  +			a.y = a.y + 0.5
          480  +			ent:add_velocity(a)
          481  +	end
          482  +
          483  +	function core.handle_node_drops(pos, drops, digger)
          484  +		for i, it in ipairs(drops) do
          485  +			if type(it) == 'string' then it = ItemStack(it) end
          486  +			if not it:is_empty() then
          487  +				local ent = core.add_item(jitter(pos), it)
          488  +				if ent ~= nil then -- avoid crash when dropping unknown item
          489  +					local dp = vector.new(0,0,0)
          490  +					if digger then dp = digger:get_pos() end
          491  +					local delta = dp - ent:get_pos()
          492  +					ent:add_velocity(vector.new(delta.x,0,delta.z));
          493  +				end
   483    494   			end
   484    495   		end
   485    496   	end
   486    497   end
   487    498   
   488         -
   489         --- TODO timer iterates live UI
          499  +	-- TODO timer iterates live UI
   490    500