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 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 --grab a shorthand for the filepath of the mod
local modpath = minetest.get_modpath(minetest.get_current_modname()) 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 vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
local data = vm:get_data() 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 --grab content IDs
local c_air = minetest.get_content_id("air") 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_crystal = minetest.get_content_id("caverealms:glow_crystal")
local c_gem = minetest.get_content_id("caverealms:glow_gem") local c_gem = minetest.get_content_id("caverealms:glow_gem")
local c_saltgem = minetest.get_content_id("caverealms:salt_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_spike = minetest.get_content_id("caverealms:spike")
local c_moss = minetest.get_content_id("caverealms:stone_with_moss") local c_moss = minetest.get_content_id("caverealms:stone_with_moss")
local c_lichen = minetest.get_content_id("caverealms:stone_with_lichen") local c_lichen = minetest.get_content_id("caverealms:stone_with_lichen")
@ -196,7 +207,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
--if minetest.get_modpath("too_many_stones") then --if minetest.get_modpath("too_many_stones") then
local c_torangecrys = minetest.get_content_id("too_many_stones:crocoite_crystal") local c_torangecrys = minetest.get_content_id("too_many_stones:crocoite_crystal")
local c_tredcrys = minetest.get_content_id("too_many_stones:eudialite_crystal") local c_tredcrys = minetest.get_content_id("too_many_stones:eudialite_crystal")
local c_fakesalt = minetest.get_content_id("too_many_stones:rose_quartz_crystal")-- local c_fakesalt = minetest.get_content_id("too_many_stones:rose_quartz_crystal") --
local c_tyellocrys = minetest.get_content_id("too_many_stones:citrine_crystal") local c_tyellocrys = minetest.get_content_id("too_many_stones:citrine_crystal")
local c_tsmokecrys = minetest.get_content_id("too_many_stones:smokey_quartz_crystal") local c_tsmokecrys = minetest.get_content_id("too_many_stones:smokey_quartz_crystal")
local c_tyellowcrys = minetest.get_content_id("too_many_stones:heliodor_crystal") local c_tyellowcrys = minetest.get_content_id("too_many_stones:heliodor_crystal")
@ -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_fakeice1 = minetest.get_content_id("too_many_stones:celestine_crystal")
local c_fakeice2 = minetest.get_content_id("too_many_stones:moonstone_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") local c_fakeice3 = minetest.get_content_id("too_many_stones:quartz_crystal")
print(c_fakeice3)
--else --else
--end --end
@ -217,8 +229,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_icicles_c = minetest.get_content_id("everness:frosted_icicle") local c_icicles_c = minetest.get_content_id("everness:frosted_icicle")
local c_icicles_f = minetest.get_content_id("everness:frosted_icicle_floor") local c_icicles_f = minetest.get_content_id("everness:frosted_icicle_floor")
local c_crystcyan = minetest.get_content_id("everness:crystal_cyan") -- local c_crystcyan = minetest.get_content_id("everness:crystal_cyan") --
local c_crystorange = minetest.get_content_id("everness:crystal_orange")-- local c_crystorange = minetest.get_content_id("everness:crystal_orange") --
local c_crystpurple = minetest.get_content_id("everness:crystal_purple")-- local c_crystpurple = minetest.get_content_id("everness:crystal_purple") --
local c_flamepurple = minetest.get_content_id("everness:flame_permanent_purple") local c_flamepurple = minetest.get_content_id("everness:flame_permanent_purple")
local c_frostedice = minetest.get_content_id("everness:frosted_ice") local c_frostedice = minetest.get_content_id("everness:frosted_ice")
local c_mosspurple = minetest.get_content_id("everness:ivis_moss") local c_mosspurple = minetest.get_content_id("everness:ivis_moss")
@ -226,7 +238,22 @@ minetest.register_on_generated(function(minp, maxp, seed)
local c_redlant = minetest.get_content_id("everness:glowing_pillar") local c_redlant = minetest.get_content_id("everness:glowing_pillar")
local c_redplant = minetest.get_content_id("everness:bloodspore_plant") 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 --end
--herbs --herbs
@ -386,7 +413,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
c_flamepurple, c_flamepurple,
c_crystpurple, c_crystpurple,
c_bluetwist, c_bluetwist,
c_tyellocrys c_tyellocrys,
} }
else -- normal lichen else -- normal lichen
worms = { c_worm_blue } worms = { c_worm_blue }
@ -493,8 +520,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
worms = { c_worm_red, c_tredcrys } worms = { c_worm_red, c_tredcrys }
worm_max_len = 4 worm_max_len = 4
decos = decos = { c_flame, c_flame, c_bflame, c_fire_vine, c_tredcrys }
{ c_flame, c_flame, c_bflame, c_fire_vine, c_tredcrys}
else -- deep glacial else -- deep glacial
floor = c_iced floor = c_iced
floor_depth = 3 floor_depth = 3
@ -523,10 +549,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
data[ii] = floor data[ii] = floor
end end
end end
-- minetest.set_node(pos + vector.new(x, y, z), {name = crystal, param2 = 1})
-- decorations -- decorations
if math.random() < ICICHA * deco_mul and data[bi] ~= c_hotspring then 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 end
-- salt crystals -- salt crystals
@ -677,24 +709,6 @@ minetest.register_on_generated(function(minp, maxp, seed)
local ore local ore
local cry 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_e < -0.33 then -- non-evil
if n_biome_w < -0.33 then --algae if n_biome_w < -0.33 then --algae
if math.random(10) == 1 then --chance 1/10 for mese 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 --send data back to voxelmanip
vm:set_data(data) vm:set_data(data)
vm:set_param2_data(vparam2)
--calc lighting --calc lighting
vm:set_lighting({ day = 0, night = 0 }) vm:set_lighting({ day = 0, night = 0 })
vm:calc_lighting() vm:calc_lighting()

View file

@ -345,9 +345,9 @@ local function build_lights_after_generated(minp,maxp,sources)
cozylights:setVoxelManipData(vm,data,param2data,true) cozylights:setVoxelManipData(vm,data,param2data,true)
agent_total = agent_total + mf((os.clock() - t) * 1000) agent_total = agent_total + mf((os.clock() - t) * 1000)
agent_count = agent_count + 1 agent_count = agent_count + 1
print("Av build after generated time: ".. --print("Av build after generated time: "..
mf(agent_total/agent_count).." ms. Sample of: "..agent_count..". Areas left: "..#cozylights.area_queue -- mf(agent_total/agent_count).." ms. Sample of: "..agent_count..". Areas left: "..#cozylights.area_queue
) --)
end end
--idk, size should be smarter than a constant --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) local light_sources = minetest.find_nodes_in_area(minp,maxp,cozylights.source_nodes)
if #light_sources == 0 then return end if #light_sources == 0 then return end
if #light_sources > 1000 then 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 return
end end
--local minp_exp,maxp_exp,_,data,_,a = cozylights:getVoxelManipData(pos, size) --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 end
gent_total = gent_total + mf((os.clock() - t) * 1000) gent_total = gent_total + mf((os.clock() - t) * 1000)
gent_count = gent_count + 1 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 end
-- handle_async? -- handle_async?
@ -85,7 +85,7 @@ function cozylights:rebuild_light()
if #single_light_queue == 0 then if #single_light_queue == 0 then
return return
end 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) cozylights:draw_node_light(single_light_queue[1].pos, single_light_queue[1].cozy_item)
table.remove(single_light_queue, 1) table.remove(single_light_queue, 1)
end end