starlit  Diff

Differences From Artifact [ae90c8058c]:

To Artifact [ae88cd06e3]:


92
93
94
95
96
97
98

99
100
101
102
103
104
105
...
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473










474
475
476
477
478
479
480
481
482

483
484
485
486
487
488
489
490
			trees = lib.registry.mk 'starlit:trees';
			biomes = lib.registry.mk 'starlit:biome';
		};
		climate = {
			weather = lib.registry.mk 'starlit:weather';
			weatherMap = {}
		};

		scenario = {};
		planet = {
			gravity = 7.44;
			orbit = 189; -- 1 year is 189 days
			revolve = 20; -- 1 day is 20 irl minutes
		};
		fact = lib.registry.mk 'starlit:fact';
................................................................................
		-- of the default hp_max. since we crank up
		-- hp by a factor of 50~40, damage should be
		-- cranked by similarly
	end
	return delta
end, true)

function core.handle_node_drops(pos, drops, digger)
	local function jitter(pos)
		local function r(x) return x+math.random(-0.01, 0.01) end
		return vector.new(
			r(pos.x),
			r(pos.y),
			r(pos.z)
		)
	end










	for i, it in ipairs(drops) do
		if type(it) == 'string' then it = ItemStack(it) end
		if not it:is_empty() then
			local ent = core.add_item(jitter(pos), it)
			if ent ~= nil then -- avoid crash when dropping unknown item
				local dp = vector.new(0,0,0)
				if digger then dp = digger:get_pos() end
				local delta = dp - ent:get_pos()
				ent:add_velocity(vector.new(delta.x,0,delta.z));

			end
		end
	end
end


-- TODO timer iterates live UI








>







 







<
|







>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
>





<
|

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
...
459
460
461
462
463
464
465

466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498

499
500
			trees = lib.registry.mk 'starlit:trees';
			biomes = lib.registry.mk 'starlit:biome';
		};
		climate = {
			weather = lib.registry.mk 'starlit:weather';
			weatherMap = {}
		};
		psi = lib.registry.mk 'starlit:psi';
		scenario = {};
		planet = {
			gravity = 7.44;
			orbit = 189; -- 1 year is 189 days
			revolve = 20; -- 1 day is 20 irl minutes
		};
		fact = lib.registry.mk 'starlit:fact';
................................................................................
		-- of the default hp_max. since we crank up
		-- hp by a factor of 50~40, damage should be
		-- cranked by similarly
	end
	return delta
end, true)


do local function jitter(pos)
		local function r(x) return x+math.random(-0.01, 0.01) end
		return vector.new(
			r(pos.x),
			r(pos.y),
			r(pos.z)
		)
	end

	function starlit.throwItem(luser, stack)
			local ent = core.add_item(jitter(luser:get_pos()), stack)
			a = luser:get_look_dir()
			a = a * math.random(1, 10);
			a.y = a.y + 0.5
			ent:add_velocity(a)
	end

	function core.handle_node_drops(pos, drops, digger)
		for i, it in ipairs(drops) do
			if type(it) == 'string' then it = ItemStack(it) end
			if not it:is_empty() then
				local ent = core.add_item(jitter(pos), it)
				if ent ~= nil then -- avoid crash when dropping unknown item
					local dp = vector.new(0,0,0)
					if digger then dp = digger:get_pos() end
					local delta = dp - ent:get_pos()
					ent:add_velocity(vector.new(delta.x,0,delta.z));
				end
			end
		end
	end
end


	-- TODO timer iterates live UI