Action denied

Vehicles/VehicleScripts/NetworkEvents/EventRopeWinch.lua

This file contains all event that are relevant for the RopeWinch.

  25  
  26  EventSetRopeWinchRotation           = EventSetRopeWinchRotation or ExtensionOf(BaseEvent);
  27  
  28  InitVanillaEvent(EventSetRopeWinchRotation, "EventSetRopeWinchRotation");
  29  
  30  function EventSetRopeWinchRotation:sendData(entity, rot)
  31      streamWriteEntityId(entity);
  32      streamWriteFloat(rot);
  33  end;
  34  
  35  function EventSetRopeWinchRotation:receiveData(connection)
  36      local entity                    = streamReadEntityId();
  37      local rot                       = streamReadFloat();
  38  
  39      if entity ~= nil then
  40          entity:setWinchRootRotation(rot, true);
  41      end;
  42      
  43      self:broadcastEvent(connection, entity, rot);
  44  end;
  45  
  46  EventSetIsRopeTensed                = EventSetIsRopeTensed or ExtensionOf(BaseEvent);
  47  
  48  InitVanillaEvent(EventSetIsRopeTensed, "EventSetIsRopeTensed");
  49  
  50  function EventSetIsRopeTensed:sendData(entity, tensed)
  51      streamWriteEntityId(entity);
  52      streamWriteBool(tensed);
  53  end;
  54  
  55  function EventSetIsRopeTensed:receiveData(connection)
  56      local entity                    = streamReadEntityId();
  57      local tensed                    = streamReadBool();
  58  
  59      if entity ~= nil then
  60          entity:setIsRopeTensed(tensed, true);
  61      end;
  62      
  63      self:broadcastEvent(connection, entity, tensed);
  64  end;
  65  
  66  EventSetRopeWinchConnection         = EventSetRopeWinchConnection or ExtensionOf(BaseEvent);
  67  
  68  InitVanillaEvent(EventSetRopeWinchConnection, "EventSetRopeWinchConnection");
  69  
  70  function EventSetRopeWinchConnection:sendData(entity, connectTo)
  71      streamWriteEntityId(entity);
  72      if type(connectTo) ~= "table" then
  73          streamWriteBool(false); -- false means it is no entity 
  74          streamWriteString(connectTo);
  75      else
  76          streamWriteBool(true); -- true means it is an entity 
  77          streamWriteEntityId(connectTo);
  78      end;
  79  end;
  80  
  81  function EventSetRopeWinchConnection:receiveData(connection)
  82      local entity                    = streamReadEntityId();
  83      local isEntity                  = streamReadBool();
  84  
  85      local connectTo;
  86      if not isEntity then
  87          connectTo                   = streamReadString();
  88      else
  89          connectTo                   = streamReadEntityId();
  90      end;
  91  
  92      if entity ~= nil then
  93          entity:attachWinchToAnchorPoint(connectTo, true);
  94          
  95          self:broadcastEvent(connection, entity, connectTo);
  96      end;
  97  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.