Initial commit
This commit is contained in:
commit
df8714aa1d
171 changed files with 1686 additions and 0 deletions
52
mods/wisgame/open/disabled/open_air.lua
Normal file
52
mods/wisgame/open/disabled/open_air.lua
Normal file
|
@ -0,0 +1,52 @@
|
|||
local print = c.log
|
||||
local max_light=math.floor(minetest.LIGHT_MAX/2)
|
||||
print(max_light)
|
||||
local breakskybox = function()
|
||||
minetest.override_item(minetest.get_name_from_content_id(minetest.get_content_id(minetest.get_name_from_content_id(minetest.CONTENT_AIR))), {
|
||||
drawtype = "nodebox",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
light_source = max_light, --this breaks everything!
|
||||
|
||||
|
||||
use_texture_alpha = "opaque",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
sunlight_propagates = true,
|
||||
walkable = false,
|
||||
})
|
||||
end
|
||||
--print(minetest.LIGHT_MAX, max_light,0)
|
||||
local fixskybox = function()
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
core.fix_light(vector.new(-31000, -31000, -31000), vector.new(31000, 31000, 31000))
|
||||
end)
|
||||
local chunkSize = tonumber(minetest.settings:get("chunksize")) or 16
|
||||
local maxBlockSendDistance = tonumber(minetest.settings:get("max_block_send_distance")) or 10
|
||||
local maxRenderDistance = (chunkSize * ((maxBlockSendDistance * 2) * .25) )
|
||||
local deltaCount = 0
|
||||
local deltaLimit = 3
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
deltaCount = deltaCount + dtime
|
||||
print(deltaCount)
|
||||
if not (deltaCount >= deltaLimit) then
|
||||
return nil
|
||||
end
|
||||
deltaCount=deltaCount-deltaLimit
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local username = player:get_player_name()
|
||||
local userpos = player:get_pos()
|
||||
local currentuserchunk = vector.floor(vector.divide(userpos, maxRenderDistance))
|
||||
|
||||
local minp = vector.multiply(currentuserchunk, maxRenderDistance)
|
||||
local maxp = vector.add(minp, maxRenderDistance - 1)
|
||||
core.fix_light(vector.new(minp.x, minp.y, minp.z), vector.new(maxp.x, maxp.y, maxp.z))
|
||||
end
|
||||
end)
|
||||
|
||||
end
|
||||
breakskybox()
|
||||
fixskybox()
|
29
mods/wisgame/open/disabled/open_spread_abm.lua
Normal file
29
mods/wisgame/open/disabled/open_spread_abm.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
-- Function to spread grass to nearby dirt
|
||||
local function spread_grass(pos)
|
||||
-- Define the positions to check around the current position
|
||||
local positions = {
|
||||
{x = pos.x + 1, y = pos.y, z = pos.z},
|
||||
{x = pos.x - 1, y = pos.y, z = pos.z},
|
||||
{x = pos.x, y = pos.y, z = pos.z + 1},
|
||||
{x = pos.x, y = pos.y, z = pos.z - 1},
|
||||
{x = pos.x, y = pos.y + 1, z = pos.z},
|
||||
{x = pos.x, y = pos.y - 1, z = pos.z},
|
||||
}
|
||||
|
||||
for _, new_pos in ipairs(positions) do
|
||||
local node = minetest.get_node(new_pos)
|
||||
if node.name == "default:dirt" then
|
||||
minetest.set_node(new_pos, {name = "default:dirt_with_grass"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ABM (Active Block Modifier) to spread grass
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt_with_grass"},
|
||||
interval = 10, -- Time in seconds between ABM execution
|
||||
chance = 50, -- 1 in 50 chance for the ABM to run
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
spread_grass(pos)
|
||||
end,
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue