Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Other = {
- CityWideDeviceTypes = {
- "TrafficLight",
- "CrossingLight",
- "TV",
- "Reflector",
- "LcdScreen"
- }
- }
- function Other.ToggleAllDevices(state)
- local player = Game.GetPlayer()
- local targetSystem = Game.GetTargetingSystem()
- local tsqAll = Game["TSQ_ALL;"]()
- local thingOne, targetParts = targetSystem:GetTargetParts(player, tsqAll, targetParts)
- for _, obj in ipairs(targetParts) do
- local entity = obj:GetComponent(obj):GetEntity()
- if Other.Util.IfArrayHasValue(Other.CityWideDeviceTypes, entity:ToString()) then
- if state == "Activate" then
- entity:ActivateDevice()
- end
- if state == "Deactivate" then
- entity:DeactivateDevice()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement