Advertisement
Guest User

Energy - Matter Converter

a guest
Jan 2nd, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 12.15 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <!DOCTYPE TranscendenceExtension
  4. [
  5. <!ENTITY unidExtension "0xEE000000">
  6. <!ENTITY itEMC "0xEE000001">
  7. <!ENTITY loaderEMC "0xEE000002">
  8. <!ENTITY weaponEMC "0xEE000003">
  9. <!ENTITY dsEMC "0xEE000004">
  10. <!ENTITY dsEMCMass "0xEE000006">
  11. <!ENTITY itLauncherEMC "0xEE000005">
  12. ]>
  13.  
  14. <TranscendenceExtension
  15.     name = "Energy-Matter converter"
  16.     credits = "EditorRUS"
  17.     version = "1.0"
  18.     UNID = "&unidExtension;"
  19. >
  20.  
  21. <Globals>
  22.     (block Nil
  23.         (setq makeEMC (lambda (EMC1)
  24.             (block (EDens Mass Energy kdamage shockdamage shocktype shockrad shockdamage2 volume aWeapon)
  25.                 (setq Energy (objGetData EMC1 "W"))
  26.                 (setq Mass (objGetData EMC1 "kg"))
  27.                 (setq EDens (multiply (divide Energy Mass) 10000))
  28.                 (setq kdamage (divide Mass 200))
  29.                 (switch
  30.                     (geq EDens 10000000)
  31.                         (setq shocktype "singularity")
  32.                         (setq shockdamage2 "shatter3; disintegration3; deviceDisrupt5; WMD7")
  33.                     (geq EDens 1000000)
  34.                         (setq shocktype "graviton")
  35.                         (setq shockdamage2 "shatter2; deviceDisrupt4; WMD7")
  36.                     (geq EDens 500000)
  37.                         (setq shocktype "plasma")
  38.                         (setq shockdamage2 "shatter1; WMD7")
  39.                     (geq EDens 200000)
  40.                         (setq shocktype "thermo")
  41.                         (setq shockdamage2 "WMD7")
  42.                     (geq EDens 50000)
  43.                         (setq shocktype "blast")
  44.                         (setq shockdamage2 "WMD5")
  45.                     (geq EDens 10000)
  46.                         (setq shocktype "laser")
  47.                         (setq shockdamage2 "WMD3")
  48.                     (block Nil
  49.                         (setq shocktype "kinetic")
  50.                         (setq shockdamage2 "WMD1")
  51.                     )
  52.                 )
  53.                 (switch
  54.                     (eq shocktype "kinetic") ;Up to 250
  55.                         (setq shockdamage (divide (multiply 250 10000) EDens))
  56.                     (eq shocktype "laser") ;Up to 500
  57.                         (setq shockdamage (divide (multiply 500 50000) EDens))
  58.                     (eq shocktype "thermo") ;Up to 150
  59.                         (setq shockdamage (divide (multiply 150 200000) EDens))
  60.                     (eq shocktype "plasma")
  61.                         (setq shockdamage (divide (multiply 100 500000) EDens))
  62.                     (eq shocktype "graviton") ;Up to 750
  63.                         (setq shockdamage (divide (multiply 750 1000000) EDens))
  64.                     (eq shocktype "singularity") ;Up to infinity
  65.                         (setq shockdamage (divide EDens 10000000))
  66.                 )
  67.                 (setq shockrad (divide EDens (multiply 1000 shockdamage)))
  68.                
  69.                 (typCreate "&weaponEMC;" (subst (objGetStaticData gSource "Weapon")
  70.                 {
  71.                 damage: (cat "kinetic:" kdamage ";" "momentum7;")
  72.                 shockwavedamage: (cat shocktype ":" "shockdamage" ";" shockdamage2)
  73.                 radius: shockrad
  74.                 }
  75.                 ))
  76.                 (setq aWeapon (itmCreate &weaponEMC; 1))
  77.                 (objSetData aWeapon "parent" EMC1)
  78.                 (objSetData EMC1 "matter" aWeapon)
  79.                 aWeapon
  80.                 )
  81.             )
  82.     )
  83.     )
  84. </Globals>
  85.        
  86. <ItemType UNID="&itEMC;"
  87.         name=               "EMC"
  88.         level=              "8"
  89.         value=              "75000"
  90.         mass=               "1000"
  91.         frequency=          "ultrarare"
  92.         attributes=         "MajorItem; Military; EMC"
  93.  
  94.         description=        "This device gather energy in some volume and launch it"
  95.         >
  96.        
  97.         <Image imageID="&rsItems1;" imageX="0" imageY="192" imageWidth="96" imageHeight="96"/>
  98.        
  99.         <MiscellaneousDevice
  100.             powerUse=       "0"
  101.             external=       "false"
  102.             deviceslots=    "1"
  103.         />
  104.         <StaticData>
  105.             <EnergyLoad>
  106.                 <![CDATA[
  107.                     <ItemType
  108.                         name = "Energy loader"
  109.                         virtual = 1
  110.                         >
  111.                         <MiscellaneousDevice
  112.                             powerUse=       "%puse%"
  113.                             external=       "false"
  114.                             deviceslots=    "0"
  115.                         />
  116.                        
  117.                         <Events>
  118.                             <OnDisable>
  119.                                 (objFireEvent (objGetData gSource "parent") "PowerFailure")
  120.                             </OnDisable>
  121.                         </Events>
  122.                     </ItemType>
  123.                         ]]>
  124.             </EnergyLoad>
  125.            
  126.             <Weapon>
  127.                 <![CDATA[
  128.                     <ItemType
  129.                         name = "EMC fire"
  130.                         virtual = 1
  131.                         >
  132.                         <Weapon
  133.                             type=               "missile"
  134.                            
  135.                             damage=             %damage%
  136.                             lifetime=           "5000"
  137.                             sound=              "&snRecoillessCannon;"
  138.                            
  139.                             >
  140.                             <Fragment
  141.                                 count=              "1"
  142.                                 type=               "area"
  143.                                 damage=             %shockwavedamage%
  144.                                 expansionSpeed=     "30"
  145.                                 missileSpeed=       "0"
  146.                                 lifetime=           %radius%
  147.                                 >
  148.  
  149.                                 <Effect>
  150.                                     <Shockwave>
  151.                                         <Image imageID=             "&rsShockwave1;"
  152.                                                 imageX=             "0"
  153.                                                 imageY=             "128"
  154.                                                 imageWidth=         "512"
  155.                                                 imageHeight=        "64"
  156.                                                 imageFrameCount=    "1"
  157.                                                 imageTicksPerFrame= "1"/>
  158.                                     </Shockwave>
  159.                                 </Effect>
  160.                             </Fragment>
  161.                         </Weapon>
  162.                     </ItemType>
  163.                 ]]>
  164.             </Weapon>
  165.         </StaticData>
  166.    
  167.         <Invoke installedonly="true">
  168.             (scrShowScreen gScreen "&dsEMC;")
  169.         </Invoke>
  170.        
  171.         <Events>
  172.             <OnUninstall>
  173.                 (if (eq (objGetData gSource "gathers") 1)
  174.                     (objFireEvent gSource "PowerFailure")
  175.                     Nil
  176.                 )
  177.             </OnUninstall>
  178.  
  179.             <OnDisable>
  180.                 (if (eq (objGetData gSource "gathers") 1)
  181.                     (objFireEvent gSource "PowerFailure")
  182.                     Nil
  183.                 )
  184.             </OnDisable>           
  185.        
  186.             <PowerFailure> ;FUN!
  187.                 (objDamage gPlayerShip (makeEMC) "playerCreatedExplosion")
  188.             </PowerFailure>
  189.            
  190.             <Fire>
  191.                 (block (EMC)
  192.                     (setq EMC (objGetData gSource "matter"))
  193.                     (sysCreateWeaponFire &weaponEMC; gPlayerShip (objGetPos gPlayerShip) (sysVectorAngle (objGetPos gplayership)) 30 Nil)
  194.                     (objSetData gSource "W" 0)
  195.                     (objSetData gSource "kg" 0)
  196.                     (objSetData gSource "LW" 0)
  197.                     (objSetData gSource "ready" 0)
  198.                 )
  199.             </Fire>
  200.            
  201.             <Ready>
  202.                 (block Nil
  203.                     (objSetData gSource "ready" 1)
  204.                     (objSetData gSource "gathers" 0)
  205.                     (objRemoveItem gplayerShip (itmCreate &loaderEMC; 1) 1)
  206.                 )
  207.             </Ready>
  208.         </Events>
  209. </ItemType>
  210.  
  211. <DockScreen UNID="&dsEMC;"
  212.     name = "EMC controller"
  213.     >
  214.     <Panes>
  215.         <Default>
  216.             <OnPaneInit>
  217. <!--                (block (isGathering ready)
  218.                     (setq isGathering (objGetData gSource "gathers"))
  219.                     (setq ready (objGetData gSource "ready"))
  220.                     (scrSetDesc gScreen (subst "Welcome to the EMC control board!\nEMC %1\nEMC is %2 to fire now." (if (eq isGathering 1) "is gathering power and can't be used now" "is awaiting for orders") (if (eq ready 1) "ready" "not ready")))
  221.                     (if (eq isGathering 1)
  222.                         (block Nil
  223.                             (scrEnableAction gScreen 0 Nil)
  224.                             (scrEnableAction gScreen 1 Nil)
  225.                             (scrEnableAction gScreen 2 Nil)
  226.                             (scrEnableAction gScreen 4 Nil)
  227.                         )
  228.                         (block Nil
  229.                             (if (eq ready 0)
  230.                                 (block Nil
  231.                                     (scrEnableAction gScreen 0 1)
  232.                                     (scrEnableAction gScreen 1 1)
  233.                                     (scrEnableAction gScreen 2 1)
  234.                                     (scrEnableAction gScreen 4 Nil)
  235.                                 )
  236.                                 (block Nil
  237.                                     (scrEnableAction gScreen 0 Nil)
  238.                                     (scrEnableAction gScreen 1 Nil)
  239.                                     (scrEnableAction gScreen 2 Nil)
  240.                                     (scrEnableAction gScreen 4 1)                              
  241.                                 )
  242.                             )
  243.                         )
  244.                     )
  245.                 ) -->
  246.            
  247.             </OnPaneInit>
  248.            
  249.             <Actions>
  250.                 <Action name="Add a chunk of matter" key="c"> ;0
  251.                     (block Nil
  252.                     (scrShowScreen gScreen &dsEMCMass;)
  253.                     )
  254.                 </Action>
  255.                 <Action name="Set limit of energy to be collected" key="l"> ;1
  256.                     (scrShowPane gScreen "Limit")
  257.                 </Action>
  258.                 <Action name="Start to collect power" key="s"> ;2
  259.                     (block (vLoad)
  260.                         (typCreate &loaderEMC; (subst (objGetStaticData gSource "EnergyLoad")
  261.                         {
  262.                         puse: (divide (objGetMaxPower gPlayerShip) 2)
  263.                         }
  264.                         ))
  265.                         (setq vLoad (itmCreate &loaderEMC; 1))
  266.                         (objAddItem gPlayerShip vLoad)
  267.                         (shpInstallDevice gPlayerShip vLoad)
  268.                         (objSetData vLoad "parent" gSource)
  269.                         (objSetData gSource "gathers" 1)
  270.                         (scrShowPane gScreen "Default")
  271.                     )
  272.                 </Action>
  273.                 <Action name="Get information" key="g"> ;3
  274.                     (scrShowPane gScreen "Info")
  275.                 </Action>
  276.                 <Action name="Transfer charged matter in the launcher slot" key="t"> ;4
  277.                     (block (EMC)
  278.                         (setq EMC (makeEMC))
  279.                     )
  280.                 </Action>
  281.                 <Action name="Read manual" key="r"> ;5
  282.                     (scrShowPane gScreen "Manual")
  283.                 </Action>
  284.             </Actions>
  285.         </Default>
  286.        
  287.         <Limit showCounter="1">
  288.             <Actions>
  289.                 <Action name="Set" key="s">
  290.                     (block (W)
  291.                         (setq W (scrGetCounter gScreen))
  292.                         (if (ls W 0)
  293.                             (scrSetCounter gScreen 0)
  294.                             (block Nil (objSetData gSource "LW" W) (scrShowPane gScreen "Default"))
  295.                         )
  296.                     )
  297.                 </Action>
  298.             </Actions>
  299.         </Limit>
  300.         <Manual
  301.             desc="The EMC is Energy-Matter-Converter. It gathers pure energy and accumulate it in some volume of matter. Be careful - EMC MUST be supplied with enough power while it gathering power. If you either disable or uninstall it when it gathers power the force field will not be able to hold the matter which fall down on the floor and explode likely destroying devices.">
  302.            
  303.             <Actions>
  304.                 <Action name="How much power the device consumes?" key="h">
  305.                     (scrShowPane gScreen "PowerConsume")
  306.                 </Action>
  307.                
  308.                 <Action name="Is there a way to stop the device?" key="i">
  309.                     (scrShowPane gScreen "TheWay")
  310.                 </Action>
  311.                
  312.                 <Action name="Back" key="b">
  313.                     (scrShowPane gScreen "Default")
  314.                 </Action>
  315.             </Actions>
  316.         </Manual>
  317.    
  318.         <PowerConsume
  319.             desc = "It consumes half of your maximum reactor's power, no matter how much power you are using now.">
  320.             <Actions>
  321.                 <Action name="Back" key="b">
  322.                     (scrShowPane gScreen "Manual")
  323.                 </Action>
  324.             </Actions>
  325.         </PowerConsume>
  326.  
  327.         <TheWay
  328.             desc = "Virtually there's no way to do that without explosion. If you have no much power collected then you can disable device and pray the shields hold the explosion.">
  329.             <Actions>
  330.                 <Action name="Back" key="b">
  331.                     (scrShowPane gScreen "Manual")
  332.                 </Action>
  333.             </Actions>
  334.         </TheWay>
  335.  
  336.         <Info>
  337.             <OnPaneInit>
  338.                 (block (nowEnergy nowMass setLimit ETA ReactorLoad)
  339.                     (setq nowEnergy (objGetData gSource "W"))
  340.                     (setq nowMass (objGetData gSource "kg"))
  341.                     (setq setLimit (objGetData gSource "LW"))
  342.                     (setq ReactorLoad (divide (objGetMaxPower gPlayerShip) 2))
  343.                     (if (eq (objGetData gSource "gathers") 1)
  344.                         (setq ETA (divide (subtract setLimit nowEnergy) ReactorLoad))
  345.                         (setq ETA 0)
  346.                     )
  347.                     (scrSetDesc gScreen (subst "Mass: %1\nCollected power: %2\nSet limit: %3 %4" nowMass nowEnergy setLimit
  348.                         (if (eq (objGetData gSource "gathers") 1)
  349.                             (cat "\nApproximate time to finish collecting: " ETA " seconds")
  350.                             ""
  351.                     )
  352.                     ))
  353.                 )
  354.             </OnPaneInit>
  355.            
  356.             <Actions>              
  357.                 <Action name="Back" key="b">
  358.                     (block Nil
  359.                     (sysCancelTimerEvent gScreen "OnPaneInit")
  360.                     (scrShowPane gScreen "Default")
  361.                     )
  362.                 </Action>
  363.             </Actions>
  364.         </Info>
  365.     </Panes>
  366. </DockScreen>
  367.        
  368. <DockScreen UNID="&dsEMCMass;"
  369.     name = "Matter chamber"
  370.     type = "itemPicker"
  371.     >
  372.     <ListOptions
  373.         dataFrom = "player"
  374.         list = "U*; -EMC"/>
  375.    
  376.     <Panes>
  377.         <Default desc="Choose what items you want to put inside the chamber">
  378.             <Actions>
  379.                 <Action name="Add items in the chamber" key="a">
  380.                     (block (gItem)
  381.                         (setq gItem (scrGetItem gScreen))
  382.                         (if (eq (itmGetCount gItem) 1)
  383.                             (block Nil
  384.                                 (objRemoveItem gPlayerShip gItem 1)
  385.                                 (objSetData gSource "kg" (add (objGetData gSource "kg") (itmGetMass gItem)))
  386.                             )
  387.                             (scrShowPane gScreen "Quantity")
  388.                         )
  389.                     )
  390.                 </Action>
  391.            
  392.                 <Action name="Back" key="b">
  393.                     (scrShowScreen gScreen &dsEMC;)
  394.                 </Action>
  395.             </Actions>
  396.         </Default>
  397.        
  398.         <Quantity desc="How many of that item you want to put in there?" showCounter="1">
  399.             <Actions>
  400.                 <Action name="Add items in the chamber" default="1" key="S">
  401.                     (block (gItem)
  402.                         (setq gItem (scrGetItem gScreen))
  403.                         (objRemoveItem gPlayerShip gItem (scrGetCounter gScreen))
  404.                         (objSetData gSource "kg" (add (objGetData gSource "kg") (multiply (itmGetMass gItem) (scrGetCounter gScreen))))
  405.                         (scrShowScreen gScreen &dsEMC;)
  406.                     )
  407.                 </Action>
  408.                
  409.                 <Action name="Back" key="b">
  410.                     (scrShowPane gScreen "Default")
  411.                 </Action>
  412.             </Actions>
  413.         </Quantity>
  414.     </Panes>
  415. </DockScreen>
  416.        
  417. <ItemType UNID="&itLauncherEMC;"
  418.     name = "Launcher of EMC"
  419.     level= "25"
  420.     attributes="EMC;">
  421.    
  422.     <Events>
  423.         <OnFireWeapon>
  424.             (objFireEvent (objGetData gSource "parent") "Fire")
  425.             (shpRemoveItem gPlayerShip gSource)
  426.             (objDelete gSource)
  427.         </OnFireWeapon>
  428.        
  429.         <OnUninstall>
  430.             (shpRemoveItem gPlayerShip gSource)
  431.             (objDelete gSource)
  432.         </OnUninstall>
  433.        
  434.         <OnDisable>
  435.             (objFireEvent (objGetData gSource "parent") "PowerFailure")
  436.             (objDelete gSource)
  437.         </OnDisable>
  438.     </Events>
  439. </ItemType>
  440.  
  441. </TranscendenceExtension>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement