meta data for this page
Vehicles/SnowmakingManager.lua
SnowmakingManager implements the global snow cannon control system. All snow cannons are registered to SnowmakingManager and can be remote-controlled by script.
The table snowCannons
contains all snow cannon instances and is also used for the slope map in the overview menu.
29 SnowmakingManager = SnowmakingManager or {};
SnowmakingManager:setup()
Is called upon initialisation of the game.
33 function SnowmakingManager:setup() 34 self.snowCannons = {}; 35 end;
SnowmakingManager:registerVehicle(vehicle)
Is called once for each vehicle that has a SnowCannon VehicleScript attached to, when the vehicle is spawned.
vehicle
(table) is the vehicle instance.
40 function SnowmakingManager:registerVehicle(vehicle) 41 self.snowCannons[vehicle] = true; 42 end;
SnowmakingManager:unregisterVehicle(vehicle)
Is called once for each vehicle that is destroyed (i.e. sold, or destroyed upon closing the game).
vehicle
(table) again is the vehicle instance
47 function SnowmakingManager:unregisterVehicle(vehicle) 48 self.snowCannons[vehicle] = nil; 49 end;
SnowmakingManager:setGroupState(groupId, state)
Call this function to turn on/off all snow cannons in group groupId
(int), depending on state
(bool, true for on).
53 function SnowmakingManager:setGroupState(groupId, state) 54 for vehicle, _ in pairs(self.snowCannons) do 55 56 -- check if this vehicle belongs to this group 57 if vehicle.setIsCannonTurnedOn ~= nil and vehicle.snowCannonGroupId == groupId then 58 59 -- yep, apply to this group 60 vehicle:setIsCannonTurnedOn(nil, state); 61 end; 62 end; 63 end;
Copyright
All contents of this page may be used for modding use for Winter Resort Simulator only. Any use exceeding this regulation is not permitted.
Copyright (C) HR Innoways, 2020. All Rights Reserved.