Skip to content

Integrating NikNaks library to replace the atmos_outside function? #4

@ghost

Description

NikNaks: https://github.com/Nak2/NikNaks

This would help increase performance at least a little bit, and doesn't require much work to integrate.

local oldLeaf
local bsp = NikNaks.Map()
local endPosVector = Vector(0, 0, 32768)

-- NOTE: helper for checking if a position is outside of a building
function atmos_outside(pos)
	if !bsp then bsp = NikNaks.Map() end

	local leaf = bsp:PointInLeafCache(0, pos, oldLeaf)

	oldleaf = leaf -- this shouldn't cause issues even though this is a shared function

	local trace = {}
	trace.start = pos
	trace.endpos = trace.start + endPosVector
	trace.mask = MASK_SOLID

	local tr = util.TraceLine(trace)

	Atmos.HeightMin = (tr.HitPos - pos):Length() -- how do we replicate this in NikNaks without doing a trace?

	return leaf:IsOutsideMap()
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions