-
Notifications
You must be signed in to change notification settings - Fork 0
/
ParabellumPackager.lua
59 lines (51 loc) · 1.96 KB
/
ParabellumPackager.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- Create a new toolbar section titled "Parabellum Tools"
local toolbar = plugin:CreateToolbar("Parabellum Tools")
-- Add a toolbar button named "Package Map"
local packageMap = toolbar:CreateButton("Package Map", "Package map into a Project Parabellum Compatible Map", "rbxassetid://4458901886")
-- Package everything
local function onNewScriptButtonClicked()
print("Packaging map. Please wait...")
local map = Instance.new("Model")
-- Get every object in workspace
for i,v in pairs(workspace:GetChildren()) do
if not v:IsA("Terrain") and not v:IsA("Camera") then
local obj = v:Clone()
obj.Parent = map
end
end
print("Packaged workspace")
-- Time values
local timevalue = Instance.new("NumberValue")
timevalue.Value = game:GetService("Lighting").ClockTime
timevalue.Name = "tod"
timevalue.Parent = map
print("Packaged Clocktime")
-- Geographic latitude values
local geographiclatitude = Instance.new("NumberValue")
geographiclatitude.Value = game:GetService("Lighting").GeographicLatitude
geographiclatitude.Name = "GL"
geographiclatitude.Parent = map
print("Packaged Geographic Latitude")
if game:GetService("Lighting"):FindFirstChildWhichIsA("Atmosphere") then
local atmosphere = game:GetService("Lighting"):FindFirstChildWhichIsA("Atmosphere"):Clone()
atmosphere.Parent = map
print("Packaged Atmosphere")
else
warn("Couldn't find an Atmosphere! Creating placeholder")
local atmosphere = Instance.new("Atmosphere")
atmosphere.Parent = map
end
if game:GetService("Lighting"):FindFirstChildWhichIsA("Sky") then
local sky = game:GetService("Lighting"):FindFirstChildWhichIsA("Sky"):Clone()
sky.Parent = map
print("Packaged Sky")
else
warn("Couldn't find a Skybox! Creating placeholder")
local sky = Instance.new("Sky")
sky.Parent = map
end
map.Name = "Packaged Map"
map.Parent = workspace
print("Successfully packaged map!")
end
packageMap.Click:Connect(onNewScriptButtonClicked)