Advertisement
Guest User

Untitled

a guest
Jul 17th, 2014
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.52 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <!DOCTYPE TranscendenceExtension
  3. [
  4. ;6300-Souped up Auton Bay
  5. ;Mu for 'Multiverse'
  6. <!ENTITY MuSuAB "0xE1286300">
  7. <!ENTITY vtCheckingstation "0xE1286301">
  8. <!ENTITY dsRPCModifyAuton "0xE1286302">
  9. <!ENTITY dsRPCRemoveItem "0xE1286303">
  10.  
  11. ;overrides
  12. <!ENTITY dsAutonBay "0x00810251">
  13. <!ENTITY dsAutonBay "0x00810251">
  14. <!ENTITY dsAutonBayRepairArmor "0x00810252">
  15. <!ENTITY dsAutonBayReplaceArmor "0x00810253">
  16. <!ENTITY dsAutonBayInstallDevice "0x00810254">
  17. ]>
  18. <TranscendenceExtension UNID="&MuSuAB;" APIversion="22" name="Souped up Auton Bay" credit="RPC, Shrike for ideas, PM's Playership Drones for inspiration">
  19.  
  20. <!--- This station will take care of all the work --->
  21.  
  22. <StationType UNID="&vtCheckingstation;"
  23. name= "DockScreen Controller"
  24. scale= "world"
  25. backgroundObject= "true"
  26. sovereign= "&svIndependent;"
  27. virtual= "True"
  28. >
  29. <ImageVariants>
  30. <Image imageID="&rsWorlds2;" imageX="0" imageY="0" imageWidth="1" imageHeight="1" />
  31. </ImageVariants>
  32. </StationType>
  33.  
  34. <DockScreen UNID="&dsAutonBay;"
  35. type= "itemPicker"
  36. backgroundID= "&rsItemListScreen;"
  37. >
  38. <!--
  39. -->
  40. <ListOptions
  41. dataFrom= "player"
  42. list= "* +auton;"
  43.  
  44. initialItem="
  45. (or
  46. (not (scrGetData gScreen 'currentAuton))
  47. (itmIsEqual (scrGetItem gScreen) (scrGetData gScreen 'currentAuton))
  48. )"
  49. />
  50.  
  51. <Panes>
  52. <Default>
  53. <OnPaneInit>
  54. (block (autonItem autonConfig desc enableRepairs)
  55.  
  56. (setq autonItem (scrGetItem gScreen))
  57.  
  58. ; Compile the auton configuration, based either on the stored
  59. ; data or on the original auton ship class.
  60.  
  61. (setq autonConfig (rpgGetAutonConfig autonItem))
  62.  
  63. ; Set the description
  64.  
  65. (switch
  66. (not autonItem)
  67. (setq desc "There are no autons in the bay.")
  68.  
  69. (not autonConfig)
  70. (setq desc "Unknown auton")
  71.  
  72. (not (itmIsKnown autonItem))
  73. (setq desc "Unfortunately, the bay cannot manipulate unknown autons.")
  74.  
  75. (block (armorName armorCount armorHP armorMaxHP armorDamage weaponName shieldName miscName)
  76.  
  77. ; Armor
  78.  
  79. (setq armorCount 0)
  80. (setq armorHP 0)
  81. (setq armorMaxHP 0)
  82. (enum (@ autonConfig 'armor) armorDesc
  83. (block Nil
  84. (setq armorCount (add armorCount 1))
  85. (if (not armorName)
  86. (setq armorName (itmGetName (@ armorDesc 'item) 0x80))
  87. )
  88. (setq armorHP (add armorHP (@ armorDesc 'hp)))
  89. (setq armorMaxHP (add armorMaxHP (itmGetProperty (@ armorDesc 'item) 'completeHP)))
  90. )
  91. )
  92.  
  93. (setq armorDamage
  94. (if (gr armorMaxHP 0)
  95. (divide (multiply 100 (subtract armorMaxHp armorHP)) armorMaxHP)
  96. 0
  97. )
  98. )
  99.  
  100. ; Devices
  101.  
  102. (enum (@ autonConfig 'devices) deviceDesc
  103. (block (deviceItem deviceCat)
  104. (setq deviceItem (@ deviceDesc 'item))
  105. (setq deviceCat (itmGetProperty deviceItem 'category))
  106.  
  107. (switch
  108. (eq deviceCat 'weapon)
  109. (setq weaponName (itmGetName deviceItem 0x80))
  110.  
  111. (eq deviceCat 'shields)
  112. (setq shieldName (itmGetName deviceItem 0x80))
  113.  
  114. (eq deviceCat 'device)
  115. (setq miscName (itmGetName deviceItem 0x80))
  116. )
  117. )
  118. )
  119.  
  120. ; Compose
  121.  
  122. (setq desc (cat
  123. "Armor: " (if armorName (cat armorName " &#xD7;" armorCount) "None")
  124. (if (gr armorDamage 0) (cat " (" armorDamage "% damaged)")) "\n"
  125.  
  126. "Weapon: " (if weaponName weaponName "None") "\n"
  127. "Shields: " (if shieldName shieldName "None") "\n"
  128. (if miscName
  129. "Device: " miscName "\n"
  130. ""
  131. )
  132. ))
  133.  
  134. (setq enableRepairs True)
  135. )
  136. )
  137.  
  138. ; Initialize
  139.  
  140. (scrSetDesc gScreen desc)
  141. (scrEnableAction gScreen 0 autonItem)
  142. (scrEnableAction gScreen 1 True)
  143. (scrEnableAction gScreen 2 enableRepairs)
  144. (scrEnableAction gScreen 3 enableRepairs)
  145. )
  146. </OnPaneInit>
  147.  
  148. <Actions>
  149. <Action name="Scramble All" default="1" key="S">
  150. (block (autonItem)
  151. (enum (ObjGetItems gPlayership "* +auton;") autonitem (block Nil
  152. (plyUseItem gPlayer autonItem)
  153. ))
  154. (scrExitScreen gScreen)
  155. )
  156. </Action>
  157.  
  158. <Action name="Recall All" default="1" key="R">
  159. (block (autonItem)
  160. ;enumerate through autons
  161. (enum (sysFindObject nil "*s") autoncandidate (block Nil
  162. (switch
  163. (ObjGetData autoncandidate "invoked")
  164. (block Nil
  165. (switch
  166.  
  167. ; Make sure that there is enough cargo space in the ship to
  168. ; hold the auton.
  169.  
  170. (gr (objFireEvent autoncandidate "CalcMass") (objGetCargoSpaceLeft gSource))
  171. (objSendMessage gSource autoncandidate (objTranslate autoncandidate 'ErrNoSpaceToReturn "\"Not enough space in cargo hold to return to ship\""))
  172.  
  173. ; Return
  174.  
  175. (block Nil
  176. (shpCancelOrders autoncandidate)
  177. (shpOrder autoncandidate 'gate gSource)
  178.  
  179. (objSetData autoncandidate 'behavior 'returning)
  180. (objSendMessage gSource autoncandidate (objTranslate autoncandidate 'ReturnAck "\"Auton order acknowledged\""))
  181. )
  182. )
  183. (scrExitScreen gScreen)
  184. )
  185. (scrSetDesc gScreen "No autons to recall.")
  186. )
  187. ))
  188. )
  189. </Action>
  190.  
  191. <Action name="Launch Auton" default="1" key="L">
  192. (block (autonItem)
  193. (setq autonItem (scrGetItem gScreen))
  194. (scrExitScreen gScreen)
  195. (plyUseItem gPlayer autonItem)
  196. )
  197. </Action>
  198.  
  199. <Action name="Modify Auton" default="1" key="M">
  200. (block Nil
  201. (setq autonItem (scrGetItem gScreen))
  202. (ScrShowScreen gScreen &dsRPCModifyAuton;)
  203. )
  204. </Action>
  205.  
  206. <Action name="Cancel" cancel="1" key="C">
  207. <Exit/>
  208. </Action>
  209. </Actions>
  210. </Default>
  211. </Panes>
  212. </DockScreen>
  213.  
  214. <DockScreen UNID="&dsRPCModifyAuton;"
  215. backgroundID= "none"
  216. nestedScreen= "true"
  217. >
  218. <Display>
  219. <!--
  220. LEGEND:
  221. idea:
  222. <text makes a box of text
  223. REMEMBER left=255 is right of right=0
  224.  
  225. left: leftmost border
  226.  
  227.  
  228. right: rightmost border
  229. 0 is at the center, leaning towards the left
  230. negative moves the text box to the right from the center (from right= 0)
  231. positive moves the text bos to the right from the leftmost border
  232.  
  233. top: topmost border
  234. positive is how many pixels the top border should start from the top of the screen
  235.  
  236. <image puts in an image
  237.  
  238.  
  239. left="12" right="-44" top="12" height="100" align="center" transparent="true"
  240.  
  241.  
  242. valign="center"
  243. -->
  244. <Image left="0" right="-44" top="12" height="100" align="right" transparent="true">
  245. (itmGetImageDesc autonItem)
  246. </Image>
  247.  
  248. <Text left="0" right="-44" top="12" height="40" align="center" font="SubTitle" color="255,210,152">
  249. (itmGetName autonItem 0x020)
  250. </Text>
  251.  
  252. <Text left="0" right="0" width="250" top="50" bottom="-140" align="right" font="MediumBold" color="200,206,199">
  253. (cat
  254. "device slots:\n"
  255. "Weapon slots:\n"
  256. "Non Weapon slots:\n"
  257. "max power:\n"
  258. "max speed:\n"
  259. "armor:\n"
  260. "max armor mass:\n"
  261. "shields:\n"
  262. "weapons:\n"
  263. )
  264. </Text>
  265.  
  266. <Text left="255" width="250" top="50" bottom="-140" align="left" font="Medium" color="200,206,199">
  267. (block (autonthingy armorItem autonConfig armorTypes armorString shieldItem allWeapons string)
  268. (setq autonthingy (rpgCreateSuspendedAuton gSource autonItem))
  269. (setq armorItem (item (objGetItems gPlayership "aI") 0))
  270.  
  271. ;init armorTypes
  272. (setq armorTypes "")
  273. (setq armorString "")
  274. (setq autonConfig (rpgGetAutonConfig autonItem))
  275. (enum (@ autonConfig 'armor) armorDesc
  276. (block Nil
  277. ;make a list of all the armor types
  278. (switch
  279. (eq armorTypes "")
  280. (setq armorTypes (list (itmGetType (@ armorDesc 'item))))
  281. ;else
  282. (block Nil
  283. (setq armorTypes (Append armorTypes (list (itmGetType (@ armorDesc 'item)))))
  284. )
  285. )
  286. )
  287. )
  288. ;get rid of duplicate armor types
  289. (enum armorTypes UNID (block Nil
  290. ;remove all duplicates
  291. (setq armorTypes (filter armorTypes UNIDinList
  292. (not (eq UNID UNIDinList))
  293. ))
  294. ;add it back in since we removed all instances of UNID
  295. (setq armorTypes (Append armorTypes UNID))
  296. ))
  297.  
  298. (setq shieldItem (item (objGetItems gPlayership "sI") 0))
  299.  
  300. ; Get the list of weapons
  301. (setq allWeapons "")
  302. (enum (objGetItems autonthingy "wI") theWeapon (block Nil
  303. (Printto 'log (TypGetDataField (itmGetType theWeapon) 'name))
  304. (switch
  305. (eq AllWeapons "")
  306. (block Nil
  307. (setq AllWeapons (cat (TypGetDataField (itmGetType theWeapon) 'name)))
  308. )
  309. (setq AllWeapons (cat AllWeapons ", "(TypGetDataField (itmGetType theWeapon) 'name)))
  310. )
  311. ))
  312. (if (eq allWeapons "")
  313. (setq allWeapons "None\n")
  314. )
  315. ;START OF THE CAT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  316. (setq string (cat
  317. (typGetDataField (ObjGetType autonthingy) "deviceSlots") "\n"
  318. (typGetDataField (ObjGetType autonthingy) "deviceSlotsWeapons") "\n"
  319. (typGetDataField (ObjGetType autonthingy) "deviceSlotsNonWeapons") "\n"
  320. (divide (typGetDataField (ObjGetType autonthingy) "power") 1000) "MW \n"
  321. (TypGetDataField (itmGetStaticData autonItem "autonShipClass") "maxSpeed") "% lightspeed\n"
  322. (switch
  323. (geq (count armorTypes) 1)
  324. (block Nil
  325. (enum armorTypes element (block Nil
  326. (switch
  327. (eq armorString "")
  328. (setq armorString (TypGetDataField element 'name))
  329. (setq armorString (cat armorString ", " (TypGetDataField element 'name)))
  330. )
  331. ))
  332. )
  333. "None"
  334. ) "\n"
  335. (divide (TypGetDataField (itmGetStaticData autonItem "autonShipClass") "maxArmorMass") 1000) " tons \n"
  336. (switch
  337. (geq (count (@ (objGetItems autonthingy "Is") 0)) 1)
  338. (TypGetDataField (itmGetType (@ (objGetItems autonthingy "Is") 0)) 'name)
  339. "None"
  340. )"\n"
  341. allWeapons
  342. ))
  343. (rpgCleanUpSuspendedAuton gSource)
  344. string
  345. )
  346. </Text>
  347. <!--
  348.  
  349. <Text left="52" right="-84" bottom="-12" height="120" align="center" font="Large" color="200,206,199">
  350. (block (desc skill repBonus thaName prize rnd1 rnd2 fromPlace)
  351. (setq theName (objGetName gPlayership 0x00))
  352. (setq skill (objGetData gPlayership "arenaSkill"))
  353. (setq repBonus (objGetData gPlayership "arenaRepBonus"))
  354. (setq prize (bamComputePrize
  355. (objGetGlobalData gSource "arenaSkill")
  356. (objGetGlobalData gSource "arenaRep")
  357. skill
  358. (objGetData gPlayership "arenaPrizeBonus")
  359. ))
  360.  
  361. (setq rnd1 (modulo (objGetDestiny gPlayership) 24))
  362. (setq rnd2 (divide (objGetDestiny gPlayership) 24))
  363.  
  364. (setq fromPlace (item '("Starton Eridani" "St. Katharine's Star" "Rigel Aurelius" "Centauri" "Kibo") (modulo rnd2 5)))
  365.  
  366. (switch
  367. (leq skill 300)
  368. (setq desc (eval (item
  369. '(
  370. (cat theName " is a young gladiator from " fromPlace ".")
  371. (cat theName " flies a " (shpGetClassName gPlayership 1) ".")
  372. (cat theName " is a novice pilot flying a beautiful " (shpGetClassName gPlayership 1) ".")
  373. )
  374. (modulo rnd1 3)
  375. )))
  376.  
  377. (setq desc (eval (item
  378. '(
  379. (cat theName " is a former Champion from " fromPlace ".")
  380. (cat "The battle-hardened pilot known as " theName " will give you the fight of your life!")
  381. (cat "Death comes quickly when you fight " theName ".")
  382. )
  383. (modulo rnd1 3)
  384. )))
  385. )
  386.  
  387. (switch
  388. (geq repBonus 100)
  389. (setq desc (cat desc " This is the match the audience has been waiting for."))
  390.  
  391. (geq repBonus 50)
  392. (setq desc (cat desc " Defeating " theName " will excite the crowd and bring you great fame!"))
  393.  
  394. (geq repBonus 25)
  395. (setq desc (cat desc " This is a well-matched opponent that will draw the crowd."))
  396. )
  397.  
  398. (setq desc (cat desc " For defeating " theName " you will receive " prize " credits."))
  399. )
  400. </Text>-->
  401. </Display>
  402. <Panes>
  403. <Default>
  404. <OnPaneInit>
  405. (scrSetDesc gScreen
  406. "You bring the auton aside from the cargo bay and place it atop a workbench."
  407. )
  408. </OnPaneInit>
  409.  
  410. <Actions>
  411. <Action name="Repair Armor" key="R">
  412. (block (autonConfig hpDamage hpToRepair armorType armorToUse )
  413.  
  414. ; Figure out how many armor segments we need to repair auton armor
  415.  
  416.  
  417. (setq autonConfig (rpgGetAutonConfig autonItem))
  418.  
  419. (setq hpDamage 0)
  420. (enum (@ autonConfig 'armor) armorDesc
  421. (block Nil
  422. (if (not armorType)
  423. (setq armorType (itmGetType (@ armorDesc 'item)))
  424. )
  425. (setq hpDamage (add hpDamage (subtract (itmGetProperty (@ armorDesc 'item) 'completeHP) (@ armorDesc 'hp))))
  426. )
  427. )
  428.  
  429. ; Make a list of armor segments that we can use from the player's cargo
  430. ; hold, sufficient to repair all the damage.
  431.  
  432. (setq hpToRepair 0)
  433. (enum (objGetItems gPlayerShip "aU") theArmor
  434. (if (and (eq (itmGetType theArmor) armorType)
  435. (ls hpToRepair hpDamage)
  436. )
  437. (block (hpForThisArmor countToUse)
  438. (setq hpForThisArmor (itmGetProperty theArmor 'hp))
  439. (if (itmIsDamaged theArmor)
  440. (setq hpForThisArmor (divide hpForThisArmor 2))
  441. )
  442.  
  443. (setq countToUse
  444. (min
  445. (divide (add (subtract hpDamage hpToRepair) (subtract hpForThisArmor 1)) hpForThisArmor)
  446. (itmGetCount theArmor)
  447. )
  448. )
  449.  
  450. (setq armorToUse (append armorToUse (list (itmSetCount theArmor countToUse))))
  451. (setq hpToRepair (min hpDamage (add hpToRepair (multiply countToUse hpForThisArmor))))
  452. )
  453. )
  454. )
  455.  
  456. ; Remember the current list selection
  457.  
  458. (scrSetData gScreen 'currentAuton autonItem)
  459.  
  460. ; Effect repairs
  461.  
  462. (switch
  463. (eq hpDamage 0)
  464. (scrShowScreen gScreen &dsRPGMessage; {
  465. desc: "The auton's armor is undamaged. No repairs needed."
  466. })
  467.  
  468. (eq hpToRepair 0)
  469. (scrShowScreen gScreen &dsRPGMessage; {
  470. desc: (cat "Unfortunately, you do not have any " (itmGetName armorType 0x02) " to repair the auton.")
  471. })
  472.  
  473. (scrShowScreen gScreen &dsAutonBayRepairArmor; {
  474. autonConfig: autonConfig
  475. autonItem: autonItem
  476. armorToUse: armorToUse
  477. hpToRepair: hpToRepair
  478. })
  479. )
  480. )
  481. </Action>
  482.  
  483. <Action name="Replace Armor" key="P">
  484. (block (autonConfig)
  485. (setq autonConfig (rpgGetAutonConfig autonItem))
  486.  
  487. (scrShowScreen gScreen &dsAutonBayReplaceArmor; {
  488. autonConfig: autonConfig
  489. autonItem: autonItem
  490. })
  491. )
  492. </Action>
  493.  
  494. <Action name="Install Device" key="D">
  495. (block (autonConfig)
  496. (setq autonConfig (rpgGetAutonConfig autonItem))
  497.  
  498. (scrShowScreen gScreen &dsAutonBayInstallDevice; {
  499. autonConfig: autonConfig
  500. autonItem: autonItem
  501. })
  502. )
  503. </Action>
  504.  
  505. <Action name="Remove Device" key="V" default="1">
  506. (block Nil
  507. (scrShowScreen gScreen "&dsRPCRemoveItem;")
  508. )
  509. </Action>
  510.  
  511. <Action name="Enhance Device" key="E" default="1">
  512.  
  513. </Action>
  514.  
  515. <Action name="Use Items" key="U" default="1">
  516.  
  517. </Action>
  518.  
  519. <Action name="Back to auton list" key="B" cancel="1">
  520. (scrExitScreen gScreen)
  521. </Action>
  522. </Actions>
  523. </Default>
  524. </Panes>
  525. </DockScreen>
  526. <DockScreen UNID="&dsAutonBayRepairArmor;"
  527. backgroundID= "none"
  528. nestedScreen= "true"
  529. >
  530. <Panes>
  531. <Default>
  532. <OnPaneInit>
  533. (scrSetDesc gScreen
  534. "You can repair " (@ gData 'hpToRepair) " hit point" (if (gr (@ gData 'hpToRepair) 1) "s " " ")
  535. "of damage on " (itmGetName (@ gData 'autonItem) 0x04) " with "
  536.  
  537. (switch
  538. (eq (count (@ gData 'armorToUse)) 1)
  539. (itmGetName (@ (@ gData 'armorToUse) 0) 0x08)
  540.  
  541. (eq (count (@ gData 'armorToUse)) 2)
  542. (cat (itmGetName (@ (@ gData 'armorToUse) 0) 0x08) " and " (itmGetName (@ (@ gData 'armorToUse) 1) 0x08))
  543.  
  544. (block Nil
  545. (setq i 0)
  546. (apply cat
  547. (map (@ gData 'armorToUse) Nil theArmor
  548. (if (eq (setq i (add i 1)) (count (@ gData 'armorToUse)))
  549. (cat "and " (itmGetName (@ (@ gData 'armorToUse) 0) 0x08))
  550. (cat (itmGetName (@ (@ gData 'armorToUse) 0) 0x08) ", ")
  551. )
  552. )
  553. )
  554. )
  555. )
  556.  
  557. ".\n\n"
  558. "Do you wish to continue?"
  559. )
  560. </OnPaneInit>
  561.  
  562. <Actions>
  563. <Action name="Repair" key="R" default="1">
  564. (block (hpLeft)
  565.  
  566. ; Repair the auton
  567.  
  568. (setq hpLeft (@ gData 'hpToRepair))
  569. (setq newArmorList
  570. (map (@ (@ gData 'autonConfig) 'armor) armorDesc
  571. (block (hpNeeded hpUsed)
  572. (print "hpLeft: " hpLeft)
  573.  
  574. (setq hpNeeded (subtract (itmGetProperty (@ armorDesc 'item) 'completeHP) (@ armorDesc 'hp)))
  575. (setq hpUsed (min hpNeeded hpLeft))
  576. (setq hpLeft (subtract hpLeft hpUsed))
  577.  
  578. (print "hpNeeded: " hpNeeded)
  579. (print "hpUsed: " hpUsed)
  580. (print "hpLeft: " hpLeft)
  581.  
  582. {
  583. item: (@ armorDesc 'item)
  584. hp: (add (@ armorDesc 'hp) hpUsed)
  585. }
  586. )
  587. )
  588. )
  589.  
  590. (objSetItemData gPlayerShip (@ gData 'autonItem) 'autonConfig {
  591. armor: newArmorList
  592. devices: (@ (@ gData 'autonConfig) 'devices)
  593. })
  594.  
  595. ; Consume the armor segments
  596.  
  597. (enum (@ gData 'armorToUse) theArmor
  598. (objRemoveItem gPlayerShip theArmor)
  599. )
  600.  
  601. (scrExitScreen gScreen)
  602. )
  603. </Action>
  604.  
  605. <Action name="Cancel" key="C" cancel="1">
  606. (scrExitScreen gScreen)
  607. </Action>
  608. </Actions>
  609. </Default>
  610. </Panes>
  611. </DockScreen>
  612. <!-- Remove device screen -->
  613.  
  614. <DockScreen UNID="&dsRPCRemoveItem;"
  615. type= "customPicker"
  616. backgroundID= "&rsItemListScreen;"
  617. nestedScreen= "true"
  618. >
  619.  
  620. <List>
  621. (block (auton ItemList)
  622. ;(list [Title] (list [Image]) [Description])
  623. (setq auton (rpgCreateSuspendedAuton gSource autonItem))
  624. ;init item list
  625. (setq ItemList "")
  626. ;list installed items
  627. (enum (ObjGetItems auton "*I") itemthingy (block Nil
  628. (switch
  629. (eq ItemList "")
  630. (block Nil
  631. (setq ItemList (list
  632. (list
  633. (TypGetDataField (ItmGetType itemthingy) 'name)
  634. (itmGetImageDesc itemthingy)
  635. (itmGetProperty itemthingy 'description)
  636. )))
  637. )
  638. (setq ItemList (lnkAppend ItemList
  639. (list
  640. (TypGetDataField (ItmGetType itemthingy) 'name)
  641. (itmGetImageDesc itemthingy)
  642. (itmGetProperty itemthingy 'description)
  643. )
  644. ))
  645. )
  646. ))
  647. ;(rpgGetAutonConfig autonItem)
  648. ItemList
  649. )
  650. </List>
  651.  
  652. <Panes>
  653. <Default
  654. desc= "Pick a device to remove.">
  655.  
  656. <OnPaneInit>
  657. </OnPaneInit>
  658.  
  659. <Actions>
  660. <Action name="Remove this Device" default="1" key="R">
  661. (block (auton)
  662. ; Get the suspended auton so we can operate on it
  663. (setq auton (rpgCreateSuspendedAuton gSource autonItem))
  664. (Printto 'log 'datestart)
  665. (enum (ObjGetItems auton "dI") itemthing (block Nil
  666. (switch
  667. (eq (item (ScrGetListEntry gScreen) 0) (TypGetDataField (ItmGetType itemthing) 'name))
  668. (block Nil
  669. (shpRemoveDevice auton itemthing)
  670. (Printto 'log itemthing)
  671. (ObjAddItem gSource itemthing)
  672. )
  673. )
  674. ))
  675. (switch
  676. Nil
  677. Nil
  678. ;check if there's enough cargospace
  679. ;TO REMOVE:
  680. ;take out the info from the auton
  681. ;itmcreate the item back into the playership
  682. ;more info:
  683. <!--
  684. (block (deviceItem auton oldDeviceItem)
  685. ; Get the device to install
  686. (setq deviceItem (scrGetItem gScreen))
  687. ; Remove the device from the player ship and move it to the auton
  688. (objRemoveItem gPlayerShip deviceItem)
  689. (objAddItem auton deviceItem)
  690. ; Install the device
  691.  
  692. (shpInstallDevice auton deviceItem)
  693.  
  694. ; Take any old devices and move them back to the player ship
  695.  
  696. (enum (objGetItems auton "dU") theItem
  697. (block Nil
  698. (objRemoveItem auton theItem)
  699. (objAddItem gPlayerShip theItem)
  700. )
  701. )
  702.  
  703. ; Convert back to the auton item
  704.  
  705. (setq newAutonItem (objFireEvent auton 'ConvertToItem))
  706. (objSetItemData gSource (@ gData 'autonItem) 'autonConfig (itmGetData newAutonItem 'autonConfig))
  707.  
  708.  
  709. (scrExitScreen gScreen)
  710. )
  711.  
  712.  
  713. (typFireEvent autonUNID 'CreateFromItem { sourceObj:sourceObj type:autonUNID item:autonItem })
  714.  
  715.  
  716. ; If the source item has a configuration then we need to initialize the ship.
  717.  
  718. (if (setq autonConfig (itmGetData sourceItem 'autonConfig))
  719. (block Nil
  720.  
  721. ; Start by installing the proper armor
  722.  
  723. (for i 0 (subtract (shpGetArmorCount auton) 1)
  724. (block (newArmorItem)
  725. (setq newArmorItem (@ (@ (@ autonConfig 'armor) i) 'item))
  726.  
  727. (objAddItem auton newArmorItem)
  728. (shpInstallArmor auton newArmorItem i)
  729.  
  730. ; Set the appropriate hit points
  731.  
  732. (objSetItemProperty auton (shpGetArmor auton i) 'hp (@ (@ (@ autonConfig 'armor) i) 'hp))
  733. )
  734. )
  735.  
  736. ; Uninstall all devices
  737.  
  738. (enum (objGetItems auton "dI") theItem
  739. (shpRemoveDevice auton theItem)
  740. )
  741.  
  742. ; Install required devices
  743.  
  744. (enum (@ autonConfig 'devices) deviceDesc
  745. (block (newDeviceItem)
  746. (setq newDeviceItem (@ deviceDesc 'item))
  747.  
  748. (objAddItem auton newDeviceItem)
  749. (shpInstallDevice auton newDeviceItem)
  750. )
  751. )
  752.  
  753. ; Remove uninstalled armor and devices
  754.  
  755. (enum (objGetItems auton "adU") theItem
  756. (objRemoveItem auton theItem)
  757. )
  758.  
  759. ; Add items to cargo
  760.  
  761. (enum (@ autonConfig 'cargo) theItem
  762. (objAddItem auton theItem)
  763. )
  764. )
  765. )
  766. -->
  767. )
  768. ; Done with the auton
  769. (rpgCleanUpSuspendedAuton gSource)
  770. (ScrSetDesc gScreen (cat (item (ScrGetListEntry gScreen) 0) " removed"))
  771. )
  772. </Action>
  773.  
  774. <Action name="Cancel" cancel="1" key="C">
  775. (scrExitScreen gScreen)
  776. </Action>
  777. </Actions>
  778. </Default>
  779. </Panes>
  780. </DockScreen>
  781. <Globals>
  782. (block Nil
  783. (setq rpgDeployAutonFromItem (lambda (sourceObj autonUNID autonItem)
  784. (block (auton)
  785. ; Let the auton ship class create itself based on the item
  786.  
  787. (setq auton (typFireEvent autonUNID 'CreateFromItem { sourceObj:sourceObj type:autonUNID item:autonItem }))
  788.  
  789. ; Identify and remove the item from the source
  790.  
  791. (itmSetKnown autonItem)
  792. (objRemoveItem sourceObj autonItem 1)
  793.  
  794. ;add auton data so we know it's the player's auton
  795. (ObjSetData auton "invoked" true)
  796. )
  797. ))
  798. )
  799. </Globals>
  800.  
  801. </TranscendenceExtension>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement