Drehung der Kristalle gefixt

This commit is contained in:
N-Nachtigal 2025-05-21 00:34:29 +02:00
parent dfcf870d1b
commit df1276fb86
3 changed files with 49 additions and 34 deletions

View file

@ -1,5 +1,14 @@
caverealms = {} --create a container for functions and constants
local function table_contains(tbl, val)
for _, v in pairs(tbl) do
if v == val then
return true
end
end
return false
end
--grab a shorthand for the filepath of the mod
local modpath = minetest.get_modpath(minetest.get_current_modname())
--[[
@ -142,7 +151,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
local data = vm:get_data()
local paramzwei = minetest.dir_to_facedir(vector.new(0, 1, 0))
local vparam2 = vm:get_param2_data()
--grab content IDs
local c_air = minetest.get_content_id("air")
@ -160,6 +169,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_crystal = minetest.get_content_id("caverealms:glow_crystal")
local c_gem = minetest.get_content_id("caverealms:glow_gem")
local c_saltgem = minetest.get_content_id("caverealms:salt_gem")
print(c_saltgem)
local c_spike = minetest.get_content_id("caverealms:spike")
local c_moss = minetest.get_content_id("caverealms:stone_with_moss")
local c_lichen = minetest.get_content_id("caverealms:stone_with_lichen")
@ -205,6 +216,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_fakeice1 = minetest.get_content_id("too_many_stones:celestine_crystal")
local c_fakeice2 = minetest.get_content_id("too_many_stones:moonstone_crystal")
local c_fakeice3 = minetest.get_content_id("too_many_stones:quartz_crystal")
print(c_fakeice3)
--else
--end
@ -226,7 +238,22 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_redlant = minetest.get_content_id("everness:glowing_pillar")
local c_redplant = minetest.get_content_id("everness:bloodspore_plant")
--else
local erdkristall = {
c_torangecrys,
c_tredcrys,
c_fakesalt,
c_tyellocrys,
c_tsmokecrys,
c_tyellowcrys,
c_tgreen1crys,
c_tgreen2crys,
c_fakeice1,
c_fakeice2,
c_fakeice3,
c_crystcyan,
c_crystorange,
c_crystpurple,
} --else
--end
--herbs
@ -386,7 +413,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
c_flamepurple,
c_crystpurple,
c_bluetwist,
c_tyellocrys
c_tyellocrys,
}
else -- normal lichen
worms = { c_worm_blue }
@ -493,8 +520,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end
worms = { c_worm_red, c_tredcrys }
worm_max_len = 4
decos =
{ c_flame, c_flame, c_bflame, c_fire_vine, c_tredcrys}
decos = { c_flame, c_flame, c_bflame, c_fire_vine, c_tredcrys }
else -- deep glacial
floor = c_iced
floor_depth = 3
@ -523,10 +549,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
data[ii] = floor
end
end
-- minetest.set_node(pos + vector.new(x, y, z), {name = crystal, param2 = 1})
-- decorations
if math.random() < ICICHA * deco_mul and data[bi] ~= c_hotspring then
data[vi] = decos[math.random(1, #decos)]
local deco = decos[math.random(1, #decos)]
if table_contains(erdkristall, deco) then
local paramzwei = minetest.dir_to_facedir((vector.new(2, 0, 0)), true)
vparam2[vi] = paramzwei
end
data[vi] = deco
end
-- salt crystals
@ -677,24 +709,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
local ore
local cry
--for randomness - for stalagmites or stalagtites in a different color
local mode = 1
if math.random(15) == 1 then --chance 1/15
mode = 2
end
if biome == 3 then
if math.random(25) == 1 then --chance 1/25
mode = 2
else
mode = 1
end
end
if biome == 4 or biome == 5 then
if math.random(3) == 1 then --chance 1/3
mode = 2
end
end
if n_biome_e < -0.33 then -- non-evil
if n_biome_w < -0.33 then --algae
if math.random(10) == 1 then --chance 1/10 for mese
@ -811,6 +825,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
--send data back to voxelmanip
vm:set_data(data)
vm:set_param2_data(vparam2)
--calc lighting
vm:set_lighting({ day = 0, night = 0 })
vm:calc_lighting()

View file

@ -345,9 +345,9 @@ local function build_lights_after_generated(minp,maxp,sources)
cozylights:setVoxelManipData(vm,data,param2data,true)
agent_total = agent_total + mf((os.clock() - t) * 1000)
agent_count = agent_count + 1
print("Av build after generated time: "..
mf(agent_total/agent_count).." ms. Sample of: "..agent_count..". Areas left: "..#cozylights.area_queue
)
--print("Av build after generated time: "..
-- mf(agent_total/agent_count).." ms. Sample of: "..agent_count..". Areas left: "..#cozylights.area_queue
--)
end
--idk, size should be smarter than a constant
@ -627,7 +627,7 @@ minetest.register_on_generated(function(minp, maxp)
local light_sources = minetest.find_nodes_in_area(minp,maxp,cozylights.source_nodes)
if #light_sources == 0 then return end
if #light_sources > 1000 then
print("Error: too many light sources around "..cozylights:dump(pos).." Report this to Cozy Lights dev")
--print("Error: too many light sources around "..cozylights:dump(pos).." Report this to Cozy Lights dev")
return
end
--local minp_exp,maxp_exp,_,data,_,a = cozylights:getVoxelManipData(pos, size)

View file

@ -76,7 +76,7 @@ function cozylights:draw_node_light(pos,cozy_item,vm,a,data,param2data,fix_edges
end
gent_total = gent_total + mf((os.clock() - t) * 1000)
gent_count = gent_count + 1
print("Av illum time " .. mf(gent_total/gent_count) .. " ms. Sample of: "..gent_count)
--print("Av illum time " .. mf(gent_total/gent_count) .. " ms. Sample of: "..gent_count)
end
-- handle_async?
@ -85,7 +85,7 @@ function cozylights:rebuild_light()
if #single_light_queue == 0 then
return
end
print("#single_light_queue is: "..#single_light_queue)
--print("#single_light_queue is: "..#single_light_queue)
cozylights:draw_node_light(single_light_queue[1].pos, single_light_queue[1].cozy_item)
table.remove(single_light_queue, 1)
end