Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const string RotorNameX = "Rotor Horizontal"; // the rotor names
- const string RotorNameY = "Rotor Vertical";
- int divisor = 1;
- void Main(string arg)
- {
- var inputs = Me.GetValue<Dictionary<string, object>>("ControlModule.Inputs");
- var rotorX = GridTerminalSystem.GetBlockWithName(RotorNameX) as IMyMotorStator;
- var rotorY = GridTerminalSystem.GetBlockWithName(RotorNameY) as IMyMotorStator;
- if(rotorX == null || rotorY == null) // when the ship gets split the rotors might not get found, that's why no error here
- return;
- var mouse = (Vector3)inputs["m.analog"];
- // travando velocidade maxima do mouse
- mouse.X = MathHelper.Clamp(mouse.X, - 10, 10);
- mouse.Y = MathHelper.Clamp(mouse.Y, - 10, 10);
- //pegando as teclas 1 2 3 4
- bool zoomOne = inputs.ContainsKey("num1"); // you can edit controls used here
- bool zoomTwo = inputs.ContainsKey("num2");
- bool zoomFour = inputs.ContainsKey("num3");
- // selecionando velocidade do zoom, selecting turret speed
- if(zoomOne == true) divisor = 1; else return;
- if(zoomTwo == true) divisor = 2; else return;
- if(zoomFour == true) divisor = 3; else return;
- // depending on how your rotors are set up you might need to invert the values
- // to do that simply add - in front of mouse.X or mouse.Y
- rotorX.SetValueFloat("Velocity", mouse.X/divisor);
- rotorY.SetValueFloat("Velocity", mouse.Y/divisor);
- // escrevendo em um lcd o nivel do zoom, writing turret speed in a lcd
- IMyTextPanel panel = GridTerminalSystem.GetBlockWithName("Text panel Zoom") as IMyTextPanel;
- if(divisor == 1){
- string text = "Zoom speed 100%";
- panel.WritePublicText(text, false);
- }
- if(divisor == 2){
- string text = "Zoom speed 50%";
- panel.WritePublicText(text, false);
- }
- if(divisor == 4){
- string text = "Zoom speed 25%";
- panel.WritePublicText(text, false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement