Compare commits
7 commits
efe720e31b
...
a8958f84db
Author | SHA1 | Date | |
---|---|---|---|
|
a8958f84db | ||
|
87f6d69655 | ||
|
d0418a3e82 | ||
|
4c6c7201bc | ||
|
5c6385a5e9 | ||
|
29e1c19c8d | ||
|
8a8f487aa6 |
BIN
Parts/Base/BellSystem.ChrisChrome.rbxm
Normal file
BIN
Parts/Base/BellSystem.ChrisChrome.rbxm
Normal file
Binary file not shown.
BIN
Parts/Speakers/AtlasEDVP161.Miko.rbxm
Normal file
BIN
Parts/Speakers/AtlasEDVP161.Miko.rbxm
Normal file
Binary file not shown.
BIN
Parts/Speakers/Bullhorn.Miko.rbxm
Normal file
BIN
Parts/Speakers/Bullhorn.Miko.rbxm
Normal file
Binary file not shown.
BIN
Parts/Speakers/CeilingSpeaker.TazTech.rbxm
Normal file
BIN
Parts/Speakers/CeilingSpeaker.TazTech.rbxm
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Parts/Stations/MultiPlayer.rbxm
Normal file
BIN
Parts/Stations/MultiPlayer.rbxm
Normal file
Binary file not shown.
BIN
Parts/Stations/SingleZoneMultiPlayer.rbxm
Normal file
BIN
Parts/Stations/SingleZoneMultiPlayer.rbxm
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
172
Scripts/AllZones.lua
Normal file
172
Scripts/AllZones.lua
Normal file
|
@ -0,0 +1,172 @@
|
|||
local system = script.Parent.Parent.Parent
|
||||
local zones = {}
|
||||
local mic = script.Parent.WallMic["Mic Enclosure"].AudioListener
|
||||
local buttons = {}
|
||||
local led = script.Parent.LED
|
||||
local ptt = false
|
||||
pttButton = script.Parent.WallMic["Mic Enclosure"].CD
|
||||
local tones = {}
|
||||
local thisTimeout = nil
|
||||
local systemReady = true
|
||||
local systemOverride = script.Parent.override.Value
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local waiting = false
|
||||
|
||||
function smoothTransition(startValue, endValue, duration, updateFunction)
|
||||
local finished = false
|
||||
-- Create a temporary NumberValue to tween
|
||||
local numberValue = Instance.new("NumberValue")
|
||||
numberValue.Value = startValue
|
||||
|
||||
-- Create TweenInfo
|
||||
local tweenInfo = TweenInfo.new(
|
||||
duration, -- Duration of the tween
|
||||
Enum.EasingStyle.Linear, -- Easing style
|
||||
Enum.EasingDirection.InOut, -- Easing direction
|
||||
0, -- Number of times to repeat
|
||||
false, -- Whether to reverse the tween
|
||||
0 -- Delay time before starting the tween
|
||||
)
|
||||
|
||||
-- Create tween goal
|
||||
local tweenGoal = {Value = endValue}
|
||||
|
||||
-- Create the tween
|
||||
local tween = TweenService:Create(numberValue, tweenInfo, tweenGoal)
|
||||
|
||||
-- Connect the update function to the Changed event
|
||||
local connection
|
||||
connection = numberValue.Changed:Connect(function()
|
||||
-- Call the update function with the current value
|
||||
updateFunction(numberValue.Value)
|
||||
end)
|
||||
|
||||
-- Play the tween
|
||||
tween:Play()
|
||||
|
||||
-- Cleanup after tween completes
|
||||
tween.Completed:Connect(function()
|
||||
-- Ensure the final value is set to endValue
|
||||
updateFunction(endValue)
|
||||
-- Disconnect the event and remove the NumberValue instance
|
||||
connection:Disconnect()
|
||||
numberValue:Destroy()
|
||||
finished = true
|
||||
end)
|
||||
repeat wait() until finished
|
||||
finished = false
|
||||
end
|
||||
|
||||
function checkZones()
|
||||
while true do
|
||||
systemReady = true
|
||||
for i,e in pairs(zones) do
|
||||
if e.ZoneInput.Wire.Connected then
|
||||
if not systemOverride then
|
||||
systemReady = false
|
||||
end
|
||||
end
|
||||
end
|
||||
if not ptt then
|
||||
if not systemReady then
|
||||
led.Material = Enum.Material.Neon
|
||||
led.Color = Color3.new(1,0,0)
|
||||
else
|
||||
led.Material = Enum.Material.SmoothPlastic
|
||||
led.Color = Color3.new(202/255, 203/255, 209/255)
|
||||
end
|
||||
end
|
||||
wait(0)
|
||||
end
|
||||
end
|
||||
function checkReady()
|
||||
while true do
|
||||
ready = true
|
||||
for i,e in pairs(zones) do
|
||||
local thisTone = tones[e.PageTone.Value]
|
||||
if thisTone.TimeLength == 0 then
|
||||
-- Empty audio, stop playing it
|
||||
thisTone:Stop()
|
||||
end
|
||||
if thisTone.IsPlaying or waiting then
|
||||
ready = false
|
||||
end
|
||||
end
|
||||
if ready and ptt then
|
||||
-- set led to green
|
||||
led.Material = Enum.Material.Neon
|
||||
led.Color = Color3.new(0,1,0)
|
||||
elseif ptt then
|
||||
-- set led to solid yellow
|
||||
led.Material = Enum.Material.Neon
|
||||
led.Color = Color3.new(1,1,0)
|
||||
end
|
||||
wait()
|
||||
end
|
||||
end
|
||||
function togglePTT()
|
||||
print(ready)
|
||||
print("toggling ptt")
|
||||
if ptt then
|
||||
ptt = false
|
||||
print("off")
|
||||
thisTimeout = nil
|
||||
for i,e in pairs(zones) do
|
||||
task.spawn(function()
|
||||
local thisTone = tones[zones[e.Name].EndTone.Value]
|
||||
zones[e.Name].ZoneInput.Wire.SourceInstance = thisTone
|
||||
thisTone:Play()
|
||||
wait(thisTone.TimeLength)
|
||||
zones[e.Name].ZoneInput.Wire.SourceInstance = nil
|
||||
smoothTransition(zones[e.Name].BGM.Volume,script.Parent.BGMUp.Value, 1, function(value)
|
||||
zones[e.Name].BGM.Volume = value
|
||||
end)
|
||||
end)
|
||||
end
|
||||
else
|
||||
if not systemReady then return end
|
||||
ptt = true
|
||||
for i,e in pairs(zones) do
|
||||
task.spawn(function()
|
||||
local thisTone = tones[zones[e.Name].PageTone.Value]
|
||||
waiting = true
|
||||
smoothTransition(zones[e.Name].BGM.Volume, script.Parent.BGMDown.Value, 1, function(value)
|
||||
zones[e.Name].BGM.Volume = value
|
||||
end)
|
||||
waiting = false
|
||||
zones[e.Name].ZoneInput.Wire.SourceInstance = thisTone
|
||||
thisTone:Play()
|
||||
wait(thisTone.TimeLength)
|
||||
if(ptt) then
|
||||
-- We havent stopped PTT before page tone done, hit it
|
||||
zones[e.Name].ZoneInput.Wire.SourceInstance = script.Parent.StationOutput
|
||||
thisTimeout = math.random(1,1000000)
|
||||
task.spawn(function()
|
||||
local myTimeout = tonumber(tostring(thisTimeout))
|
||||
wait(script.Parent.TimeoutSeconds.Value)
|
||||
if myTimeout == thisTimeout then
|
||||
togglePTT()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
pttButton.MouseClick:Connect(function()
|
||||
togglePTT()
|
||||
end)
|
||||
|
||||
for i,e in ipairs(system.Zones:GetChildren()) do
|
||||
zones[e.Name] = e
|
||||
end
|
||||
|
||||
for i,e in ipairs(system.Tones:GetChildren()) do
|
||||
tones[e.Name] = e
|
||||
end
|
||||
|
||||
task.spawn(checkZones)
|
||||
task.spawn(checkReady)
|
|
@ -8,9 +8,11 @@ pttButton = script.Parent["Panel Mic"].mic.CD
|
|||
local selectedZones = {}
|
||||
local tones = {}
|
||||
local thisTimeout = nil
|
||||
local waiting = false
|
||||
local TweenService = game:GetService("TweenService")
|
||||
|
||||
function smoothTransition(startValue, endValue, duration, updateFunction)
|
||||
local finished = false
|
||||
-- Create a temporary NumberValue to tween
|
||||
local numberValue = Instance.new("NumberValue")
|
||||
numberValue.Value = startValue
|
||||
|
@ -48,7 +50,10 @@ function smoothTransition(startValue, endValue, duration, updateFunction)
|
|||
-- Disconnect the event and remove the NumberValue instance
|
||||
connection:Disconnect()
|
||||
numberValue:Destroy()
|
||||
finished = true
|
||||
end)
|
||||
repeat wait() until finished
|
||||
finished = false
|
||||
end
|
||||
|
||||
function toggleZone(zoneNumber)
|
||||
|
@ -118,7 +123,7 @@ function checkReady()
|
|||
-- Empty audio, stop playing it
|
||||
thisTone:Stop()
|
||||
end
|
||||
if thisTone.IsPlaying then
|
||||
if waiting or thisTone.IsPlaying then
|
||||
leds[e.Name].Color = Color3.new(1,1,0)
|
||||
ready = false
|
||||
else
|
||||
|
@ -139,6 +144,7 @@ function togglePTT()
|
|||
thisTimeout = nil
|
||||
for i,e in pairs(selectedZones) do
|
||||
task.spawn(function()
|
||||
toggleZone(e.Name)
|
||||
local thisTone = tones[zones[e.Name].EndTone.Value]
|
||||
zones[e.Name].ZoneInput.Wire.SourceInstance = thisTone
|
||||
thisTone:Play()
|
||||
|
@ -160,9 +166,11 @@ function togglePTT()
|
|||
for i,e in pairs(selectedZones) do
|
||||
task.spawn(function()
|
||||
local thisTone = tones[zones[e.Name].PageTone.Value]
|
||||
waiting = true
|
||||
smoothTransition(zones[e.Name].BGM.Volume, script.Parent.BGMDown.Value, 1, function(value)
|
||||
zones[e.Name].BGM.Volume = value
|
||||
end)
|
||||
waiting = false
|
||||
zones[e.Name].ZoneInput.Wire.SourceInstance = thisTone
|
||||
thisTone:Play()
|
||||
wait(thisTone.TimeLength)
|
||||
|
|
|
@ -9,8 +9,9 @@ local selectedZones = {}
|
|||
local tones = {}
|
||||
local thisTimeout = nil
|
||||
local TweenService = game:GetService("TweenService")
|
||||
|
||||
local waiting = false
|
||||
function smoothTransition(startValue, endValue, duration, updateFunction)
|
||||
local finished = false
|
||||
-- Create a temporary NumberValue to tween
|
||||
local numberValue = Instance.new("NumberValue")
|
||||
numberValue.Value = startValue
|
||||
|
@ -48,7 +49,10 @@ function smoothTransition(startValue, endValue, duration, updateFunction)
|
|||
-- Disconnect the event and remove the NumberValue instance
|
||||
connection:Disconnect()
|
||||
numberValue:Destroy()
|
||||
finished = true
|
||||
end)
|
||||
repeat wait() until finished
|
||||
finished = false
|
||||
end
|
||||
|
||||
function toggleZone(zoneNumber)
|
||||
|
@ -118,7 +122,7 @@ function checkReady()
|
|||
-- Empty audio, stop playing it
|
||||
thisTone:Stop()
|
||||
end
|
||||
if thisTone.IsPlaying then
|
||||
if waiting or thisTone.IsPlaying then
|
||||
leds[e.Name].Color = Color3.new(1,1,0)
|
||||
ready = false
|
||||
else
|
||||
|
@ -160,9 +164,11 @@ function togglePTT()
|
|||
for i,e in pairs(selectedZones) do
|
||||
task.spawn(function()
|
||||
local thisTone = tones[zones[e.Name].PageTone.Value]
|
||||
waiting = true
|
||||
smoothTransition(zones[e.Name].BGM.Volume, script.Parent.BGMDown.Value, 1, function(value)
|
||||
zones[e.Name].BGM.Volume = value
|
||||
end)
|
||||
waiting = false
|
||||
zones[e.Name].ZoneInput.Wire.SourceInstance = thisTone
|
||||
thisTone:Play()
|
||||
wait(thisTone.TimeLength)
|
||||
|
|
152
Scripts/SingleStation.lua
Normal file
152
Scripts/SingleStation.lua
Normal file
|
@ -0,0 +1,152 @@
|
|||
local system = script.Parent.Parent.Parent
|
||||
local mic = script.Parent.WallMic["Mic Enclosure"].AudioListener
|
||||
local buttons = {}
|
||||
local led = script.Parent.LED
|
||||
local ptt = false
|
||||
pttButton = script.Parent.WallMic["Mic Enclosure"].CD
|
||||
local zones = {}
|
||||
local tones = {}
|
||||
local thisTimeout = nil
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local waiting = false
|
||||
|
||||
function smoothTransition(startValue, endValue, duration, updateFunction)
|
||||
local finished = false
|
||||
-- Create a temporary NumberValue to tween
|
||||
local numberValue = Instance.new("NumberValue")
|
||||
numberValue.Value = startValue
|
||||
|
||||
-- Create TweenInfo
|
||||
local tweenInfo = TweenInfo.new(
|
||||
duration, -- Duration of the tween
|
||||
Enum.EasingStyle.Linear, -- Easing style
|
||||
Enum.EasingDirection.InOut, -- Easing direction
|
||||
0, -- Number of times to repeat
|
||||
false, -- Whether to reverse the tween
|
||||
0 -- Delay time before starting the tween
|
||||
)
|
||||
|
||||
-- Create tween goal
|
||||
local tweenGoal = {Value = endValue}
|
||||
|
||||
-- Create the tween
|
||||
local tween = TweenService:Create(numberValue, tweenInfo, tweenGoal)
|
||||
|
||||
-- Connect the update function to the Changed event
|
||||
local connection
|
||||
connection = numberValue.Changed:Connect(function()
|
||||
-- Call the update function with the current value
|
||||
updateFunction(numberValue.Value)
|
||||
end)
|
||||
|
||||
-- Play the tween
|
||||
tween:Play()
|
||||
|
||||
-- Cleanup after tween completes
|
||||
tween.Completed:Connect(function()
|
||||
-- Ensure the final value is set to endValue
|
||||
updateFunction(endValue)
|
||||
-- Disconnect the event and remove the NumberValue instance
|
||||
connection:Disconnect()
|
||||
numberValue:Destroy()
|
||||
finished = true
|
||||
end)
|
||||
repeat wait() until finished
|
||||
finished = false
|
||||
end
|
||||
|
||||
for i, e in ipairs(system.Tones:GetChildren()) do tones[e.Name] = e end
|
||||
for i, e in ipairs(system.Zones:GetChildren()) do zones[e.Name] = e end
|
||||
local zone = zones[script.Parent.Zone.Value]
|
||||
|
||||
function checkZones()
|
||||
while true do
|
||||
if zone.ZoneInput.Wire.Connected and not ptt then
|
||||
led.Material = Enum.Material.Neon
|
||||
led.Color = Color3.new(1, 0, 0)
|
||||
elseif not ptt then
|
||||
led.Material = Enum.Material.SmoothPlastic
|
||||
led.Color = Color3.new(163/255, 162/255, 165/255)
|
||||
end
|
||||
wait(0)
|
||||
end
|
||||
end
|
||||
function checkReady()
|
||||
local ready = true
|
||||
while true do
|
||||
if ptt then
|
||||
ready = true
|
||||
|
||||
-- print("checking " .. zone)
|
||||
led.Material = Enum.Material.Neon
|
||||
local thisTone = tones[zone.PageTone.Value]
|
||||
if thisTone.TimeLength == 0 then
|
||||
-- Empty audio, stop playing it
|
||||
thisTone:Stop()
|
||||
end
|
||||
if waiting or thisTone.IsPlaying then
|
||||
led.Color = Color3.new(1, 1, 0)
|
||||
ready = false
|
||||
else
|
||||
led.Color = Color3.new(0, 1, 0)
|
||||
end
|
||||
else
|
||||
ready = false
|
||||
end
|
||||
wait()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function togglePTT()
|
||||
|
||||
-- print("toggling ptt")
|
||||
if ptt then
|
||||
ptt = false
|
||||
thisTimeout = nil
|
||||
-- print("off")
|
||||
task.spawn(function()
|
||||
local thisTone = tones[zone.EndTone.Value]
|
||||
zone.ZoneInput.Wire.SourceInstance = thisTone
|
||||
thisTone:Play()
|
||||
wait(thisTone.TimeLength)
|
||||
zone.ZoneInput.Wire.SourceInstance = nil
|
||||
smoothTransition(zone.BGM.Volume, script.Parent.BGMUp.Value, 1, function(value)
|
||||
zone.BGM.Volume = value
|
||||
end)
|
||||
end)
|
||||
else
|
||||
if zone.ZoneInput.Wire.Connected then return end
|
||||
ptt = true
|
||||
task.spawn(function()
|
||||
local thisTone = tones[zone.PageTone.Value]
|
||||
waiting = true
|
||||
smoothTransition(zone.BGM.Volume, script.Parent.BGMDown.Value, 1, function(value)
|
||||
zone.BGM.Volume = value
|
||||
end)
|
||||
waiting = false
|
||||
zone.ZoneInput.Wire.SourceInstance = thisTone
|
||||
thisTone:Play()
|
||||
wait(thisTone.TimeLength)
|
||||
if (ptt) then
|
||||
-- We havent stopped PTT before page tone done, hit it
|
||||
zone.ZoneInput.Wire.SourceInstance = script.Parent.StationOutput
|
||||
thisTimeout = math.random(1, 1000000)
|
||||
task.spawn(function()
|
||||
local myTimeout = tonumber(tostring(thisTimeout))
|
||||
wait(script.Parent.TimeoutSeconds.Value)
|
||||
if myTimeout == thisTimeout then
|
||||
togglePTT()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
pttButton.MouseClick:Connect(function() togglePTT() end)
|
||||
|
||||
task.spawn(checkReady)
|
||||
task.spawn(checkZones)
|
Loading…
Reference in a new issue