Advertisement
Guest User

Untitled

a guest
Jul 17th, 2014
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.87 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. <!ENTITY dsRPCRemoveItem2 "0xE1286304">
  11.  
  12. ;overrides
  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" 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" 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" 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" key="M">
  200. (block Nil
  201. (setq autonItem (scrGetItem gScreen))
  202. (ScrShowScreen gScreen &dsRPCModifyAuton;)
  203. )
  204. </Action>
  205.  
  206. <Action name="Cancel" default="1" cancel="1" key="C">
  207. (ScrExitScreen gScreen 'forceUndock)
  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. (RPCDSData gPlayership "Screentext" "GET")
  268. </Text>
  269. <!--
  270.  
  271. <Text left="52" right="-84" bottom="-12" height="120" align="center" font="Large" color="200,206,199">
  272. (block (desc skill repBonus thaName prize rnd1 rnd2 fromPlace)
  273. (setq theName (objGetName gPlayership 0x00))
  274. (setq skill (objGetData gPlayership "arenaSkill"))
  275. (setq repBonus (objGetData gPlayership "arenaRepBonus"))
  276. (setq prize (bamComputePrize
  277. (objGetGlobalData gSource "arenaSkill")
  278. (objGetGlobalData gSource "arenaRep")
  279. skill
  280. (objGetData gPlayership "arenaPrizeBonus")
  281. ))
  282.  
  283. (setq rnd1 (modulo (objGetDestiny gPlayership) 24))
  284. (setq rnd2 (divide (objGetDestiny gPlayership) 24))
  285.  
  286. (setq fromPlace (item '("Starton Eridani" "St. Katharine's Star" "Rigel Aurelius" "Centauri" "Kibo") (modulo rnd2 5)))
  287.  
  288. (switch
  289. (leq skill 300)
  290. (setq desc (eval (item
  291. '(
  292. (cat theName " is a young gladiator from " fromPlace ".")
  293. (cat theName " flies a " (shpGetClassName gPlayership 1) ".")
  294. (cat theName " is a novice pilot flying a beautiful " (shpGetClassName gPlayership 1) ".")
  295. )
  296. (modulo rnd1 3)
  297. )))
  298.  
  299. (setq desc (eval (item
  300. '(
  301. (cat theName " is a former Champion from " fromPlace ".")
  302. (cat "The battle-hardened pilot known as " theName " will give you the fight of your life!")
  303. (cat "Death comes quickly when you fight " theName ".")
  304. )
  305. (modulo rnd1 3)
  306. )))
  307. )
  308.  
  309. (switch
  310. (geq repBonus 100)
  311. (setq desc (cat desc " This is the match the audience has been waiting for."))
  312.  
  313. (geq repBonus 50)
  314. (setq desc (cat desc " Defeating " theName " will excite the crowd and bring you great fame!"))
  315.  
  316. (geq repBonus 25)
  317. (setq desc (cat desc " This is a well-matched opponent that will draw the crowd."))
  318. )
  319.  
  320. (setq desc (cat desc " For defeating " theName " you will receive " prize " credits."))
  321. )
  322. </Text>-->
  323. </Display>
  324. <Panes>
  325. <Default>
  326. <OnPaneInit>
  327. (scrSetDesc gScreen
  328. "You bring the auton aside from the cargo bay and place it atop a workbench."
  329. )
  330. </OnPaneInit>
  331.  
  332. <Actions>
  333. <Action name="Repair Armor" key="R">
  334. (block (autonConfig hpDamage hpToRepair armorType armorToUse )
  335.  
  336. ; Figure out how many armor segments we need to repair auton armor
  337.  
  338.  
  339. (setq autonConfig (rpgGetAutonConfig autonItem))
  340.  
  341. (setq hpDamage 0)
  342. (enum (@ autonConfig 'armor) armorDesc
  343. (block Nil
  344. (if (not armorType)
  345. (setq armorType (itmGetType (@ armorDesc 'item)))
  346. )
  347. (setq hpDamage (add hpDamage (subtract (itmGetProperty (@ armorDesc 'item) 'completeHP) (@ armorDesc 'hp))))
  348. )
  349. )
  350.  
  351. ; Make a list of armor segments that we can use from the player's cargo
  352. ; hold, sufficient to repair all the damage.
  353.  
  354. (setq hpToRepair 0)
  355. (enum (objGetItems gPlayerShip "aU") theArmor
  356. (if (and (eq (itmGetType theArmor) armorType)
  357. (ls hpToRepair hpDamage)
  358. )
  359. (block (hpForThisArmor countToUse)
  360. (setq hpForThisArmor (itmGetProperty theArmor 'hp))
  361. (if (itmIsDamaged theArmor)
  362. (setq hpForThisArmor (divide hpForThisArmor 2))
  363. )
  364.  
  365. (setq countToUse
  366. (min
  367. (divide (add (subtract hpDamage hpToRepair) (subtract hpForThisArmor 1)) hpForThisArmor)
  368. (itmGetCount theArmor)
  369. )
  370. )
  371.  
  372. (setq armorToUse (append armorToUse (list (itmSetCount theArmor countToUse))))
  373. (setq hpToRepair (min hpDamage (add hpToRepair (multiply countToUse hpForThisArmor))))
  374. )
  375. )
  376. )
  377.  
  378. ; Remember the current list selection
  379.  
  380. (scrSetData gScreen 'currentAuton autonItem)
  381.  
  382. ; Effect repairs
  383.  
  384. (switch
  385. (eq hpDamage 0)
  386. (scrShowScreen gScreen &dsRPGMessage; {
  387. desc: "The auton's armor is undamaged. No repairs needed."
  388. })
  389.  
  390. (eq hpToRepair 0)
  391. (scrShowScreen gScreen &dsRPGMessage; {
  392. desc: (cat "Unfortunately, you do not have any " (itmGetName armorType 0x02) " to repair the auton.")
  393. })
  394.  
  395. (scrShowScreen gScreen &dsAutonBayRepairArmor; {
  396. autonConfig: autonConfig
  397. autonItem: autonItem
  398. armorToUse: armorToUse
  399. hpToRepair: hpToRepair
  400. })
  401. )
  402. )
  403. </Action>
  404.  
  405. <Action name="Replace Armor" key="P">
  406. (block (autonConfig)
  407. (setq autonConfig (rpgGetAutonConfig autonItem))
  408.  
  409. (scrShowScreen gScreen &dsAutonBayReplaceArmor; {
  410. autonConfig: autonConfig
  411. autonItem: autonItem
  412. })
  413. )
  414. </Action>
  415.  
  416. <Action name="Install Device" key="D">
  417. (block (autonConfig)
  418. (setq autonConfig (rpgGetAutonConfig autonItem))
  419.  
  420. (scrShowScreen gScreen &dsAutonBayInstallDevice; {
  421. autonConfig: autonConfig
  422. autonItem: autonItem
  423. })
  424. )
  425. </Action>
  426.  
  427. <Action name="Remove Device" key="V" >
  428. (block Nil
  429. (scrShowScreen gScreen "&dsRPCRemoveItem;")
  430. )
  431. </Action>
  432.  
  433. <Action name="Enhance Device" key="E">
  434.  
  435. </Action>
  436.  
  437. <Action name="Use Items" key="U">
  438.  
  439. </Action>
  440.  
  441. <Action name="Back to auton list" key="B" default="1" cancel="1">
  442. (scrShowScreen gScreen &dsAutonBay;)
  443. </Action>
  444. </Actions>
  445. </Default>
  446. </Panes>
  447. </DockScreen>
  448. <DockScreen UNID="&dsAutonBayInstallDevice;"
  449. type= "itemPicker"
  450. backgroundID= "&rsItemListScreen;"
  451. nestedScreen= "true"
  452. >
  453.  
  454. <ListOptions
  455. dataFrom= "player"
  456. list= "d~lrvcU"
  457. />
  458.  
  459. <Panes>
  460. <Default>
  461. <OnPaneInit>
  462. (block (auton result)
  463.  
  464. ; Create a suspended auton so we can operate on it
  465.  
  466. (setq auton (rpgCreateSuspendedAuton gSource (@ gData 'autonItem)))
  467.  
  468. ; See if we can install this device
  469.  
  470. (setq result (rpgInstallDevicePrep {
  471. item: (scrGetItem gScreen)
  472. targetObj: auton
  473. installerObj: gPlayerShip
  474. totalPrice: 0
  475. noCargoCheck: True
  476. }))
  477.  
  478. (scrSetDesc gScreen (@ result 'desc))
  479. (scrEnableAction gScreen 0 (@ result 'canInstall))
  480. )
  481. </OnPaneInit>
  482.  
  483. <Actions>
  484. <Action name="Install" default="1" key="I">
  485. (block (deviceItem auton oldDeviceItem)
  486.  
  487. ; Get the suspended auton so we can operate on it
  488.  
  489. (setq auton (rpgCreateSuspendedAuton gSource (@ gData 'autonItem)))
  490.  
  491. ; Get the device to install
  492.  
  493. (setq deviceItem (scrGetItem gScreen))
  494.  
  495. ; Remove the device from the player ship and move it to the auton
  496.  
  497. (PrintTo 'log "remove work?")
  498. (PrintTo 'log (objRemoveItem gPlayerShip deviceItem))
  499. (objAddItem auton deviceItem)
  500.  
  501. ; Install the device
  502.  
  503. (shpInstallDevice auton deviceItem)
  504.  
  505. ; Take any old devices and move them back to the player ship
  506.  
  507. (enum (objGetItems auton "dU") theItem
  508. (block Nil
  509. (objRemoveItem auton theItem)
  510. ;(objAddItem gPlayerShip theItem)
  511. )
  512. )
  513.  
  514. ; Convert back to the auton item
  515.  
  516. (setq newAutonItem (objFireEvent auton 'ConvertToItem))
  517. ;update autonItem reference
  518. (setq autonItem (objSetItemData gSource (@ gData 'autonItem) 'autonConfig (itmGetData newAutonItem 'autonConfig)))
  519.  
  520. ; Done with the auton
  521.  
  522. (rpgCleanUpSuspendedAuton gSource)
  523. (scrExitScreen gScreen)
  524. )
  525. </Action>
  526.  
  527. <Action name="Cancel" cancel="1" key="C">
  528. (block Nil
  529. (rpgCleanUpSuspendedAuton gSource)
  530. (scrExitScreen gScreen)
  531. )
  532. </Action>
  533. </Actions>
  534. </Default>
  535. </Panes>
  536. </DockScreen>
  537. <DockScreen UNID="&dsAutonBayRepairArmor;"
  538. backgroundID= "none"
  539. nestedScreen= "true"
  540. >
  541. <Panes>
  542. <Default>
  543. <OnPaneInit>
  544. (scrSetDesc gScreen
  545. "You can repair " (@ gData 'hpToRepair) " hit point" (if (gr (@ gData 'hpToRepair) 1) "s " " ")
  546. "of damage on " (itmGetName (@ gData 'autonItem) 0x04) " with "
  547.  
  548. (switch
  549. (eq (count (@ gData 'armorToUse)) 1)
  550. (itmGetName (@ (@ gData 'armorToUse) 0) 0x08)
  551.  
  552. (eq (count (@ gData 'armorToUse)) 2)
  553. (cat (itmGetName (@ (@ gData 'armorToUse) 0) 0x08) " and " (itmGetName (@ (@ gData 'armorToUse) 1) 0x08))
  554.  
  555. (block Nil
  556. (setq i 0)
  557. (apply cat
  558. (map (@ gData 'armorToUse) Nil theArmor
  559. (if (eq (setq i (add i 1)) (count (@ gData 'armorToUse)))
  560. (cat "and " (itmGetName (@ (@ gData 'armorToUse) 0) 0x08))
  561. (cat (itmGetName (@ (@ gData 'armorToUse) 0) 0x08) ", ")
  562. )
  563. )
  564. )
  565. )
  566. )
  567.  
  568. ".\n\n"
  569. "Do you wish to continue?"
  570. )
  571. </OnPaneInit>
  572.  
  573. <Actions>
  574. <Action name="Repair" key="R" default="1">
  575. (block (hpLeft)
  576.  
  577. ; Repair the auton
  578.  
  579. (setq hpLeft (@ gData 'hpToRepair))
  580. (setq newArmorList
  581. (map (@ (@ gData 'autonConfig) 'armor) armorDesc
  582. (block (hpNeeded hpUsed)
  583. (print "hpLeft: " hpLeft)
  584.  
  585. (setq hpNeeded (subtract (itmGetProperty (@ armorDesc 'item) 'completeHP) (@ armorDesc 'hp)))
  586. (setq hpUsed (min hpNeeded hpLeft))
  587. (setq hpLeft (subtract hpLeft hpUsed))
  588.  
  589. (print "hpNeeded: " hpNeeded)
  590. (print "hpUsed: " hpUsed)
  591. (print "hpLeft: " hpLeft)
  592.  
  593. {
  594. item: (@ armorDesc 'item)
  595. hp: (add (@ armorDesc 'hp) hpUsed)
  596. }
  597. )
  598. )
  599. )
  600.  
  601. (objSetItemData gPlayerShip (@ gData 'autonItem) 'autonConfig {
  602. armor: newArmorList
  603. devices: (@ (@ gData 'autonConfig) 'devices)
  604. })
  605.  
  606. ; Consume the armor segments
  607.  
  608. (enum (@ gData 'armorToUse) theArmor
  609. (objRemoveItem gPlayerShip theArmor)
  610. )
  611.  
  612. (scrExitScreen gScreen)
  613. )
  614. </Action>
  615.  
  616. <Action name="Cancel" key="C" cancel="1">
  617. (scrExitScreen gScreen)
  618. </Action>
  619. </Actions>
  620. </Default>
  621. </Panes>
  622. </DockScreen>
  623. <!-- Remove device screen -->
  624.  
  625. <DockScreen UNID="&dsRPCRemoveItem;"
  626. type= "customPicker"
  627. backgroundID= "&rsItemListScreen;"
  628. nestedScreen= "true"
  629. >
  630.  
  631. <List>
  632. (RPCDSData gPlayership "RemoveItem" "GET")
  633. </List>
  634.  
  635. <Panes>
  636. <Default
  637. desc= "Pick a device to remove.">
  638.  
  639. <OnPaneInit>
  640. </OnPaneInit>
  641.  
  642. <Actions>
  643. <Action name="Remove this Device" key="R">
  644. (block (auton)
  645. ; Get the suspended auton so we can operate on it
  646. (setq auton (rpgCreateSuspendedAuton gSource autonItem))
  647. (enum (ObjGetItems auton "*Id~a") itemthing (block Nil
  648. (switch
  649. ;Here I just check if the name of the item from the screen list is the same as the name of the item on the ship
  650. (eq (item (ScrGetListEntry gScreen) 0) (TypGetDataField (ItmGetType itemthing) 'name))
  651. (block Nil
  652. ;I try to remove, but to no avail
  653. (shpRemoveDevice auton itemthing)
  654. ; Convert back to the auton item
  655. (setq newAutonItem (objFireEvent auton 'ConvertToItem))
  656. ;update autonItem reference
  657. (setq autonItem (objSetItemData gSource autonItem 'autonConfig (itmGetData newAutonItem 'autonConfig)))
  658. ;ObjAddItem works fine though
  659. (ObjAddItem gSource itemthing)
  660. )
  661. )
  662. ))
  663. ; Done with the auton
  664. (rpgCleanUpSuspendedAuton gSource)
  665. ;show the player new screen so this can get refreshed
  666. (scrShowScreen gScreen &dsRPCModifyAuton;)
  667. )
  668. </Action>
  669.  
  670. <Action name="Done" default="1" cancel="1" key="D">
  671. (scrShowScreen gScreen &dsRPCModifyAuton;)
  672. </Action>
  673. </Actions>
  674. </Default>
  675. </Panes>
  676. </DockScreen>
  677. <!-- Remove device screen -->
  678.  
  679. <DockScreen UNID="&dsRPCRemoveItem2;"
  680. backgroundID= "&rsItemListScreen;"
  681. nestedScreen= "true"
  682. >
  683.  
  684. <Panes>
  685. <Default
  686. desc= "Pick a device to remove.">
  687.  
  688. <OnPaneInit>
  689. (block Nil
  690. (ScrSetDesc gScreen (cat RPC_ItemName " removed"))
  691. )
  692. </OnPaneInit>
  693.  
  694. <Actions>
  695. <Action name="Done" cancel="1" key="D">
  696. (scrShowScreen gScreen &dsRPCRemoveItem;)
  697. </Action>
  698. </Actions>
  699. </Default>
  700. </Panes>
  701. </DockScreen>
  702. <Globals>
  703. (block Nil
  704. (setq rpgDeployAutonFromItem (lambda (sourceObj autonUNID autonItem)
  705. (block (auton)
  706. ; Let the auton ship class create itself based on the item
  707.  
  708. (setq auton (typFireEvent autonUNID 'CreateFromItem { sourceObj:sourceObj type:autonUNID item:autonItem }))
  709.  
  710. ; Identify and remove the item from the source
  711.  
  712. (itmSetKnown autonItem)
  713. (objRemoveItem sourceObj autonItem 1)
  714.  
  715. ;add auton data so we know it's the player's auton
  716. (ObjSetData auton "invoked" true)
  717. )
  718. ))
  719.  
  720. <!--
  721. ;(RPCDSData gPlayership "RemoveItem" "Init")
  722. LEGEND
  723. ;actions
  724. Get - get data
  725. -->
  726. (setq RPCDSData (lambda (Source Data Action)(block Nil
  727. (switch
  728. (eq Action "get")
  729. (block Nil
  730. ;get appropriate data
  731. (switch
  732. (eq Data "RemoveItem")
  733. (block (auton ItemList)
  734. ;(list [Title] (list [Image]) [Description])
  735. (setq auton (rpgCreateSuspendedAuton gSource autonItem))
  736. ;init item list
  737. (setq ItemList "")
  738. ;list installed items
  739. (enum (ObjGetItems auton "*Id~a") itemthingy (block Nil
  740. (switch
  741. (eq ItemList "")
  742. (block Nil
  743. (setq ItemList (list
  744. (list
  745. (TypGetDataField (ItmGetType itemthingy) 'name)
  746. (itmGetImageDesc itemthingy)
  747. (itmGetProperty itemthingy 'description)
  748. )))
  749. )
  750. (setq ItemList (lnkAppend ItemList
  751. (list
  752. (TypGetDataField (ItmGetType itemthingy) 'name)
  753. (itmGetImageDesc itemthingy)
  754. (itmGetProperty itemthingy 'description)
  755. )
  756. ))
  757. )
  758. ))
  759. (TypSetData (ObjGetType source) Data ItemList)
  760. )
  761. (eq Data "Screentext")
  762. (block (autonthingy armorItem autonConfig armorTypes armorString shieldItem allWeapons string)
  763. (setq autonthingy (rpgCreateSuspendedAuton gSource autonItem))
  764. (setq armorItem (item (objGetItems gPlayership "aI") 0))
  765.  
  766. ;init armorTypes
  767. (setq armorTypes "")
  768. (setq armorString "")
  769. (setq autonConfig (rpgGetAutonConfig autonItem))
  770. (enum (@ autonConfig 'armor) armorDesc
  771. (block Nil
  772. ;make a list of all the armor types
  773. (switch
  774. (eq armorTypes "")
  775. (setq armorTypes (list (itmGetType (@ armorDesc 'item))))
  776. ;else
  777. (block Nil
  778. (setq armorTypes (Append armorTypes (list (itmGetType (@ armorDesc 'item)))))
  779. )
  780. )
  781. )
  782. )
  783. ;get rid of duplicate armor types
  784. (enum armorTypes UNID (block Nil
  785. ;remove all duplicates
  786. (setq armorTypes (filter armorTypes UNIDinList
  787. (not (eq UNID UNIDinList))
  788. ))
  789. ;add it back in since we removed all instances of UNID
  790. (setq armorTypes (Append armorTypes UNID))
  791. ))
  792.  
  793. (setq shieldItem (item (objGetItems gPlayership "sI") 0))
  794.  
  795. ; Get the list of weapons
  796. (setq allWeapons "")
  797. (enum (objGetItems autonthingy "wI") theWeapon (block Nil
  798. (switch
  799. (eq AllWeapons "")
  800. (block Nil
  801. (setq AllWeapons (cat (TypGetDataField (itmGetType theWeapon) 'name)))
  802. )
  803. (setq AllWeapons (cat AllWeapons ", "(TypGetDataField (itmGetType theWeapon) 'name)))
  804. )
  805. ))
  806. (if (eq allWeapons "")
  807. (setq allWeapons "None\n")
  808. )
  809. ;START OF THE CAT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  810. (setq string (cat
  811. (typGetDataField (ObjGetType autonthingy) "deviceSlots") "\n"
  812. (typGetDataField (ObjGetType autonthingy) "deviceSlotsWeapons") "\n"
  813. (typGetDataField (ObjGetType autonthingy) "deviceSlotsNonWeapons") "\n"
  814. (divide (typGetDataField (ObjGetType autonthingy) "power") 1000) "MW \n"
  815. (TypGetDataField (itmGetStaticData autonItem "autonShipClass") "maxSpeed") "% lightspeed\n"
  816. (switch
  817. (geq (count armorTypes) 1)
  818. (block Nil
  819. (enum armorTypes element (block Nil
  820. (switch
  821. (eq armorString "")
  822. (setq armorString (TypGetDataField element 'name))
  823. (setq armorString (cat armorString ", " (TypGetDataField element 'name)))
  824. )
  825. ))
  826. )
  827. "None"
  828. ) "\n"
  829. (divide (TypGetDataField (itmGetStaticData autonItem "autonShipClass") "maxArmorMass") 1000) " tons \n"
  830. (switch
  831. (geq (count (@ (objGetItems autonthingy "Is") 0)) 1)
  832. (TypGetDataField (itmGetType (@ (objGetItems autonthingy "Is") 0)) 'name)
  833. "None"
  834. )"\n"
  835. allWeapons
  836. ))
  837. (rpgCleanUpSuspendedAuton gSource)
  838. (TypSetData (ObjGetType source) Data string)
  839. )
  840. )
  841. )
  842. )
  843. (TypGetData (ObjGetType source) Data)
  844. )))
  845. )
  846. </Globals>
  847.  
  848. </TranscendenceExtension>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement