FuelStationTrigger is a static counterpart of FuelTank, which is required to refuel vehicles.

  24  FuelStationTrigger                  = FuelStationTrigger or {};


Initializes a new FuelStationTrigger. We do not create any instance, which makes it a rather convenient and performance-saving object.

This will usually be called by the object's onCreate Component.

  29  function FuelStationTrigger.onCreate(id)
  30      Trigger.addTrigger(id,
  31          function(otherId) FuelStationTrigger.setMayRefuel(otherId, true); end,
  32          function(otherId) FuelStationTrigger.setMayRefuel(otherId, false); end,
  33          -- react to rigid bodies only
  34          false,
  35          true
  36      );
  38      -- no lua instance created => no need to care about destroy listeners
  39  end;

FuelStationTrigger.setMayRefuel(otherId, state)

Checks whether otherId (int) actually is a vehicle, and if yes, calls FuelTank:setIsFuelStationInRange using the specified state (bool).

  42  function FuelStationTrigger.setMayRefuel(otherId, state)
  43      local vehicle                   = VehicleManager.vehicles[otherId or 0];
  45      if vehicle ~= nil and vehicle.setIsFuelStationInRange ~= nil then
  46          vehicle:setIsFuelStationInRange(state or false);
  47      end;
  48  end;

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.