mirror of
https://github.com/DramaticShape/DramaticShapeVoxelMod.git
synced 2026-08-12 08:01:09 +02:00
update 2d shiny sprites and shiny animation
This commit is contained in:
@@ -469,6 +469,8 @@ end
|
||||
--
|
||||
-- figures = { { w = <tiles across>,
|
||||
-- depth = <voxels of body; ABSENT for a person>,
|
||||
-- model = { ...authored plan layers, bottom first... },
|
||||
-- inset = <voxels back from the support cell's front>,
|
||||
-- thin = { rows = <top rows>, depth = <voxels> },
|
||||
-- flat = { x = { <lx0>, <lx1> }, rows = { <r0>, <r1> } },
|
||||
-- tiles = { ...w*h tile ids, row-major... },
|
||||
@@ -488,6 +490,16 @@ end
|
||||
-- same furniture the card would have stood on. The Marts' cash
|
||||
-- register is the case: a machine on a counter is a box, not an icon.
|
||||
--
|
||||
-- `model` is the third answer, and the only one that is not an extrusion
|
||||
-- of the drawing at all: an AUTHORED solid, given as plan layers bottom
|
||||
-- first, standing at the FRONT of the support cell. It exists for a
|
||||
-- drawing too small to un-project -- the Centers' push bell is 7x6 pixels
|
||||
-- of ¾-view dome, and no reading of six rows produces a shape a mask can
|
||||
-- extrude without inventing more than it measures. What it still may not
|
||||
-- invent is COLOUR: each layer names the atlas texel its top and its
|
||||
-- sides wear, so the solid is painted out of the drawing it replaces and
|
||||
-- follows every palette bake exactly like the rest of this file.
|
||||
--
|
||||
-- Two fields say which parts of such a drawing are NOT the extrusion,
|
||||
-- because a solid drawn in one 16x16 GB cell still packs more than one
|
||||
-- facing:
|
||||
@@ -557,10 +569,43 @@ local function authoredMasks(list)
|
||||
r0 = math.floor(f.flat.rows[1]),
|
||||
r1 = math.floor(f.flat.rows[2]) }
|
||||
end
|
||||
-- an AUTHORED model: plan layers bottom-first, each with the atlas
|
||||
-- texel its top and its sides wear. Dropped whole on any malformed
|
||||
-- layer, like every other field here -- a typo should leave the
|
||||
-- drawing lying flat, not build half a solid.
|
||||
local model = nil
|
||||
if type(f.model) == "table" and #f.model > 0 then
|
||||
model = {}
|
||||
for _, L in ipairs(f.model) do
|
||||
local plan = type(L) == "table" and L.plan
|
||||
local mw = (type(plan) == "table" and type(plan[1]) == "string")
|
||||
and #plan[1] or 0
|
||||
local okL = mw > 0 and type(L.top) == "table"
|
||||
and type(L.side) == "table"
|
||||
if okL then
|
||||
for _, r in ipairs(plan) do
|
||||
if type(r) ~= "string" or #r ~= mw then okL = false break end
|
||||
end
|
||||
end
|
||||
if not okL then model = nil break end
|
||||
local cells = {}
|
||||
for dz = 0, #plan - 1 do
|
||||
local r = plan[dz + 1]
|
||||
for dx = 0, mw - 1 do
|
||||
if r:sub(dx + 1, dx + 1) ~= "0" then cells[dz * mw + dx] = true end
|
||||
end
|
||||
end
|
||||
model[#model + 1] = { w = mw, d = #plan, cells = cells,
|
||||
top = L.top, side = L.side }
|
||||
end
|
||||
end
|
||||
if n > 0 then
|
||||
out[#out + 1] = { w = w, h = h, n = n, mask = mask,
|
||||
tiles = f.tiles, under = f.under,
|
||||
depth = depth and math.floor(depth) or nil,
|
||||
model = model,
|
||||
inset = model and math.floor(tonumber(f.inset) or 0)
|
||||
or nil,
|
||||
thin = thin, flat = flat }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user