Advertisement
squidingtin

Mono-wheel script SE

Apr 19th, 2021
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. string seatName = "seat name";
  2. string rotorName = "rotor name";
  3. float speed = 1;
  4.  
  5. IMyShipController c;
  6. IMyMotorStator r;
  7.  
  8. Vector3 mi;
  9.  
  10. public Program()
  11. {
  12. c = GridTerminalSystem.GetBlockWithName(seatName) as IMyShipController;
  13. r = GridTerminalSystem.GetBlockWithName(rotorName) as IMyMotorStator;
  14.  
  15. Runtime.UpdateFrequency = UpdateFrequency.Update10;
  16. }
  17.  
  18. public void Main(string argument)
  19. {
  20.   if(c.IsUnderControl)
  21.     mi = c.MoveIndicator;
  22.   else
  23.     mi = Vector3.Zero;
  24.  
  25.   if(mi.Z == -1)
  26.     r.TargetVelocityRPM = speed;
  27.   if(mi.Z == 1)
  28.     r.TargetVelocityRPM = -speed;
  29.   if(mi.Z == 0)
  30.     r.TargetVelocityRPM = 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement