Advertisement
sumguytwitches

Dragonfly Eve Prop Control

Jun 10th, 2023
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set steeringmanager:rollcontrolanglerange to 180.
  2. set proprad to 5.8.
  3. set rotormods to ship:modulesnamed("ModuleRoboticServoRotor").
  4. set rotors to list().
  5. for rm in rotormods {
  6. local rotor to lexicon().
  7. set rotor["part"] to rm:part.
  8. set rotor["mod"] to rm.
  9. if rotor:part:parent:name:contains("bay") {
  10. set baymod to rotor:part:parent:getmodule("ModuleAnimateGeneric").
  11. if baymod:hasevent("open") baymod:doevent("open").
  12. }
  13. set rotor["blades"] to list().
  14. for bm in rm:part:ModulesNamed("ModuleControlSurface") {
  15.  
  16. set bladepart to bm:part.
  17. local blade to lexicon().
  18. set blade["mod"] to bm.
  19. set blade["offset"] to vdot(-bladepart:Facing:starvector, bladepart:position - bladepart:parent:position).
  20. set blade["proprad"] to proprad.
  21.  
  22. bm:setfield("deploy", true).
  23.  
  24. rotor["blades"]:add(blade).
  25. }
  26.  
  27. rotors:add(rotor).
  28. rm:setfield("torque limit(%)", 0).
  29. rm:setfield("rpm limit", 460).
  30.  
  31. }
  32.  
  33. set first to true.
  34. set tarbladeaoa to 4.5.
  35. set deploycopy to 9.
  36. Fuelcells on.
  37.  
  38. //Lock Vars
  39. lock torque to throttle * 100.
  40. lock deploy to 9.
  41.  
  42. //Control Loop
  43. set LoopHz to 10.
  44. on round(time:seconds * LoopHz ) {
  45.  
  46. set torquecopy to torque.
  47. set deploycopy to deploy.
  48.  
  49. for rotor in rotors {
  50. rotor:mod:setfield("torque limit(%)", torquecopy).
  51. for blade in rotor:blades {
  52. blade:mod:setfield("deploy angle", deploycopy).
  53. }
  54. }
  55.  
  56.  
  57.  
  58. return first.
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement