Skip to content

Instantly share code, notes, and snippets.

@bwRavencl
Created January 7, 2022 18:20
Show Gist options
  • Save bwRavencl/59134989d6f1cd5fae62d1f383072136 to your computer and use it in GitHub Desktop.
Save bwRavencl/59134989d6f1cd5fae62d1f383072136 to your computer and use it in GitHub Desktop.
local _coord = coord.LLtoLO(37.748611, 245.146667) -- location of the tunnel in latitude (north) / longitude (east)
local _w = 15 -- width of building
local _d = 28 -- depth of building
local _width = _w * 3 -- width of the tunnel (must be a multiple of _w)
local _length = 250 --length of the tunnel in segments
local _baseHeight = 1 -- height of the tunnel in segments, before the tapering starts
for x=0,_length do
for i=0,_width / _w + _baseHeight do
for j=0,1 do
local _y = _coord.z
if (j > 0)
then
_y = _y + _width + _w
end
if ( i > _baseHeight)
then
local _shift = (i - _baseHeight) * (_w / 2)
if (j > 0)
then
_shift = _shift * -1
end
_y = _y + _shift
end
local _container = {
["category"] = "Fortifications",
["shape_name"] = "r_vok_sd",
["type"] = "Railway station",
["rate"] = 100,
["y"] = _y,
["x"] = _coord.x + x * _d,
["name"] = "tunnel-" .. j .. "-" .. i .. "-" .. x,
["heading"] = 0
}
coalition.addStaticObject(country.id.USA, _container)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment