Allow static overriding portalability on a per-surface basis

This commit is contained in:
Matt Penny 2024-05-08 20:46:42 -04:00
parent e12354556f
commit 78107866ce
2 changed files with 15 additions and 6 deletions

View file

@ -41,11 +41,11 @@ surfaces are portalable. The following material names allow portals to be placed
* `concrete_modular_floor001a`
* `transparent_portal_surface`
This behavior can be overridden by using the `no_portals` argument. To accept
portals, the geometry must also have associated collision so that it can be hit.
This can be done by placing a coplanar static collision object or through
animation with a [bone](./anim.md) that also animates a dynamic collision
object.
This behavior can be overridden by using the `accept_portals` or `no_portals`
arguments. Only one can be specified at a time. To accept portals, the geometry
must also have associated collision so that it can be hit. This can be done by
placing a coplanar static collision object or through animation with a
[bone](./anim.md) that also animates a dynamic collision object.
A mesh's UV coordinates are only used if its material does not have the
`tileSizeS` and `tileSizeT` properties in its YAML definition. Otherwise, the

View file

@ -124,7 +124,16 @@ local function list_static_nodes(nodes)
local plane = sk_math.plane3_with_point(chunkV.mesh.normals[1], chunkV.mesh.vertices[1])
local should_join_mesh = true
local accept_portals = chunkV.mesh.material and portalable_surfaces[chunkV.mesh.material.name] and not sk_scene.find_flag_argument(v.arguments, "no_portals")
local portalable_material = chunkV.mesh.material and portalable_surfaces[chunkV.mesh.material.name]
local no_portals = sk_scene.find_flag_argument(v.arguments, "no_portals")
local accept_portals_override = sk_scene.find_flag_argument(v.arguments, "accept_portals")
if no_portals and accept_portals_override then
error("Static geometry '" .. v.arguments .. "' cannot specify both 'no_portals' and 'accept_portals'")
end
local accept_portals = (portalable_material or accept_portals_override) and not no_portals
if transform_index or signal or accept_portals or not is_coplanar(chunkV.mesh, plane) then
should_join_mesh = false