Vehicles/VehicleScripts/NetworkEvents/EventSetMovingPartPosition.lua

This file contains an event that synchronizes the position of MovingParts.

  25  
  26  EventSetMovingPartPosition          = EventSetMovingPartPosition or ExtensionOf(BaseEvent);
  27  
  28  InitVanillaEvent(EventSetMovingPartPosition, "EventSetMovingPartPosition");
  29  
  30  function EventSetMovingPartPosition:sendData(entity, key, pos)
  31      streamWriteEntityId(entity);
  32      streamWriteUInt8(key);
  33      streamWriteFloat(pos);
  34  end;
  35  
  36  function EventSetMovingPartPosition:receiveData(connection)
  37      local entity                    = streamReadEntityId();
  38      local key                       = streamReadUInt8();
  39      local pos                       = streamReadFloat();
  40  
  41      if entity ~= nil then
  42          entity:setMovingPartPosition(key, pos, true);
  43      end;
  44      
  45      self:broadcastEvent(connection, entity, key, pos);
  46  end;

All contents of this page may be used for modding use for Winter Resort Simulator - Season 2 only. Any use exceeding this regulation is not permitted.

Copyright (C) HR Innoways, 2021. All Rights Reserved.