Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.15 KB | None | 0 0
  1. -- Specjalizacja dla Ursus C360 --
  2. -- Autor: Rockstar94 --
  3. -- 1.1: 10.07.2015 --
  4. -- 1.2: 29.11.2015 --
  5. -- 1.3: 15.12.2015 -- mozliwosc wylaczenia modu reki i animacji wejscia --
  6.  
  7.  
  8. C360 = {};
  9.  
  10. self.Belka = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.Belka#index"));
  11. setVisibility((self.Belka), false);
  12.  
  13. self.Sruba = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.Sruba#index"));
  14. setVisibility((self.Sruba), true);
  15.  
  16. self.Tur = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.Tur#index"));
  17. setVisibility((self.Tur), true);
  18.  
  19. self.PitchArm = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.TractorAnimations.PitchArm#Index"));
  20. self.PitchArmRefNode = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.TractorAnimations.PitchArm#refNode"));
  21.  
  22. self.ScrollParts = Utils.loadScrollers(self.components, self.xmlFile, "vehicle.Paski.Pasek", {}, false);
  23.  
  24. local maska = Utils.indexToObject(self.rootNode, getXMLString(self.xmlFile, "vehicle.maska#index"));
  25. if maska ~= nil then
  26. self.maska = maska;
  27. end;
  28.  
  29. local drzwi_lewe = Utils.indexToObject(self.rootNode, getXMLString(self.xmlFile, "vehicle.drzwi_lewe#index"));
  30. if drzwi_lewe ~= nil then
  31. self.drzwi_lewe = drzwi_lewe;
  32. end;
  33.  
  34. local drzwi_prawe = Utils.indexToObject(self.rootNode, getXMLString(self.xmlFile, "vehicle.drzwi_prawe#index"));
  35. if drzwi_prawe ~= nil then
  36. self.drzwi_prawe = drzwi_prawe;
  37. end;
  38.  
  39. local zaczep = Utils.indexToObject(self.rootNode, getXMLString(self.xmlFile, "vehicle.zaczep#index"));
  40. if zaczep ~= nil then
  41. self.zaczep = zaczep;
  42. end;
  43.  
  44. self.swiatlo_vis = Utils.indexToObject(self.components, getXMLString(self.xmlFile,"vehicle.swiatlo2#index"));
  45. self.swiatlo2 = true;
  46. setVisibility(self.swiatlo_vis, not self.swiatlo2);
  47.  
  48. openSoundFile = Utils.getFilename("Dzwieki/Elementy/maska_otwieranie.wav", self.baseDirectory);
  49. self.openSoundId = createSample("Sample");
  50. loadSample(self.openSoundId, openSoundFile, false);
  51. self.openPlaying = false;
  52.  
  53. clouseSoundFile = Utils.getFilename("Dzwieki/Elementy/maska_otwieranie.wav", self.baseDirectory);
  54. self.clouseSoundId = createSample("Sample");
  55. loadSample(self.clouseSoundId, clouseSoundFile, false);
  56. self.clousePlaying = false;
  57.  
  58. open1SoundFile = Utils.getFilename("Dzwieki/Elementy/zamknij.wav", self.baseDirectory);
  59. self.open1SoundId = createSample("Sample");
  60. loadSample(self.open1SoundId, open1SoundFile, false);
  61. self.open1Playing = false;
  62.  
  63. clouse1SoundFile = Utils.getFilename("Dzwieki/Elementy/otworz.wav", self.baseDirectory);
  64. self.clouse1SoundId = createSample("Sample");
  65. loadSample(self.clouse1SoundId, clouse1SoundFile, false);
  66. self.clouse1Playing = false;
  67.  
  68. open2SoundFile = Utils.getFilename("Dzwieki/Elementy/zamknij.wav", self.baseDirectory);
  69. self.open2SoundId = createSample("Sample");
  70. loadSample(self.open2SoundId, open2SoundFile, false);
  71. self.open2Playing = false;
  72.  
  73. clouse2SoundFile = Utils.getFilename("Dzwieki/Elementy/otworz.wav", self.baseDirectory);
  74. self.clouse2SoundId = createSample("Sample");
  75. loadSample(self.clouse2SoundId, clouse2SoundFile, false);
  76. self.clouse2Playing = false;
  77.  
  78. wycieraczkaSoundFile = Utils.getFilename("Dzwieki/Elementy/wycieraczka.wav", self.baseDirectory);
  79. self.wycieraczkaSoundId = createSample("LizardHor12nSound");
  80. loadSample(self.wycieraczkaSoundId, wycieraczkaSoundFile, false);
  81. self.wycieraczkaPlaying = false;
  82.  
  83. self.deszcz0 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz0#index"));
  84. self.deszcz1 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz1#index"));
  85. self.deszcz2 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz2#index"));
  86. self.deszcz3 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz3#index"));
  87. self.deszcz4 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz4#index"));
  88. self.deszcz5 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz5#index"));
  89. self.deszcz6 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz6#index"));
  90. self.deszcz7 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz7#index"));
  91. self.deszcz8 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz8#index"));
  92. self.deszcz9 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz9#index"));
  93. self.deszcz10 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz10#index"));
  94. self.deszcz11 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz11#index"));
  95. self.deszcz12 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz12#index"));
  96. self.deszcz13 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz13#index"));
  97. self.deszcz14 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.deszcz14#index"));
  98.  
  99. self.isSelectable = true;
  100.  
  101. self.reka = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.reka#index"));
  102. setVisibility((self.reka), true);
  103.  
  104. self.reka_act = true;
  105.  
  106. self.drzwi_zamkniete = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.drzwi_zamkniete#index"));
  107. setVisibility((self.drzwi_zamkniete), true);
  108.  
  109. self.drzwi_otwarte = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.drzwi_otwarte#index"));
  110. setVisibility((self.drzwi_otwarte), false);
  111.  
  112. self.drzwi_zamkniete_1 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.drzwi_zamkniete_1#index"));
  113. setVisibility((self.drzwi_zamkniete_1), true);
  114.  
  115. self.drzwi_otwarte_1 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.drzwi_otwarte_1#index"));
  116. setVisibility((self.drzwi_otwarte_1), false);
  117.  
  118. function C360:delete()
  119. if self.wycieraczkaPlaying ~= nil then
  120. delete(self.wycieraczkaSoundId)
  121. end;
  122. end;
  123.  
  124. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  125. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  126. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  127. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  128. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  129. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  130. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  131. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  132. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  133. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  134. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  135. print("Mod wykonany przez Adriana Watkowskiego. GG: 32660791");
  136.  
  137. function C360:attachImplement(implement)
  138. local jointType = implement.object.attacherJoint.jointType;
  139. local jointIndex = implement.jointDescIndex;
  140.  
  141. if jointType == Vehicle.JOINTTYPE_IMPLEMENT then
  142. if jointIndex == 1 then
  143. setVisibility((self.Belka), false);
  144. setVisibility((self.Sruba), true);
  145. end;
  146. end;
  147. if jointType == Vehicle.JOINTTYPE_TRAILER then
  148. if jointIndex == 2 then
  149. setVisibility((self.Belka), true);
  150. setVisibility((self.Sruba), false);
  151. end;
  152. elseif jointType == Vehicle.JOINTTYPE_TRAILERLOW then
  153. if jointIndex == 3 then
  154. setVisibility((self.Belka), true);
  155. setVisibility((self.Sruba), false);
  156. end;
  157. end;
  158. if jointType == Vehicle.JOINTTYPE_ATTACHABLEFRONTLOADER then
  159. if jointIndex == 4 then
  160. setVisibility((self.Tur), false);
  161. end;
  162. end;
  163. self.updateJoint = true;
  164. end;
  165.  
  166. function C360:detachImplement(implementIndex)
  167. local implement = self.attachedImplements[implementIndex];
  168. local jointIndex = implement.jointDescIndex;
  169.  
  170. if jointIndex == 1 then
  171. setVisibility((self.Belka), true);
  172. setVisibility((self.Sruba), false);
  173. end;
  174. if jointIndex == 2 then
  175. setVisibility((self.Belka), true);
  176. setVisibility((self.Sruba), false);
  177. end
  178. if jointIndex == 3 then
  179. setVisibility((self.Belka), true);
  180. setVisibility((self.Sruba), false);
  181. end;
  182.  
  183. if jointIndex == 4 then
  184. setVisibility((self.Tur), true);
  185. end;
  186. end;
  187.  
  188. function C360:keyEvent(unicode, sym, modifier, isDown)
  189. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  190. if isDown and sym == Input.KEY_KP_9 then
  191. self.swiatlo2 = not self.swiatlo2;
  192. end;
  193. end;
  194.  
  195. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  196. if isDown and sym == Input.KEY_KP_7 then
  197. self.wycieraczka = not self.wycieraczka;
  198. end;
  199. end;
  200. end;
  201.  
  202. function C360:update(dt)
  203. if self.animationParts[4].clipEndTime then
  204. setVisibility(self.drzwi_otwarte,true);
  205. setVisibility(self.drzwi_zamkniete,false);
  206. --setRigidBodyType(drzwi_otwarte, "NoRigidBody");
  207. else
  208. setVisibility(self.drzwi_otwarte,false);
  209. setVisibility(self.drzwi_zamkniete,true);
  210. --setRigidBodyType(self.drzwi_otwarte, "Dynamic");
  211. end;
  212.  
  213. if self.animationParts[5].clipEndTime then
  214. setVisibility(self.drzwi_otwarte_1,true);
  215. setVisibility(self.drzwi_zamkniete_1,false);
  216. --setRigidBodyType(drzwi_otwarte_1, "NoRigidBody");
  217. else
  218. setVisibility(self.drzwi_otwarte_1,false);
  219. setVisibility(self.drzwi_zamkniete_1,true);
  220. --setRigidBodyType(self.drzwi_otwarte_1, "Dynamic");
  221. end;
  222.  
  223.  
  224. --[[if self.camIndex == 1 then
  225. setVisibility(self.armNode, true);
  226. else
  227. setVisibility(self.armNode, false);
  228. end;]]
  229.  
  230. if self.isMotorStarted then
  231. if self.lastSpeed*3600 >= 25 then
  232. g_currentMission:showBlinkingWarning(g_i18n:getText("AdrianXDDDDD"));
  233. end;
  234. self:setAnimationTime(26, self.animationParts[26].animDuration);
  235. else
  236. self:setAnimationTime(26, self.animationParts[26].offSet);
  237. end;
  238.  
  239. if g_currentMission.environment.lastRainScale > 0.1 and g_currentMission.environment.timeSinceLastRain < 30 then
  240. setVisibility(self.deszcz0, true);
  241. setVisibility(self.deszcz1, true);
  242. setVisibility(self.deszcz2, true);
  243. setVisibility(self.deszcz3, true);
  244. setVisibility(self.deszcz4, true);
  245. setVisibility(self.deszcz5, true);
  246. setVisibility(self.deszcz6, true);
  247. setVisibility(self.deszcz7, true);
  248. setVisibility(self.deszcz8, true);
  249. setVisibility(self.deszcz9, true);
  250. setVisibility(self.deszcz10, true);
  251. setVisibility(self.deszcz11, true);
  252. setVisibility(self.deszcz12, true);
  253. setVisibility(self.deszcz13, true);
  254. setVisibility(self.deszcz14, true);
  255. else
  256. setVisibility(self.deszcz0, false);
  257. setVisibility(self.deszcz1, false);
  258. setVisibility(self.deszcz2, false);
  259. setVisibility(self.deszcz3, false);
  260. setVisibility(self.deszcz4, false);
  261. setVisibility(self.deszcz5, false);
  262. setVisibility(self.deszcz6, false);
  263. setVisibility(self.deszcz7, false);
  264. setVisibility(self.deszcz8, false);
  265. setVisibility(self.deszcz9, false);
  266. setVisibility(self.deszcz10, false);
  267. setVisibility(self.deszcz11, false);
  268. setVisibility(self.deszcz12, false);
  269. setVisibility(self.deszcz13, false);
  270. setVisibility(self.deszcz14, false);
  271. end;
  272.  
  273. if self.PitchArm ~= nil then
  274. local x, y, z = getRotation(self.PitchArmRefNode);
  275. setRotation(self.PitchArm, x * (-1.5), y, z);
  276. end;
  277.  
  278. if self.setHydraulicTime > 0 then
  279. for k,v in pairs(self.hydraulics) do
  280. self:setHydraulicDirection(k);
  281. end;
  282. self.setHydraulicTime = self.setHydraulicTime - 1;
  283. end;
  284.  
  285. if self:getIsActive() then
  286. self.setHydraulicTime = 30;
  287. end;
  288.  
  289. if self:getIsActive() then
  290. if self.rotationPartLeft ~= nil then
  291. local x, y, z = getRotation(self.rotationPartLeft.node);
  292. x = (self.rotationPartLeft.maxRot[1] - self.rotationPartLeft.minRot[1]) * (self.rotatedTime/-1);
  293. setRotation(self.rotationPartLeft.node, x, y ,z);
  294. end;
  295. end;
  296.  
  297. if self.isMotorStarted then
  298. self:setAnimationTime(1, 1);
  299. self:setAnimationTime(7, 1);
  300. self:setAnimationTime(23, 1);
  301. self:setAnimationTime(24, 1);
  302. self:setAnimationTime(25, 1);
  303. else
  304. self:setAnimationTime(1, 0);
  305. self:setAnimationTime(7, 0);
  306. self:setAnimationTime(23, 0);
  307. self:setAnimationTime(24, 0);
  308. self:setAnimationTime(25, 0);
  309. end;
  310.  
  311. if self.isClient then
  312. Utils.updateScrollers(self.ScrollParts, dt, self.isMotorStarted);
  313. end;
  314.  
  315. local nearestDistance = 1;
  316. local vx, vy, vz = getWorldTranslation(g_currentMission.player.rootNode);
  317. local px, py, pz = getWorldTranslation(self.maska);
  318. local distance = Utils.vector3Length(px-vx, py-vy, pz-vz);
  319. if distance < nearestDistance then
  320. self.przy_maska = true;
  321. else
  322. self.przy_maska = false;
  323. end;
  324.  
  325. if self.przy_maska then
  326. if InputBinding.hasEvent(InputBinding.maska_c360) then
  327. if self.animationParts[2].clipEndTime then
  328. self:setAnimationTime(2, self.animationParts[2].offSet);
  329. self.sound1 = false;
  330. self.sound2 = true;
  331. elseif self.animationParts[2].clipStartTime then
  332. self:setAnimationTime(2, self.animationParts[2].animDuration);
  333. self.sound1 = true;
  334. self.sound2 = false;
  335. end;
  336. end;
  337. end;
  338.  
  339. if self.przy_maska then
  340. if self.animationParts[2].clipStartTime then
  341. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("otworz_maska_c360")), InputBinding.maska_c360);
  342. else
  343. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("zamknij_maska_c360")), InputBinding.maska_c360);
  344. end;
  345. end;
  346.  
  347. if self.isEntered then
  348. setVisibility(self.swiatlo_vis, not self.swiatlo2);
  349. end;
  350.  
  351.  
  352. if self.isEntered then
  353. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  354. if self.swiatlo2 then
  355. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("wlacz_swiatlo2_c360")), InputBinding.swiatlo2_c360);
  356. else
  357. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("wylacz_swiatlo2_c360")), InputBinding.swiatlo2_c360);
  358. end;
  359. end;
  360. end;
  361.  
  362. if self.sound1 then
  363. if not self.openPlaying then
  364. playSample(self.openSoundId, 1, 3, 3);
  365. self.openPlaying = true;
  366. end;
  367. else
  368. if self.openPlaying then
  369. stopSample(self.openSoundId);
  370. self.openPlaying = false;
  371. end;
  372. end;
  373.  
  374. if self.sound2 then
  375. if not self.clousePlaying then
  376. playSample(self.clouseSoundId, 1, 3, 3);
  377. self.clousePlaying = true;
  378. end;
  379. else
  380. if self.clousePlaying then
  381. stopSample(self.clouseSoundId);
  382. self.clousePlaying = false;
  383. end;
  384. end;
  385.  
  386. if self.sound3 then
  387. if not self.open1Playing then
  388. playSample(self.open1SoundId, 1, 3, 3);
  389. self.open1Playing = true;
  390. end;
  391. else
  392. if self.open1Playing then
  393. stopSample(self.open1SoundId);
  394. self.open1Playing = false;
  395. end;
  396. end;
  397.  
  398. if self.sound4 then
  399. if not self.clouse1Playing then
  400. playSample(self.clouse1SoundId, 1, 3, 3);
  401. self.clouse1Playing = true;
  402. end;
  403. else
  404. if self.clouse1Playing then
  405. stopSample(self.clouse1SoundId);
  406. self.clouse1Playing = false;
  407. end;
  408. end;
  409.  
  410. if self.sound5 then
  411. if not self.open2Playing then
  412. playSample(self.open2SoundId, 1, 3, 3);
  413. self.open2Playing = true;
  414. end;
  415. else
  416. if self.open2Playing then
  417. stopSample(self.open2SoundId);
  418. self.open2Playing = false;
  419. end;
  420. end;
  421.  
  422. if self.sound6 then
  423. if not self.clouse2Playing then
  424. playSample(self.clouse2SoundId, 1, 3, 3);
  425. self.clouse2Playing = true;
  426. end;
  427. else
  428. if self.clouse2Playing then
  429. stopSample(self.clouse2SoundId);
  430. self.clouse2Playing = false;
  431. end;
  432. end;
  433.  
  434. if self.przy_maska then
  435. if Input.isKeyPressed(Input.KEY_n) then
  436. self:setAnimationTime(3,self.animationParts[3].animDuration);
  437. else
  438. self:setAnimationTime(3,self.animationParts[3].offSet);
  439. end;
  440. end;
  441.  
  442. if self.przy_maska then
  443. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("pompka_paliwa_c360")), InputBinding.pompka_c360);
  444. end;
  445.  
  446. local nearestDistance = 1.5;
  447. local vx, vy, vz = getWorldTranslation(g_currentMission.player.rootNode);
  448. local px, py, pz = getWorldTranslation(self.drzwi_lewe);
  449. local distance = Utils.vector3Length(px-vx, py-vy, pz-vz);
  450. if distance < nearestDistance then
  451. self.przy_drzwi_lewe = true;
  452. else
  453. self.przy_drzwi_lewe = false;
  454. end;
  455.  
  456. if self.przy_drzwi_lewe then
  457. if InputBinding.hasEvent(InputBinding.drzwi_lewe_c360) then
  458. if self.animationParts[4].clipEndTime then
  459. self:setAnimationTime(4, self.animationParts[4].offSet);
  460. self.sound3 = true;
  461. self.sound4 = false;
  462. elseif self.animationParts[4].clipStartTime then
  463. self:setAnimationTime(4, self.animationParts[4].animDuration);
  464. self.sound3 = false;
  465. self.sound4 = true;
  466. end;
  467. end;
  468. end;
  469.  
  470. if self.isEntered then
  471. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  472. if InputBinding.hasEvent(InputBinding.drzwi_lewe_c360) then
  473. if self.animationParts[4].clipEndTime then
  474. self:setAnimationTime(4, self.animationParts[4].offSet);
  475. self.sound3 = true;
  476. self.sound4 = false;
  477. elseif self.animationParts[4].clipStartTime then
  478. self:setAnimationTime(4, self.animationParts[4].animDuration);
  479. self.sound3 = false;
  480. self.sound4 = true;
  481. end;
  482. end;
  483. end;
  484. end;
  485.  
  486. if self.isEntered then
  487. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  488. if self.animationParts[4].clipStartTime then
  489. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("otworz_drzwi_lewe_c360")), InputBinding.drzwi_lewe_c360);
  490. else
  491. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("zamknij_drzwi_lewe_c360")), InputBinding.drzwi_lewe_c360);
  492. end;
  493. end;
  494. end;
  495.  
  496. if self.przy_drzwi_lewe then
  497. if self.animationParts[4].clipStartTime then
  498. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("otworz_drzwi_out_c360")), InputBinding.drzwi_lewe_c360);
  499. else
  500. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("zamknij_drzwi_out_c360")), InputBinding.drzwi_lewe_c360);
  501. end;
  502. end;
  503.  
  504. local nearestDistance = 1.5;
  505. local vx, vy, vz = getWorldTranslation(g_currentMission.player.rootNode);
  506. local px, py, pz = getWorldTranslation(self.drzwi_prawe);
  507. local distance = Utils.vector3Length(px-vx, py-vy, pz-vz);
  508. if distance < nearestDistance then
  509. self.przy_drzwi_prawe = true;
  510. else
  511. self.przy_drzwi_prawe = false;
  512. end;
  513.  
  514. if self.przy_drzwi_prawe then
  515. if InputBinding.hasEvent(InputBinding.drzwi_prawe_c360) then
  516. if self.animationParts[5].clipEndTime then
  517. self:setAnimationTime(5, self.animationParts[5].offSet);
  518. self.sound5 = true;
  519. self.sound6 = false;
  520. elseif self.animationParts[5].clipStartTime then
  521. self:setAnimationTime(5, self.animationParts[5].animDuration);
  522. self.sound5 = false;
  523. self.sound6 = true;
  524. end;
  525. end;
  526. end;
  527.  
  528. if self.isEntered then
  529. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  530. if InputBinding.hasEvent(InputBinding.drzwi_prawe_c360) then
  531. if self.animationParts[5].clipEndTime then
  532. self:setAnimationTime(5, self.animationParts[5].offSet);
  533. self.sound5 = true;
  534. self.sound6 = false;
  535. elseif self.animationParts[5].clipStartTime then
  536. self:setAnimationTime(5, self.animationParts[5].animDuration);
  537. self.sound5 = false;
  538. self.sound6 = true;
  539. end;
  540. end;
  541. end;
  542. end;
  543.  
  544. if self.isEntered then
  545. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  546. if self.animationParts[5].clipStartTime then
  547. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("otworz_drzwi_prawe_c360")), InputBinding.drzwi_prawe_c360);
  548. else
  549. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("zamknij_drzwi_prawe_c360")), InputBinding.drzwi_prawe_c360);
  550. end;
  551. end;
  552. end;
  553.  
  554. if self.przy_drzwi_prawe then
  555. if self.animationParts[5].clipStartTime then
  556. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("otworz_drzwi_out_c360")), InputBinding.drzwi_prawe_c360);
  557. else
  558. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("zamknij_drzwi_out_c360")), InputBinding.drzwi_prawe_c360);
  559. end;
  560. end;
  561.  
  562. if self.realLightsActive then
  563. self:setAnimationTime(6,self.animationParts[6].animDuration);
  564. else
  565. self:setAnimationTime(6,self.animationParts[6].offSet);
  566. end;
  567.  
  568. if self.isClient then
  569. if self.isEntered then
  570. if not self.brakeLightsVisibility then
  571. if self.animationParts[8].clipEndTime then
  572. self:setAnimationTime(8, self.animationParts[8].offSet);
  573. end;
  574. end;
  575. if self.brakeLightsVisibility then
  576. if self.animationParts[8].clipStartTime then
  577. self:setAnimationTime(8, self.animationParts[8].animDuration);
  578. end;
  579. end;
  580. end;
  581. end;
  582.  
  583. if self.handbrake then
  584. self:setAnimationTime(9,self.animationParts[9].animDuration);
  585. else
  586. self:setAnimationTime(9,self.animationParts[9].offSet);
  587. end;
  588.  
  589. if self.isEntered then
  590. if self.movingDirection > 0 then
  591. if not self.isHired then
  592. if Input.isKeyPressed(Input.KEY_w) or self.lastSpeed*3600 > 1 then
  593. self:setAnimationTime(11,self.animationParts[11].animDuration);
  594. else
  595. self:setAnimationTime(11,self.animationParts[11].offSet);
  596. end;
  597. end;
  598. end;
  599. end;
  600.  
  601. if self.isEntered then
  602. if not self.brakeLightsVisibility then
  603. if not self.isHired then
  604. if self.movingDirection < 0 then
  605. if Input.isKeyPressed(Input.KEY_s) and self.lastSpeed*3600 > 1 then
  606. self:setAnimationTime(12,self.animationParts[12].animDuration);
  607. else
  608. self:setAnimationTime(12,self.animationParts[12].offSet);
  609. end;
  610. end;
  611. end;
  612. end;
  613. end;
  614.  
  615. if self.isEntered then
  616. if not self.brakeLightsVisibility and self.lastSpeed*3600 < 1 then
  617. if Input.isKeyPressed(Input.KEY_w) or Input.isKeyPressed(Input.KEY_s) then
  618. self:setAnimationTime(22,self.animationParts[22].animDuration);
  619. else
  620. self:setAnimationTime(22,self.animationParts[22].offSet);
  621. end;
  622. end;
  623. end;
  624.  
  625. local nearestDistance = 1;
  626. local vx, vy, vz = getWorldTranslation(g_currentMission.player.rootNode);
  627. local px, py, pz = getWorldTranslation(self.zaczep);
  628. local distance = Utils.vector3Length(px-vx, py-vy, pz-vz);
  629. if distance < nearestDistance then
  630. self.przy_zaczep = true;
  631. else
  632. self.przy_zaczep = false;
  633. end;
  634.  
  635. if self.isEntered then
  636. if self.wycieraczka then
  637. self:setAnimationTime(14, 1);
  638. self.sound7 = true;
  639. else
  640. self:setAnimationTime(14, 0);
  641. self.sound7 = false;
  642. end;
  643. end;
  644.  
  645. if self.isEntered then
  646. if self.sound7 then
  647. if not self.wycieraczkaPlaying then
  648. playSample(self.wycieraczkaSoundId, 0, 1, 0);
  649. self.wycieraczkaPlaying = true;
  650. end;
  651. else
  652. if self.wycieraczkaPlaying then
  653. stopSample(self.wycieraczkaSoundId);
  654. self.wycieraczkaPlaying = false;
  655. end;
  656. end;
  657. end;
  658.  
  659. if not self.isEntered then
  660. if self.sound7 then
  661. if self.wycieraczkaPlaying then
  662. stopSample(self.wycieraczkaSoundId);
  663. self.wycieraczkaPlaying = false;
  664. end;
  665. end;
  666. end;
  667.  
  668. if self.isEntered then
  669. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  670. if InputBinding.hasEvent(InputBinding.dach_c360) then
  671. if self.animationParts[15].clipEndTime then
  672. self:setAnimationTime(15, self.animationParts[15].offSet);
  673. elseif self.animationParts[15].clipStartTime then
  674. self:setAnimationTime(15, self.animationParts[15].animDuration);
  675. end;
  676. end;
  677. end;
  678. end;
  679.  
  680. if self.isEntered then
  681. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  682. if self.animationParts[15].clipStartTime then
  683. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("otworz_dach_c360")), InputBinding.dach_c360);
  684. else
  685. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("zamknij_dach_c360")), InputBinding.dach_c360);
  686. end;
  687. end;
  688. end;
  689.  
  690. if self.isEntered then
  691. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  692. if InputBinding.hasEvent(InputBinding.szyba_c360) then
  693. if self.animationParts[16].clipEndTime then
  694. self:setAnimationTime(16, self.animationParts[16].offSet);
  695. elseif self.animationParts[16].clipStartTime then
  696. self:setAnimationTime(16, self.animationParts[16].animDuration);
  697. end;
  698. end;
  699. end;
  700. end;
  701.  
  702. if self.isEntered then
  703. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  704. if self.animationParts[16].clipStartTime then
  705. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("otworz_szyba_c360")), InputBinding.szyba_c360);
  706. else
  707. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("zamknij_szyba_c360")), InputBinding.szyba_c360);
  708. end;
  709. end;
  710. end;
  711.  
  712. if self.isEntered then
  713. if self.lastSpeed*3600 > 12 then
  714. self:setAnimationTime(17,self.animationParts[17].animDuration);
  715. else
  716. self:setAnimationTime(17,self.animationParts[17].offSet);
  717. end;
  718. end;
  719.  
  720. if self.isEntered then
  721. if self.movingDirection > 0 then
  722. if self.lastSpeed*3600 > 1 then
  723. if Input.isKeyPressed(Input.KEY_w) then
  724. self:setAnimationTime(18,self.animationParts[18].animDuration);
  725. else
  726. self:setAnimationTime(18,self.animationParts[18].offSet);
  727. end;
  728. end;
  729. end;
  730. end;
  731.  
  732. if self.isEntered then
  733. if self.movingDirection < 0 then
  734. if self.lastSpeed*3600 > 1 then
  735. if Input.isKeyPressed(Input.KEY_s) then
  736. self:setAnimationTime(18,self.animationParts[18].animDuration);
  737. else
  738. self:setAnimationTime(18,self.animationParts[18].offSet);
  739. end;
  740. end;
  741. end;
  742. end;
  743.  
  744. if self.isEntered then
  745. if Input.isKeyPressed(Input.KEY_b) then
  746. if self.animationParts[20].clipEndTime then
  747. self:setAnimationTime(20, self.animationParts[20].offSet);
  748. elseif self.animationParts[20].clipStartTime then
  749. self:setAnimationTime(20, self.animationParts[20].animDuration);
  750. end;
  751. end;
  752. end;
  753.  
  754. if self.isEntered then
  755. if Input.isKeyPressed(Input.KEY_0) then
  756. self:setAnimationTime(21,self.animationParts[21].animDuration);
  757. else
  758. self:setAnimationTime(21,self.animationParts[21].offSet);
  759. end;
  760. end;
  761.  
  762. if self.isEntered then
  763. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  764. if self.wycieraczka then
  765. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("wycieraczka_stop_c360")), InputBinding.wycieraczka_c360);
  766. else
  767. g_currentMission:addHelpButtonText(string.format(g_i18n:getText("wycieraczka_c360")), InputBinding.wycieraczka_c360);
  768. end;
  769. end;
  770. end;
  771.  
  772. if self.reka_act then
  773. setVisibility(self.reka,true);
  774. else
  775. setVisibility(self.reka,false);
  776. end;
  777.  
  778. if self.isEntered then
  779. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  780. if InputBinding.hasEvent(InputBinding.reka_1) then
  781. self.reka_act = not self.reka_act;
  782. end;
  783. end;
  784. end;
  785. end;
  786.  
  787.  
  788. function C360:getSaveAttributesAndNodes(nodeIdent)
  789. if self.reka_act then
  790. reka_act = "true";
  791. else
  792. reka_act = "false";
  793. end;
  794.  
  795. local attributes = string.format('reka_act="%s"',reka_act);
  796. return attributes,nodes;
  797. end;
  798.  
  799. function C360:setHydraulicDirection(index)
  800. local hydraulic = self.hydraulics[index];
  801.  
  802. if hydraulic.fixPoint ~= nil then
  803. local ax, ay, az = getWorldTranslation(hydraulic.node);
  804. local bx, by, bz = getWorldTranslation(hydraulic.fixPoint);
  805. local x, y, z = worldDirectionToLocal(getParent(hydraulic.node), bx-ax, by-ay, bz-az);
  806. local xUp, yUp, zUp = unpack(hydraulic.upVectors);
  807. setDirection(hydraulic.node, x, y, z, xUp, yUp, zUp);
  808. if hydraulic.punch ~= nil then
  809. local distance = Utils.vector3Length(ax-bx, ay-by, az-bz);
  810. setTranslation(hydraulic.punch, 0, 0, distance-hydraulic.punchDistance);
  811. end;
  812. end;
  813. end;
  814.  
  815. function C360:setRopePanel(isRopePanel)
  816. end;
  817.  
  818. function C360:mouseEvent(posX, posY, isDown, isUp, button)
  819. end;
  820.  
  821. function C360:validateAttacherJoint(implement, jointDesc, dt)
  822. return true;
  823. end;
  824.  
  825. function C360:draw()
  826. if self.isEntered then
  827. if self:getIsActiveForInput(self.needsSelection) and not self:hasInputConflictWithSelection() then
  828. g_currentMission:addExtraPrintText(g_i18n:getText("funkcje_1"));
  829. if Input.isKeyPressed(Input.KEY_lshift) then
  830. if self.reka_act then
  831. setTextBold(true);
  832. renderText(0.72, 0.785, 0.015, g_i18n:getText("reka_2"));
  833. else
  834. setTextBold(true);
  835. renderText(0.72, 0.785, 0.015, g_i18n:getText("reka_1"));
  836. end;
  837. if self.animacja_act then
  838. setTextBold(true);
  839. renderText(0.72, 0.77, 0.015, g_i18n:getText("animacja_2"));
  840. else
  841. setTextBold(true);
  842. renderText(0.72, 0.77, 0.015, g_i18n:getText("animacja_1"));
  843. end;
  844. end;
  845. end;
  846. end;
  847. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement