mirror of
https://github.com/DramaticShape/DramaticShapeVoxelMod.git
synced 2026-08-12 11:40:56 +02:00
remove fireflies
This commit is contained in:
@@ -4686,84 +4686,6 @@ ForestAtmos.setting:sync("off")
|
||||
T.check(ForestAtmos.frame(fmap, DayNight.T.day) == nil,
|
||||
"OFF answers no frame at all: no fog uniform, no draw, no spend")
|
||||
ForestAtmos.setting:sync("full")
|
||||
|
||||
-- ------- and the fireflies get out of the forest
|
||||
--
|
||||
-- The same particle -- same mesh, same blinking shader, same hour's ramp --
|
||||
-- dealt over a map's TALL GRASS rather than over its whole volume, and on
|
||||
-- every outdoor map rather than the one with an entry. Grass is the entry.
|
||||
|
||||
-- the hour reads the same whether a map has an atmosphere or not, which is
|
||||
-- the point of pulling it out of frame(): the two cannot drift apart
|
||||
T.check(ForestAtmos.fireflyLevel(DayNight.T.night) > 0.5,
|
||||
"the night shift is out at midnight on a map with no entry either")
|
||||
T.check(ForestAtmos.fireflyLevel(DayNight.T.day) < 0.05,
|
||||
"and in by day")
|
||||
T.eq(ForestAtmos.fireflyLevel(DayNight.T.night),
|
||||
ForestAtmos.frame(fmap, DayNight.T.night).fireflyLevel,
|
||||
"the forest's own answer IS that answer -- one ramp, read twice")
|
||||
|
||||
-- the deal: over the cells handed in, one seed, one arrangement
|
||||
local meadow = {}
|
||||
for cx = 4, 9 do
|
||||
for cy = 4, 9 do meadow[#meadow + 1] = { cx, cy } end
|
||||
end
|
||||
local g1 = ForestAtmos.grassLayout(meadow, 4242)
|
||||
local g2 = ForestAtmos.grassLayout(meadow, 4242)
|
||||
T.eq(#g1, 29, "a 36-cell patch musters fireflies at the default density")
|
||||
local steady = true
|
||||
for i = 1, #g1 do
|
||||
steady = steady and g1[i].x == g2[i].x and g1[i].z == g2[i].z
|
||||
end
|
||||
T.check(steady, "and deals them the same way on every visit")
|
||||
T.check(#ForestAtmos.grassLayout(meadow, 99) > 0
|
||||
and ForestAtmos.grassLayout(meadow, 99)[1].x ~= g1[1].x,
|
||||
"a different map's seed deals a different swarm")
|
||||
|
||||
-- every one of them stands OVER the grass it was dealt for, in the tufts'
|
||||
-- own height band -- Structures stands a blade to y = 16
|
||||
local overGrass, lowDown = true, true
|
||||
for _, fly in ipairs(g1) do
|
||||
local cx, cy = math.floor(fly.x / 16), math.floor(fly.z / 16)
|
||||
if cx < 4 or cx > 9 or cy < 4 or cy > 9 then overGrass = false end
|
||||
if fly.y < 0 or fly.y > 16 then lowDown = false end
|
||||
end
|
||||
T.check(overGrass, "every firefly is dealt into a cell that HAS grass in it")
|
||||
T.check(lowDown, "and low over the blades rather than up in the air")
|
||||
|
||||
-- the knobs, and the cap that keeps a big route from dealing thousands
|
||||
T.eq(#ForestAtmos.grassLayout(meadow, 1, 2.0), 72,
|
||||
"the density knob musters more of them per cell")
|
||||
T.eq(#ForestAtmos.grassLayout(meadow, 1, 2.0, 10), 10,
|
||||
"and the cap is the ceiling over it")
|
||||
T.eq(#ForestAtmos.grassLayout({}, 1), 0,
|
||||
"a map with no grass on it deals nothing at all")
|
||||
|
||||
-- and the map-level gate: outdoors or under a canopy, never in a cave.
|
||||
-- A 4x4-block map is 8x8 cells; grass down the middle two columns.
|
||||
local function meadowMap(id, def)
|
||||
return {
|
||||
id = id, def = def, widthCells = 8, heightCells = 8,
|
||||
isGrassCell = function(_, cx, cy)
|
||||
return cx >= 3 and cx <= 4 and cy >= 1 and cy <= 6
|
||||
end,
|
||||
}
|
||||
end
|
||||
local route = meadowMap("ROUTE_1", { width = 4, height = 4,
|
||||
tileset = "OVERWORLD" })
|
||||
T.check(#ForestAtmos.grassFliesFor(route) > 0,
|
||||
"a route with tall grass on it has fireflies without an entry anywhere")
|
||||
local cave = meadowMap("MT_MOON_1F", { width = 4, height = 4,
|
||||
tileset = "CAVERN" })
|
||||
T.check(ForestAtmos.grassFliesFor(cave) == nil,
|
||||
"and a cave has none, whatever its collision tiles say -- no hour "
|
||||
.. "reaches it, so no night ever falls in it")
|
||||
local wood = meadowMap("VIRIDIAN_FOREST", { width = 4, height = 4,
|
||||
tileset = "FOREST" })
|
||||
T.check(#ForestAtmos.grassFliesFor(wood) > 0,
|
||||
"the canopy map is not outdoor and gets them anyway: night still FALLS "
|
||||
.. "in a forest, and it is the map they were drawn for")
|
||||
ForestAtmos.invalidate()
|
||||
end
|
||||
|
||||
-- ------- a shadow keeps hold of the feet that throw it
|
||||
|
||||
Reference in New Issue
Block a user