commit 846a7a73eafb267c2790524364ed9d57353bd6d2 Author: Hayden McAfee Date: Tue Jul 19 23:23:31 2016 -0700 Initial commit of Krypton Construction Mod for Tribes 2. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ea0268 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.dso +!Construction/scripts/do_not_delete/MergeToolSupport.cs.dso \ No newline at end of file diff --git a/Construction/ConstructionPreferences.cs b/Construction/ConstructionPreferences.cs new file mode 100644 index 0000000..e97167d --- /dev/null +++ b/Construction/ConstructionPreferences.cs @@ -0,0 +1,7 @@ +//Construction 0.70 Server Configuration File + +//Logging: +$Construction::Logging::EchoChat = 1; +$Construction::Logging::LogConnects = 1; //disconnects too +$Construction::Logging::LogChat = 1; + diff --git a/Construction/Credits.txt b/Construction/Credits.txt new file mode 100644 index 0000000..181e5d0 --- /dev/null +++ b/Construction/Credits.txt @@ -0,0 +1,56 @@ +Don't forget to add yourself to this list.. :D + +**JackTL** +For: +Maintaining mod from v50a. + +**Construct** +For: +providing main idea. +still providing great ideas to keep the mod going. +Testing and tweacking. +lot's of additions and coding help. +The neat installer. + +**Tutorial makers** +For: +Making tutorials.. duh.. + +**Lucid** +For: +Helping me with the code. +providing me with a great decontruct gun. +the neat looking loadscreen. +For being willing to help me with lots of stuff + +**Badshot** +For: +Taking the time to help me with some nasty bugs. +Knowing alot for tribes2 stuff.. and being willing to share it. +Helping all those other modders. + +**DynaBlade** +For: +His Awesome function librarys + +**T2CC** +For: +Their great forum and putting all that coding power at your very fingertips. + +**Child_Killer** +For: +Providing code that was posted before my time and being a great help so far. + +**All those who I fogot to mention sofar** +For: +Whatever they did to help this mod. + +**All those who wanted to help but couldn't** +Remember, it's the thought that counts ;) + + +**By** +Mostlikely, + +I don't need any credit for this mod, it was created for the people who want to play it (which includes me) +Feel free to use any stuff from this mod or ask me about it if you can't extract it somehow. diff --git a/Construction/Saves/Saves.txt b/Construction/Saves/Saves.txt new file mode 100644 index 0000000..1c68d00 --- /dev/null +++ b/Construction/Saves/Saves.txt @@ -0,0 +1 @@ +This is where player save files go. Organized by GUID. \ No newline at end of file diff --git a/Construction/Version-history.txt b/Construction/Version-history.txt new file mode 100644 index 0000000..999af6c --- /dev/null +++ b/Construction/Version-history.txt @@ -0,0 +1,1108 @@ +Latest changes added at top. To read chronologically, +start from bottom. + +**********************0.69 Alpha********************** + +-Didn't update the version history all that good for + certain reasons. + +-Construction Tool will now tell owner client id and + object id when admins read it's power state. + +-Added Transport Missile Gun for traveling great distances + quickly without much fuss. Custom travel time settable. + +-Added 4 'effect' packs. + All use expert and pack setting modes. + >Emitter pack, includes all particle emitters in t2. + >Audio pack, includes all audio effects in t2. + (so a few crap ones too). + >Pack Dispenser pack, includes most packs/weapons/ammo. + >Detonation pack, enables along with satchel charges. + fxGroup, fx_emitters, fx_audio, fx_packs ".delete();" + will remove the effects spawned by the first 3 packs. + +-Added Deployable vehicle pad. + Requires a construction piece surface larger than 20x20 meters. + 2 step deploy: 1-Pad 2-station. + +-Added Multi purpose missile lauchers to the mpb. + which can be enabled with "$mpm::nukempb = 1;" + +** + +-Fixed misc. other stuff. + +-Fixed tossing grenade/mine when toggling Construction + Tool or Super Chaingun grenade/mine modes too quickly. + +-Fixed meteors damaging items behind walls. + +-Fixed server always starting with Cascade mode enabled. + +-Repair Pack should now let players repair themselves + while inside Construction buildings.. + +**********************0.68 Alpha********************** + +-Cascade mode and Vehicles on/off options are now separate + from Purebuild mode toggle, and saved separately in server + prefs file. + +-Repair Kit now works in non-Purebuild mode, with Expert + mode on. + +-Added admin menu item to toggle Invincible Deployables + mode. + +-Added Invincible Deployables mode. + +-When Invincible Armors mode is on, would-be damage is + displayed as a waypoint with a percentage of max damage + for that armor. Team damage is not shown if there are + multiple teams. + +-Added admin menu to remove all orphaned deployables + in the mission. This includes all deployables where + the owner is no longer in the game. + +-Added GUID owner tracking. Owner status is now saved + with buildings. + + NB: GUID is not used by T2 in Solo/LAN games. + +-When a player is found spamming, anything deployed by + that player within the last 15 seconds is disassembled. + Can be changed with host variable. + +-Smartened up turrets multiple target selection code. + +-Fixed Missile Rack Turret's dumbfire/seeker mode not + saving. + +**********************0.67 Alpha********************** + +-Fixed Force Field damage handling with team damage off. + +-Construction Tool will now tell you who owns a piece + when you read it's power state. + +-Construction Mod updated to Tribes 2 v0.25034.0.0 + +-Added "dumbfire" and "seeking" modes to Missile Rack + Turret pack Expert mode options. "seeking" mode drains + more energy. + +-Added Missile Rack Turret pack. This turret needs power + to function. + +-Added "only transmit" and "only receive" modes to Telepad + Expert mode options. + +-Added "Timed turn off" and "Timed turn on" modes to + Tripwire pack Expert mode options. + +-Added "team only" and "any team" modes to Telepad + Expert mode options. + +-Added scale options to Tree pack Expert mode options. + +-Added new underground code. + +-Changed shape of Decoration pack. + +-Added new billboard shapes to Decoration pack. + +-Fixed Pulse Sensor not doing "deploy" anim when loaded. + +-Added admin menu item to enable/disable Underground mode. + +-Added "Only turn on" and "Only turn off" modes to + Tripwire pack Expert mode options. + +-Escape Pod should no longer be usable as an explosive + siege machine. :P + +-Added boost power setting to Escape Pod pack. + +-Escape Pods should no longer launch players underground. + +**********************0.666 Alpha********************** + +-Added Escape Pod pack. + +-Added Field mode to Tripwire pack. + +-Admins can now use Construction Tool on objects even if + they are not on the same team. + +-Admins can now rotate objects even if Only Owner + Rotate is enabled. + +-Added code to prevent players from crashing server by + falling from great height. + +-Walls/pads can now be deployed properly on the thin side of + other walls. + +-Added host variable $Host::NoAnnoyingVoiceChatSpam" to + let hosts prevent players from using the "null" voice + to spam sound effects. :P + +-Included Editor fix (stops it from enabling cheats) in + Construction Mod, since so many people like to play with + it while hosting. :p + +-Added Tripwire pack. Extra options are available in + Expert mode. Usage is similar to the Switch pack. + +-Fixed problem with auto-adjusting Medium Support Beam + scaling weird when deploying on terrain. + +-Added Expert mode sizes to Medium Support Beam. + +-New server variable "$Host::StationHoldTime" holds the + time in milliseconds that players are held when using + an inventory station. + +-Admins and Super Admins can now use power frequencies + 1 to 50, instead of the normal 1 to 40. + +-Fixed Satchel Charge, again. Oops! + +**********************0.65 Alpha********************** + +-Construction Mod updated to Tribes 2 v0.25026.0.0 + +**********************0.64 Alpha********************** + +-Added new Ion effects. + +-Updated Force Field settings. This should hopefully give + some players higher FPS. + +-Added delayed reset mode to Switch, usable in Expert mode. + +-Added vote menu to enable/disable Expert mode. + +-Included new bat file, "JTLdelDSO.bat", in archive. + + This batch file deletes all *.dso files in "..\base" and + the current directory (should be the Construction folder), + and all subfolders. + + NB: It does not ask for confirmation before deleting files. + Use at your own risk. Tested under WinXP only. + + Please use only if the other DSO deleters do not work + for you. + +-An object will now be destroyed if it is too damaged + when deconstructed. + +-Added message broadcast when a player takes control of + an object. + +-Reverted Satchel Charge pack image back to normal. Oops! + +**********************0.63 Alpha********************** + +-Lots of small fixes. + +-Changed how spam is punished. + +-Added new effects for deploying and deconstructing objects. + +-Added keyboard mappings for cycling pack settings forward, + backward, fast forward and fast backward. + Players must run the mod client-side to take advantage + of the new key bind options. + +-Added keyboard mappings for doing a jig, laying down, + heart attack and sucker punched. + Players must run the mod client-side to take advantage + of the new key bind options. + +-Added admin menu item to enable/disable "Only Owner + Cubic Replace mode", which will only let the creator of + an object cubic replace it. + +-Added admin menu item to enable/disable Cascade mode. + +-Made cascading deployables a mode separate from Purebuild + mode. + +-Added an easier function to relight mission client-side. + Clients can enter "reLightMission();" in console to light + their mission. + +-Added new "Builder Pack" entry to Inventory Hud. This + now contains most of the deployable packs. + +-Added admin menu item to enable/disable MTC mode. + +-Added MTC mode. + +-Changed Jump Pad deploy code. + +-Changes in Deployable Light. Any Light saved with v0.62a + can not be deconstructed when loaded in 0.63a. + +-Made Construction Mod packs available in inventory hud + again, at the cost of turret barrel packs. + +-Added Ion mode to Super Chaingun, using same controls as + Construction Tool. + +-Added light source to Hazard mode meteors. + +-Admins now get Super Chaingun when using Deployed Inventory + Station. + +-Telepad can no longer be rotated with Advanced Rotate. + +-Made Team Damage vote menu available in single-team games. + +-Deployed Camera and Prison Camera can now be controlled + in Purebuild mode. + +-Added key bind for selecting Jump Pad. + +**********************0.62 Alpha********************** + +-Fixed problem with Telepad not working past 10km altitude. + New limit is 100km. + +-Added keyboard mappings for sitting and squatting. + Players must run the mod client-side to take advantage + of the new key bind options. + +-Admins can now deconstruct objects even if Only Owner + Deconstruct is enabled. This includes cascade + deconstruction. + +-Added "wooden pad" to Light Support Beam pack. + +-Vehicles can now pass through disabled force fields. + +-Deconstructed objects' packs now appear at the end of + the Construction Tool's beam. + +-Added Deployable Light to savebuilding.cs. + +-Added Light Pack. + +-Fixed Switches affecting objects not on their own team. + +-Fixed problem with vehicle counts being off after + calling pureVehicles(). + +-Added page cycling to vehicle selection hud. + +-Fixed server-side weapon reticles. + +-Changed Energizer explosion effect. + +-Energizer can not be deployed within 30 meters of an + enemy object. + +-Added Deployable Camera to savebuilding.cs. + +-Pure armor can now use Camera grenade. + +-Medium Support Beam ring options reversed. Rings can + now be enabled in Expert mode. + +-Construction Tool will now tell you who owns a piece if + you try to deconstruct a piece not belonging to you and + Only Owner Deconstruct is enabled. + +-If Purebuild mode is off, Satchel Charge warning messages + are only sent to the player's team. + +-Tweaked Energizer. It now only affects Heavy armor, + gives less recharge boost, and is destroyed more easily. + +-Generator now takes 100% of damage from Force Field, + not just 75%. + +-Medium armor can now carry barrel packs again. + +-Added Deployable Turret Base, Clamp Turret and Landspike + Turret to savebuilding.cs. + +-Deployed turrets no longer damage deployables on their + own team. + +-Fixed problem with Light Walkway modes in Expert mode. + +-Max vehicles per team reset to base values for + non-Purebuild mode. + +-Added base Pulse Sensor and Motion Sensor deployables + to savebuilding.cs. + +-Added Super Wildcat and Super Havoc vehicles. Only + available in Purebuild mode. + +-Note that in some cases, the pack-list may be too long + to display properly in the inventory selection hud. + The new QuickPack entries should alleviate this problem + until a fix is done. + +-Added QuickPack entries for most Construction packs. + Players must run the mod client-side to take advantage + of the new key bind options. + +-Made Construct come out of his box for a while. + +-Spider Clamp turret can now be deployed on most + Construction deployables. + +-Turrets can no longer be controlled in Purebuild mode, except + by Admin. + +-Pure armor can now carry Flare grenade, turret barrel packs, + Base Turret pack, Pulse and Motion sensor packs, Clamp + and Landspike turret packs. + +-Fixed cubic replace exploit. + +-Added new Medium Sensor and Large Sensor to savebuilding.cs. + +-Added new Medium Sensor and Large Sensor packs. + +**********************0.61 Alpha********************** + +-Many small fixes. + +-Switches are now half the size of normal base switches. + +-Reverted all vehicles to base values. + +-Added "Construction" gametype script for Construction + missions. + +-Added warning sound to deployable spam warning message. + +-Reworked part of generator object handling in savebuilding.cs. + +-Force Field slow-down can now be toggled in Expert mode. + +-Construction Tool now overrides Grenade and Mine + release - not the other way around. + +-Force Field now kills any players caught in it when + powering up. + +-Medium Floor can now only be deployed on terrain, interior + and Medium Floor shapes in non-Purebuild mode. This change + only applies to Purebuild mode when Hazard mode is on. + +-Construction Tool, "Read power frequency" mode renamed + to "Read power state" mode. It now shows how many power + sources are powering an item as well as it's power frequency. + +-Deployables that require power from Generator objects + now have a greater recharge rate when when powered by + more than one Generator. + +-Added colours to admin menu. + +-Added admin menu item to enable/disable Hazard mode. + +-Added Hazard mode for hazardous construction. + +**********************0.60 Alpha********************** + +-A short list of server options now appear in players + Message Hud on when they join the game. + +-Added Switch pack. Touching it will toggle on or off + all power objects in range, that are on the same team + and same power frequency. Beacon key sets range. + +-Fixed deployed item count being wrong after destroying + a large cluster of pieces. + +-Significantly reduced lag when cascading large structures. + +-Solar Panel now face upwards when deployed on + slopes. + +-Added Logo Projector pack. The logo is selected with beacon + key. In non-Purebuild mode, only the player's team logo is + available. The projector needs power to operate. + +-Added Decoration pack with 12 different decoration items. + Any object deployed on statue base will snap to the top, + in center, and upright. Any statue deployed on statue + base will snap to statue base rotation as well. + +-Inventory stations will no longer snap player to center + if used underground. + +-Advanced Rotate will no longer rotate an object entirely + underground. + +-Rotate functions are no longer available in Construction + Tool in non-Purebuild mode. + +-Generator and Solar Panel objects now store their on/off + state when saved. + +**********************0.59 Alpha********************** + +-Fixed Telepad teleporting underground exploit. + +-Added $ModVersion and $ModCredits global variables to hold + mod version and credits strings. Modders re-modding + Construction Mod should change the these strings at top of + "server.cs". + +-Saved buildings now store the version of Construction Mod + their are saved with. + +-Added admin menu to load saved buildings. To stay server- + side, this menu is listed under "Change the Mission", as + " - Load Building File - " game type. File menu will list + last 10 auto-saved files provided they are in an unbroken + sequence from 0 and up, and also any "*.cs" files stored + under "Buildings/Admin/*". + +-Changed shape of Telepad and reworked Telepad code. Added + new power up effect and sounds. + + Note: All Telepads in saved buildings from previous versions + will be broken. This can be fixed by either turning them + upside-down by hand or redeploying them. + +-Generator and Solar Panel objects now show their power + frequency and switch state when looked at. + +-Added admin menu to re-evaluate power for all deployables + in the mission. This is needed in case power system becomes + corrupted, after loading a building for example. + +-Added admin menu to remove all deployables in the mission + without power. This is intended as an aid in removing spam. + Generator and Solar Panel objects are listed in Commander Hud, + and any other deployables can be removed with this function. + + Note that this function only removes objects outside the + "power zone" of any power object. No checks for power frequency + or team is made. It is intended as a tool to remove spam + outside "populated" areas only. + +-Added Power Panagement mode to Construction Tool. Also fixed + timing issues with the different Tool modes. + +-Added power frequencies for generators and powered objects. + Power frequency is set by either using beacon key before + deploying generator object, or using Power Panagement mode of + Construction Tool. Any powered object deployed by player + will use that frequency until power frequency is changed, + or player dies. + +-Players will no longer be allowed to spawn with "illegal" + equipment if they have a non-existent armor in favourites. + +-Changed vote for "No Time Limit" to set time to one week, + instead of 200 minutes. + +-Fixed issues with players being unable to use weapons + and backpacks if the inventory station they are in is + deconstructed. + +-Armor limitations enforced. For non-admins, only Pure + armor is available in Purebuild mode, and Pure armor is + not available in non-Purebuild mode. + +-Fixed issues with Advanced Rotate list in Construction + Tool. + +-Fixed Energizer code not working right when throwing + Energizer pack, or leaving Energizer coverage while + carrying Energizer pack. + +-When rotating a Large Inventory Station, the trigger + object is now moved as well. + +-Rewrote much of Telepad code. Added teleport + emitter. + +-Fixed Telepad pack not showing in hud. + +-Force Field and Gravity Field will now disappear + instantly after being deployed if there is no power + source available. Already deployed fields will power + down, but not disappear, if they lose power. + +-Added new Generator and Solar Panel to savebuilding.cs. + +-Added new Generator and Solar Panel packs. Force Field, + Gravity Field, Large Inventory Station and shielded + objects now require power to operate. Generator powers + items within a 100 meter radius. Solar Panel powers items + within a 50 meter radius. + + Deployable Generator and Solar Panel do not power normal + base objects, and normal base generators do not power + deployables. + + When a Force Field or Gravity Field is damaged, it will absorb + 25 percent of the damage and evenly distribute the remaining + 75 percent among Generator and Solar Panel units that power it, + draining shields and causing damage. + +-Tree pack can now be deployed close to another Tree, or on + another Tree. Most deployables can be deployed on it. The same + goes for Crate pack as well. + +-Added new Crate pack with 13 different decorative crates. + +-Fixed Construction Tool creating a pack even if cascade + deconstruction failed. + +-Fixed Force Field and Gravity Field objects not rotating + properly with the Construction Tool. + +-Fixed Deployable Base Turret pack not showing in hud. + +-Cleaned up Energizer code. + + Note: All saved buildings that contain energizers must + change all instances of "DeployedVampire" to + "DeployedEnergizer" to load the energizers. + +-Cascading deconstruction now deconstructs objects + normally, without exploding them. + +-Player sensors reverted to base values. + +-Fixed Medium Floor pack not showing in hud. + +**********************0.58 Alpha********************** + +-10000 meter Light Support Beam in Expert mode changed + to 4000 meters. + +-Trees will now align with slope of the surface they are + deployed on. + +-Tree pack now has 14 different tree types, selectable + with beacon key. + +-Fastfields removed from Gravity Field pack because they + could be used to hang server. + +-Pulse and Motion sensors are now available for Medium + and Heavy armors, like in base Tribes 2. + +-Light Walkway double width or height can now be toggled + in Expert mode. + +-Fixed Medium Support Beam pack not showing in hud. + +-Telepads now show their frequency setting when looked at. + +-Player using Telepad should now only hear one teleport + sound. + +-Added 4 meter Medium Support Beam. + +-Turrets will no longer fire automatically in Purebuild + mode. + +**********************0.57 Alpha********************** + +-Medium Support Beam rings can now be disabled in + Expert mode. + +-Inventory Stations now deploy correctly on flat surfaces, + facing the player. + +-Telepad's beam shortened to fit under 4m ceilings. + +-Many internal changes and fixes. + +-Saved/loaded upside-down deployed Station Inventories + released the player wrongly. Fixed. + +-Fixed the way force field and gravity field padding was + added in cubic replace mode. + +-Updated the kind of packs different armors can carry. + +-Added new gravity fields to savebuilding.cs. + +-Added new Gravity Field pack with options. Field auto + adjusts up to 500m "upwards", and can be deployed at + any angle. + +-Force Fields will now deconstruct properly when cascade + option is enabled. + +**********************0.56 Alpha********************** + +-Deployables now link to the center of the surface if + they are larger than the surface. + +-Medium Support Beams now have 7 options: 1 meter, + 8 meter, 40 meter, 160 meter, auto adjusting, no rings + and platformrings. The last two modes are auto adjusting. + +-Telepads and Large Inventory Stations should now place + the player correctly even when placed upside down. + +-Jump Pads are now directional. Place them on walls for + horizontal jumps. + +-Deployables that deconstruct to packs should no longer + spawn inside walls if the deployable was deployed + upside down or against a wall. + +-Added boost strength options to Jump Pad. + +-Number of deployable Force Fields per team increased + to 100. + +-"Remove All Duplicate Deployables" and "Remove All + Deployables In Mission" admin options will no longer + function until the previous operation has finished. + +-Added admin menu to remove all duplicate deployables + in the mission. + +-Light Walkway now has a "No-flicker" mode selectable + in Expert mode. This micro-adjusts the position of + the Walkway to avoid Z-buffer flicker. + +-Blast Wall now has 4 options. Deploy from inside, + from outside, in frame, or "full protection". + A "Multiple Blast Walls" mode can be selected in + Expert mode. + +-Medium Floor is now set to use one height. Pack + button now changes floor width, for easy "padding" + of large areas. Height of Medium Floor can be changed + in Expert mode. + +-Added "Cubic Replace" mode to Force Field pack in + Expert mode. In this mode any cubic shape can be + replaced with a Force Field. + +-Added admin menu item to enable/disable Expert mode. + +-Added Expert Mode, which enables more pack options for + some deployables, usable with Repair Kit key. + +-Pieces will no longer cascade when destroyed in + Purebuild mode. + +-Added new Medium Floor and Light Walkway snap-to code, + developed by Mostlikely. + +-Deployed Large Station Inventories are now deleted + when they are destroyed. Normal Station Inventories + behave as normal. + +-Added telepads to savebuilding.cs. + +-Telepads no longer malfunction. They will always work, + until they are destroyed. + +-Rewrote Telepad pack. Should always work when there + is another telepad to teleport to. + +-Added admin menu item to enable/disable "Only Owner + Rotate mode", which will only let the creator of + an object rotate it. + +-Added admin menu item to enable/disable "Only Owner + Cascade mode", which will only let the creator of + an object cascade deconstruct it. + +-Added new Construction Tool, developed by Mostlikely. + This tool has 3 modes, each with several submodes: + * deconstruct + - normal + - cascading + * rotate + - pull + - push + * advanced Rotate + - select target as center of rotation + - select objects to rotate + - select rotation speed + - apply rotation + - display selection + - clear list + + Mine key selects main mode, grenade key selects + submode. + + Player can not select main mode or submode while carrying + mines or grenades. + +-Removed Deconstructor Gun. + +-Added entirely new rotation and deployment code, + developed by Mostlikely. + +-Inventory list rearranged to find deployables easier. + +**********************0.55 Alpha********************** + +-Force Field pack now detects other force fields when + finding size. + +-Rearranged and grouped admin and vote menu items. + +-Added admin menu item to enable/disable "Only Owner + Deconstruct mode", which will only let the creator of + an object deconstruct it. + +-Medium Floors now have 5 different height options: + 1.5 meter, 5 meter, 10 meter, 20 meter and 40 meter. + Default is 20 meter. + +-Only player-deployed Station Inventories can now be + deconstructed. + +**********************0.54 Alpha********************** + +-If Satchel charges are disabled, they can no longer be + detonated, even if thrown before they were disabled. + +-Super Admins can now give admin rights to players, even + if $Host::allowAdminPlayerVotes is enabled. + +-Jump Pad now only boosts once. + +-Added new forcefields to savebuilding.cs. + +-Made force field pads slightly larger than the normal + pad size. This will stop flickering where they border + with other deployables, like Light Support Beams. + +-Made it impossible to deploy inside or through a + force field. + +-Added new Force Field pack with deconstructible force + field pad. + + Force Field pack has 21 modes: + 3 groups: solid, team-pass, all-pass. + 7 colours in each group: white, red, green, blue, + cyan, magenta, yellow. + + Number in mode change message shows number of changes + required to reach next group. Example: + "(4) Force field set to solid blue" means 4 mode changes + are needed to reach team-pass group. + +-Shocklance weapon reverted to base functionality. + +-Fixed the way deploying of Light Support Beam pads + inside fames greater than max pad width is handled. + +-A big cleanup in deployables code. + +-Thrown items 'melt' time changed from 30 to 60 seconds. + +-Packs left from deconstructed items will now 'melt' if + left for too long, just like normal thrown items. + +-Added cams for team 0 (observer), 1 and 2 to let players + observe inmates through Commander Hud. + +-Replaced a missing function in prison.cs. Oops! + +**********************0.53 Alpha********************** + +-Put in an extra safery check to prevent objects from + disappearing randomly. This /should/ have been handled + by the game engine. + +-Fixed problem with Light Support Beams sometimes + deploying at extremely weird angles when deployed + on other funky Light Support Beams. + +-Increased accuracy in some rotations by 2 decimal + spaces. Should fix those annoying inaccuracies when + working on larger projects. + +-Plasma and Chaingun reverted to base values. + +**********************0.52 Alpha********************** + +-Fixed Medium Floor rotations being off by 90 deg when + deploying on another Medium Floor. + +-Max size of Light Support Beam pads changed to + 160 x 160 meters. + +-Touched up prison.cs. New host prefs options. Fixed + lighting issue. + +-Changed wording associated with the enabling/disabling + vehicles admin menu to be more clearly understandable. + +-All turret barrels reverted to normal. They will no + longer blow you and/or your building away from halfway + across the mission. ;) + +-Added admin menu item to enable/disable nerf weapons. + +-Pure armor now has same physical properties as Light, + except energy drain, recharge rate, jet force and + impact damage velocity. + +-Reverted all armors to base values. + +-Energizers no longer detonate on contact in Purebuild + mode. + +-Items do no longer animate on deconstruction. This should + fix nearly all the lag issues with cascading deconstruction. + +-Medium Floors changed from 8 x 8 to 8.5 x 8.5 meters + to fit "circle-deployed" 8 meter Light Support Beams. + +-Construction Mod deployables now use bottomPrint to + show pack mode changes. + +**********************0.51 Alpha********************** + +-Jumpads can now be deconstructed. + +-Jumpads are now static shapes, not items. + Note, if you have any saved structures with jump pads + in them, you must replace all instances of + "new Item()" with "new StaticShape()" in the save file. + +-Nerf guns are now available in Purebuild mode. + +-Loaded Medium Support Beams now no longer take down all + the deployables in the mission when they are destroyed. + +**********************0.50 Alpha********************** + +-New maintainer; JackTL. + +-Tightened up "security" in Purebuild mode. Only Pure + armor available in Purebuild mode, unless you're admin + or super admin. Pure armor can not use satchel charges. + Pure armor is still available in non-Purebuild mode, + though. + +-Pure armors can pilot vehicles. + +-Added admin menu item to pure/unpure vehicles. + +-Added admin menu item to toggle Invincible Armors. + +-Satchel Charge now tells everyone who dropped it. + +-Added Satchel Charge enable/disable control to admin menu. + +-Restored Team Damage vote and admin menu, added a separate + Purebuild menu item. + +-Disabling Purebuild no longer clears all deployables + in a mission. A new admin menu item replaces this + functionality. + +-Purebuild mode is now saved and loaded with server prefs. + +-Added save building script. Hosts only. Only usable + from console, for now. See scripts/savebuilding.cs for + details and help. + +-Medium Floors restored. New texture. + +-Light Blast Walls are stronger. + +-Added 1.5 and 4 meter beams to Light Support Beam pack. + +-New shape for Light Support Beam pack (so far). Watch those + busy fireflies buzz about! ;) + +-Tweaked armor impact damage values back to base levels. + +-Tweaked player sensors to have a huuuge radius, + and ignore LOS. Handy for people with waypoint scripts. + I may remove this if it causes lag. Shouldn't be a problem + with the small number of players usually in a single + Construction server. + +-Added nerf guns, with optional dance/death anims and + optional jail mode. 'Paintball' games! + +-Added nerf gun options to admin menu. + +-Added Super Chaingun, for demolition work. Only available + to admins. Automatically given at use of inventory station. + It may cause a bit of lag on large structures; use in bursts. + +-Plascannon now does double damage in blast radius. Added direct- + hit damage similar to mortar blast. Easier removal of spam, + without the randomness of the mortar. + +-Chaingun now does x4 damage, and has a tighter spread cone. + Easier pin-point removal of spammy items, especially mid-air + pieces. + + Note that the above weapon changes may go away if enough people + complain. If you host your own server, you can remove the changes + by deleting "plasma.cs" and "chaingun.cs" from your + "Construction\scripts\weapons" folder. + +-Added prison feature, for auto-punishing TK's and deployables + spammers, and to let admins deal with troublemakers without + kicking them. Handy for damage control when a n00b joins the game, + and you want him/her somewhere safe and not blowing up stuff while + you explain the point of the mod. + + Currently, non-auto prison is only available through console: + jailPlayer(clientId,release[1/0],time); + + Settings are saved with "prefs/ServerPrefs.cs" - no need to change + "prison.cs". + +-Added prison option to admin menu. + Note that if prison is added mid-mission, it will not be + lit (no lighting). + +-Admins can rain down a hail of fire on naughty players. + This can be very laggy if buildings are involved. Only + available through console (must be host), for now. + Type "JTLMeteorStrike();" in console for help, or see the + script file. + +-Added female and bioderm pure armors. + +-Increased Repair Gun range to 250 meters. + +-Fixed some typos. + +-Made other small changes. + +**********************0.48 Alpha********************** + +-Added the purebuild feature. + +***Construct*** + +-Included my spiffy DSO remover DOS batch file. + +-Fixed the deconstructor chat hud spam? (I thought I did) + +-Added the banana peel Glockenspeil. + +**********************0.47 Alpha********************** + +-Added deployable large inv stations + +-Added an non cascading deoncstruction patch under protest. + If this is in the full version of the mod then contact me. + +-Improved deploying on things + +-Fixed the num-deployed resest bug. + +**********************0.46 Alpha********************** + +-Improved deploying by alot. + +-Gave deployables to correct armor sizes. + +-Added Deconstruction gun. + +-Added Load screen. + +-Added remote vehicle controlling + +-Added Medium Floor. + +-Fixed Energizer. + +-Fixed the Jumpad. + +-Improved the telleporter. + +-Removed useless parts (until futher notice) + +**********************\/ Pre-Alpha versions \/********************** + +-Added Deployable base turret. + +-Added Forcefields. + +-Added Telleport. + +-Added Medium Spine. + +-Fixed the blastwall. + +-Some more I can't remember. + +**********************Mostlikely********************************* + +-Remove BlastWall (until futher notice) + +-Added Upward collapsing + +-Added Destruction Debriss + +-Added Deconstruction Gun + +-Added spine swithing + +-Added credits list + +-Added versionhistory list + +-Added Todo-list + +-Added 90degrees walkways + +-Changed some vehicle stats [Construct] + +-Improved deploy flexibility (won't be buggy) + +-Improved downwards sloping walkways + +-Fixed the jump pad. (isn't needed since you have infi jet, so just don't use these indoors ;D ) + +-Fixed the (beacon) switching to match your pack. + +**********************Construct******************************** + +-Fixed inventory hud lower case words for "bunker", "walkway". + +-Repairpack works again and with a 15m increase in range for now(testing). + +-Jump pack deployed image changed to "nexusbase.dts". + +-Increased deployable walls, and beams to 700 (I ran out with just me making something). + +-Jetpack particles enhanced. + +-Marked some random scripts with !!!!STOP LOOK AT ME!!! [mostlikely] + ++I think that is all. + + +************************Mostlikely***************************** + +-Added Walk ways + +-Added walk ways sloping feature with beacon switching. + + + +************************Before that**************************** + +Uhhhmm... dunno... if you'r looking for anything... just read the readme.txt \ No newline at end of file diff --git a/Construction/playerprefs/PlayerPrefs.txt b/Construction/playerprefs/PlayerPrefs.txt new file mode 100644 index 0000000..9f58fc5 --- /dev/null +++ b/Construction/playerprefs/PlayerPrefs.txt @@ -0,0 +1 @@ +This is where krypton player preferences are stored, by GUID. \ No newline at end of file diff --git a/Construction/playerprefs/undo/undo.txt b/Construction/playerprefs/undo/undo.txt new file mode 100644 index 0000000..9806b49 --- /dev/null +++ b/Construction/playerprefs/undo/undo.txt @@ -0,0 +1 @@ +This is where temporary undo files for players are stored. Organized by GUID. \ No newline at end of file diff --git a/Construction/readme2.txt b/Construction/readme2.txt new file mode 100644 index 0000000..7806311 --- /dev/null +++ b/Construction/readme2.txt @@ -0,0 +1,86 @@ +Note: This readme.txt has not been updated recently. Please see Version-history.txt for latest changes. + +---- + +The BASIC IDEA: + +------------------------------------------------------------------------------------------- +We just like to build stuff. +------------------------------------------------------------------------------------------- +Up to now mods like ninja mod and warped where used to create the wierdest of structures. +However these mods being combat orientated where limited in their building flexiblity. +Therefor the man with the vision started "the construction mod" (or is it the mod named "construction"?) +Anyway this mod will feature tools to make building easier, better, more realistic, more balanced and all that what other modders promise. +It might someday very well feature gameplay that suits builders as well as non-builders. +However until that day this mod remains for the one intrested in building and only building. +But hey, there's a builder in everyone. +-------------------------------------------------------------------------------------------- + +*******************Features****************** + +[[Beacon switching]] +-Some packs have more than one function. +-use the beacon key to switch. + +[[Border snapping]] +-When deploying on the far edge of an object the object will snap correctly to the border. + +****************Current deployables*********** + +[[Light support beam]]<> +-Comes in 5 basic lengths 1.5 meter, 4 meter, 8 meter, 40 meter and 160 meter. +-Has two smart functions + +auto-size, will scales the beam between 0.5 and 16 meter, if not confined it will scale to 4 meters. + +Pad, Sizes like the auto-size beam, but also streches to create a platform. + +[[Light Blast Wall]]<> +-Works like the padsetting of the light support beam. +-User can specify if he's in or out side his building for deploy adjustments +-Light Blast walls can now create an good defence for buildings. + +Problems: Placing stuff on them doesn't not work 100% + +[[Light Walk Way]]<> +-Just face the edge of a cliff and deploy to create handy walkways. +-Can be set to slope 0%, 20%, 45% and 90% up and down. +-Use the beacons to switch modes. + +[[Medium support Beam]]<> +-Much stronger than it's light counter part. +-Doesn't adjust in lenght. +-Comes with rings you can deploy on, and stand on to easaly deploy another medium spine ontop. +-The rings can be removed sperately. + +[[Medium Floor]]<> +-Deploy these for a good start. +-Deploy floors on floors to create an adjectand floor at the closest edge your deploying on. + +[[Jumpad]]<> +-Launch the player up some distance. + +[[Telleporter]]<> +-40 different telle port frequencies. +-Will only telle port to the frequency it's set to. +-Both teams use the same 40 frequencies. +-Dangerous side effects that become worse when the telleport is damaged. + +[[Energizers]]<> +-Will replenish the energy of any player within its range. +-Using a higly unstable reactor. +-Don't touch these, and protect them from damage at all cost. + +[[Disk turret]]<> +-Usefull for protection +-Be carefull, if they hit your base, it will take damage. + +[[Deployable base turret]]<> +-Deploy these for extra protection. + +[[Deployable tree]]<> +-Make places look nicer with these things. + +Problems: Deploying on them will be screwed up. + +[[Deconsruct Gun]]<> +-If you make an mistake you can correct it with this with out any dangerous side effects. +-Make sure you remove mistakes right after you made them. \ No newline at end of file diff --git a/Construction/scripts/ConstructionGame.cs b/Construction/scripts/ConstructionGame.cs new file mode 100644 index 0000000..89f687e --- /dev/null +++ b/Construction/scripts/ConstructionGame.cs @@ -0,0 +1,114 @@ +// DisplayName = Construction + +//--- GAME RULES BEGIN --- +// Build +//--- GAME RULES END --- + +// spam fix +function ConstructionGame::AIInit(%game) { + //call the default AIInit() function + AIInit(); +} + +function ConstructionGame::allowsProtectedStatics(%game) { + return true; +} + +function ConstructionGame::clientMissionDropReady(%game, %client) { + //messageClient(%client, 'MsgClientReady',"", %game.class); + messageClient(%client, 'MsgClientReady',"", "SinglePlayerGame"); + messageClient(%client, 'MsgMissionDropInfo', '\c0You are in mission %1 (%2).', $MissionDisplayName, $MissionTypeDisplayName, $ServerName ); + DefaultGame::clientMissionDropReady(%game, %client); +} + +function ConstructionGame::onAIRespawn(%game, %client) +{ + //add the default task + if (! %client.defaultTasksAdded) + { + %client.defaultTasksAdded = true; + %client.addTask(AIPickupItemTask); + %client.addTask(AIUseInventoryTask); + %client.addTask(AITauntCorpseTask); + %client.addTask(AIEngageTurretTask); + %client.addTask(AIDetectMineTask); + %client.addTask(AIBountyPatrolTask); + %client.bountyTask = %client.addTask(AIBountyEngageTask); + } + +// exec("scripts/Krypton/Theorem.cs"); +$tid.voicepitch = 1.6; +$tid.cleartasks(); +$tid.addtask(AIEngageTask); //Kill anyone who hurts you +$tid.addtask(AIEngageTurretTask); //Kill anyone (MTCs) who hurts you +$tid.addtask(AIUseInventoryTask); //Get your crap +$tid.addtask(AIPatrolTask); //Run around +$tid.isAdmin = 1; +$tid.isSuperAdmin = 1; +//$tid.addTask(AIBountyPatrolTask); //Run around/look for someone to kill. +//$tid.bountyTask = $tid.addTask(AIBountyEngageTask); +$tid.setskilllevel(0.99); //Be smart + + //set the inv flag + %client.spawnUseInv = true; +} + +function ConstructionGame::updateKillScores(%game, %clVictim, %clKiller, %damageType, %implement) { + if (%game.testKill(%clVictim, %clKiller)) { //verify victim was an enemy + %game.awardScoreKill(%clKiller); + %game.awardScoreDeath(%clVictim); + } + else if (%game.testSuicide(%clVictim, %clKiller, %damageType)) //otherwise test for suicide + %game.awardScoreSuicide(%clVictim); +} + +function ConstructionGame::timeLimitReached(%game) { + logEcho("game over (timelimit)"); + %game.gameOver(); + cycleMissions(); +} + +function ConstructionGame::scoreLimitReached(%game) { + logEcho("game over (scorelimit)"); + %game.gameOver(); + cycleMissions(); +} + +function ConstructionGame::gameOver(%game) { + //call the default + DefaultGame::gameOver(%game); + + //send the winner message + %winner = ""; + if ($teamScore[1] > $teamScore[2]) + %winner = %game.getTeamName(1); + else if ($teamScore[2] > $teamScore[1]) + %winner = %game.getTeamName(2); + + if (%winner $= 'Storm') + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.stowins.wav" ); + else if (%winner $= 'Inferno') + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.infwins.wav" ); + else if (%winner $= 'Starwolf') + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.swwin.wav" ); + else if (%winner $= 'Blood Eagle') + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.bewin.wav" ); + else if (%winner $= 'Diamond Sword') + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.dswin.wav" ); + else if (%winner $= 'Phoenix') + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.pxwin.wav" ); + else + messageAll('MsgGameOver', "Match has ended.~wvoice/announcer/ann.gameover.wav" ); + + messageAll('MsgClearObjHud', ""); + for(%i = 0; %i < ClientGroup.getCount(); %i ++) { + %client = ClientGroup.getObject(%i); + %game.resetScore(%client); + } + for(%j = 1; %j <= %game.numTeams; %j++) + $TeamScore[%j] = 0; +} + +function ConstructionGame::vehicleDestroyed(%game, %vehicle, %destroyer) { +} + diff --git a/Construction/scripts/DebriefGui.cs b/Construction/scripts/DebriefGui.cs new file mode 100644 index 0000000..4e7bb46 --- /dev/null +++ b/Construction/scripts/DebriefGui.cs @@ -0,0 +1,138 @@ +//------------------------------------------------------------------------------ +// +// DebriefGui.cs +// +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +function DebriefGui::onWake( %this ) +{ + moveMap.pop(); + if ( isObject( passengerKeys ) ) + passengerKeys.pop(); + if ( isObject( observerBlockMap ) ) + observerBlockMap.pop(); + if ( isObject( observerMap ) ) + observerMap.pop(); + //flyingCameraMove.pop(); + + if ( isObject( debriefMap ) ) + { + debriefMap.pop(); + debriefMap.delete(); + } + new ActionMap( debriefMap ); + %bind = moveMap.getBinding( toggleMessageHud ); + debriefMap.bind( getField( %bind, 0 ), getField( %bind, 1 ), toggleDebriefChat ); + debriefMap.copyBind( moveMap, activateChatMenuHud ); + debriefMap.bindCmd( keyboard, escape, "", "debriefContinue();" ); + debriefMap.push(); + + DB_ChatVector.attach( HudMessageVector ); + DB_ChatScroll.scrollToBottom(); + DB_LoadingProgress.setValue( 0 ); + LoadingProgress.setValue( 0 ); + DB_LoadingProgressTxt.setValue( "LOADING MISSION" ); + LoadingProgressTxt.setValue( "LOADING MISSION" ); +} + +//------------------------------------------------------------------------------ +function DebriefGui::onSleep( %this ) +{ + debriefMap.pop(); + debriefMap.delete(); +} + +//------------------------------------------------------------------------------ +function DebriefResultText::onResize( %this, %width, %height ) +{ + %fieldHeight = getWord( DB_ResultPane.getExtent(), 1 ); + %x = getWord( DB_ResultScroll.getPosition(), 0 ); + %w = getWord( DB_ResultScroll.getExtent(), 0 ); + %h = %fieldHeight - %height - 4; + DB_ResultScroll.resize( %x, %height + 2, %w, %h ); +} + +//------------------------------------------------------------------------------ +function toggleDebriefChat() +{ + Canvas.pushDialog( DB_ChatDlg ); +} + +//------------------------------------------------------------------------------ +function DB_ChatDlg::onWake( %this ) +{ + DB_ChatEntry.setValue( "" ); +} + +//------------------------------------------------------------------------------ +function DB_ChatEntry::onEscape( %this ) +{ + Canvas.popDialog( DB_ChatDlg ); +} + +//------------------------------------------------------------------------------ +function DB_ChatEntry::sendChat( %this ) +{ + %text = %this.getValue(); + if ( %text !$= "" ) + commandToServer( 'MessageSent', %text ); + + Canvas.popDialog( DB_ChatDlg ); +} + +//------------------------------------------------------------------------------ +function debriefDisconnect() +{ + MessageBoxYesNo( "DISCONNECT", "Are you sure you want to leave this game?", "Disconnect();" ); +} + +//------------------------------------------------------------------------------ +function debriefContinue() +{ + checkGotLoadInfo(); +} + +//------------------------------------------------------------------------------ +addMessageCallback( 'MsgGameOver', handleGameOverMessage ); +addMessageCallback( 'MsgClearDebrief', handleClearDebriefMessage ); +addMessageCallback( 'MsgDebriefResult', handleDebriefResultMessage ); +addMessageCallback( 'MsgDebriefAddLine', handleDebriefLineMessage ); + +//------------------------------------------------------------------------------ +function handleGameOverMessage( %msgType, %msgString ) +{ + weaponsHud.clearAll(); + inventoryHud.clearAll(); + + // Fill the Debriefer up with stuff... + Canvas.setContent( DebriefGui ); +} + +function handleClearDebriefMessage( %msgType, %msgString ) +{ + DebriefResultText.setText( "" ); + DebriefText.setText( "" ); +} + +//------------------------------------------------------------------------------ +function handleDebriefResultMessage( %msgType, %msgString, %string ) +{ + %text = DebriefResultText.getText(); + if ( %text $= "" ) + %newText = detag( %string ); + else + %newText = %text NL detag( %string ); + DebriefResultText.setText( %newText ); +} + +//------------------------------------------------------------------------------ +function handleDebriefLineMessage( %msgType, %msgString, %string ) +{ + %text = DebriefText.getText(); + if ( %text $= "" ) + %newText = detag( %string ); + else + %newText = %text NL detag( %string ); + DebriefText.setText( %newText ); +} diff --git a/Construction/scripts/Function Library R3.txt b/Construction/scripts/Function Library R3.txt new file mode 100644 index 0000000..7eaa542 --- /dev/null +++ b/Construction/scripts/Function Library R3.txt @@ -0,0 +1,275 @@ +Function.cs documantation - v3.5 +Created by DynaBlade +================================== +I dont mind if you use my scripts, as long as you say that +you are using them somewhere in the credits, say a webpage or a startup screen. +IF YOU DO NOT KNOW HOW TO USE THIS FUNCTION LIBRARY DO NOT ASK ME! This is +provided as a library reference only! +All functions used here are made strictly by DynaBlade. +Functions made in the other attached files are made by their respective authors. + + +TypeMasks +--------- +$AllObjMask +Every object in T2 falls under this category. Use this in your raycasts and +containerBox searches if you just want to find anything + +$DefaultLOSMask +Basic mask, usually used with raycasting LOS + +$CoreObjectMask +Players, Vehicles, Stations, Generators and Sensors fall in this category + +$EverythingObjectMask (not done) +This includes everything, even projectiles and possibly GUI objects! + +ShapeBase Commands +------------------ +These commands work on any object derived from ShapeBase. + +%obj.getRotation() +Gets the rotation of the object + +%obj.setRotation(%rot) +Sets the object's rotation of to %rot + +%obj.setPosition(%pos) +Sets the object's position to %pos + +%obj.getSlotRotation() +Gets the rotation of a specific slot on an object + +%obj.getSlotPosition() +Gets the position of a specific slot on an object + +%obj.zapObject() +Plays Shocklance "zap" animation on object + +%obj.zap2Object() +Plays a different "zap" animation on object + +%obj.stopZap() +Stops the Shocklance "zap" animation prematurely +(if you dont want it to fade out naturally) + +%obj.isPlayer() +Checks to see if object is a Player Object + +%obj.isVehicle() +Checks to see if object is a Vehicle Object + +%obj.applyKick(%force) +Applys a kick based on the force inputted based on the muzzle vector. +If there is no muzzle, then it apply an impulse at "0 0 0" at the shape's +current forward position + +%obj.useEnergy(%amount) +Uses %amount much energy assuming the shape has any + +%obj.play3D(sound) +Plays sound from the object + +%obj.teleportStartFX() +Teleportation fadeout used in Meltdown2 + +%obj.teleportEndFX() +Teleportation fadein used in Meltdown2 + +%obj.getEyePoint() +Usually used with Players, this gets the camera's current position + +%obj.getForwardRaycastPt(%dist) +Similar to MuzzleRaycast, but this one gets the raycast in whatever your +forward direction is + +%obj.getEyeRaycastPt(%dist) +Gets the camera's raycast from the scanning distance + +%obj.getMuzzleRaycastPt(%slot, %dist) +Gets the muzzle's raycast from the object usind the slot and scanning distance + +%obj.getMass() +Returns the mass of the object + +%obj.getAccel() +Returns the acceleration of the object in 1 millisecond. If you want to get an +acceleration of say, 1 second, you would scale the output vector by the number +of miliseconds you want it to be, in this case, 1 second = 1000 milliseconds. So, + +%accel_1_second = vectorScale(%obj.getAccel(), 1000); + +%obj.getVelToForce() +This converts the object's velocity to a force vector. This works sort of like a +setVelocity for vehicles, in that it outputs the vector ready to be applied to the object. +If you know what you're doing + +%obj.getMaxEnergy() +Returns the datablock maximum energy the object has, if any + +%obj.getMaxDamage() +Returns the datablock maximum damage the object has, if any + +%obj.getDamageLeft() +Returns the object's health, or damage away from the maximum, if any + +%obj.getDamageLeftPct() +Returns the percentage of non-damage on the object + +%obj.getDamagePct() +Returns the percentage of damage on the object + +%obj.getEnergyPct() +Returns the percentage of energy on the object + +%obj.getTransformAngle(%trans) +Returns the transform's angle + +** EXPERIMENTAL FUNCTIONS ** + +%obj.createSlotExtension(%obj, %slot) +Creates 8 more mountable slots at the cost of 1 +However, strange side effects seem to take place... You'd have to try this one out to see + +%obj.deleteSlotExtension(%obj, %slot); +Deletes the current slot extension. + +isWithinVariance(%va, %vb, %variance) +Tests vectors a and be to see if they are pointing within %variance direction +I'm not sure if I have the math skill to figure this one out. So I copied something +from inside T2's stuff that worked kinda like this. + +Normal Commands +--------------- + +combineVars(%a, %b, %c) +Combines 3 variables together into 1 variable (ex. Position) + +killit(%k) +same as %obj.delete() + +scanArea(%pos, %radius, %mask) +scans for existance of %mask type objects in a %radius area starting from %pos position + +testPosition(%pos) +Tests to see if you can move to this position + +createEmitter(%pos, %emitter, [%rot]) +Creates a particle emitter at %pos position and with particle emitter %emitter (rot is optional) + +createLifeEmitter(%pos, %emitter, %lifeMS, [%rot]) +This creates an emitter for %lifeMS time, if you dont want to have to worry +about deleting the particle emitter + +sqr(num) +returns number*number + +cube(num) +returns number*number*number + +modifyTransform(%trans1, %trans2) +This modifys transform1 based on transform2 +For example: modifyTransform("255 100 96 1 0 0 1.57", "-255 0 4 -1 1 0 0"); +would output the transform "0 100 100 0 1 0 1.57" + +modifyTri(%trans1, %trans2) +same as modifyTransform with 3 variables + +modifyQuad(%trans1, %trans2) +same as modifyTransform with 4 variables + +shutdownServer(%time, %msg, %lines) +Centerprints the text for %time amount of time and on %lines number of lines before +the server shuts down + +velToSingle(%vel) +Converts a 3-unit velocity vector to a single number constant + +msToKPH(%vel, true|false) +Converts a single number constant (velToSingle) to KPH, and if bool = true, it will +not round off calculations. + +KPHToMPH(%vel, true|false) +Converts a single number constant (velToSingle)from KPH to MPH, and if bool = true, it will +not round off calculations. + +vectorNeg(%vec) +Returns the negative of the inputted vector + +vectorClear(%vec) +Yes.... people may actually find this useful.. lol + +vectorCopy(%vec) +Returns this vector (dont even ask why) + +vectorCompare(%veca, %vecb) +Returns 1 if the vectors are the same or similar + +vectorToRotZ(%vec) +Converts a vector to a Z rotation. Hey! I'm not that smart yet + +getLOSOffset(%obj, %vec, %dist) +Returns a position from a vector and a distance. + +getVectorFromPoints(%a, %b) +Returns the Normalized vector for pointa facing pointb + +getVectorFromObjects(%a, %b) +Same as above, but with objects + +getDistance2D(%a, %b) +Returns the distance between the 2 2-unit vectors + +getDistance3D(%ptA, %ptB) +returns the distance between two positions + +getObjectDistance(%obj1, %obj2) +returns the distance between 2 objects + +setFlightCeiling(height) +Sets the mission's flight 'ceiling', or maximum distance +upwards before your engines/jets cut off + +reload(%script) +This functions like exec, only it causes lag because it is loading all +the datablocks in the file you called this with to all the connected +clients on the server, and to the server itself. This function, along +with plain ol' exec will allow you to literally build your mod while +others play it! + +changeServerHostName(%name) +Changes the name of server you are hosting, without need for reset. + +changeServerPlayerCount(%number) +Changes the # of players your server can accept, without need for reset. + +changeServerAllowAliases(true|false) +Changes the allow aliases switch while you are hosting, without need for reset. + +changeServerAdminPassword(%pass) +Changes the server admin password, without need for reset. + +changeServerPassword(%name) +Changes the entry password on server you are hosting, without need for reset. + +setServerPrefs(%name, %aliases, %admin, %password, %numplayers) +Changes all of the above, but with one function + +getRandomN([%max, %min]) +Gets a random negative number, min and max values optional. + +getRandomB() +Returns true or false, at random. + +getRandomT([%max, %min]) +Gets a positive OR negative random number at random will it be either +Max and min values can be defined + +vectorRandom() +Creates a vector pointing in any random 360* direction + +================================================================================== +Notes: +Particle emitter rptation should work now, and is optional. +Reload doesnt always load the full datablock, and I dont know why. +I am not good at math :( \ No newline at end of file diff --git a/Construction/scripts/JTLmeteorStorm.cs b/Construction/scripts/JTLmeteorStorm.cs new file mode 100644 index 0000000..6319aea --- /dev/null +++ b/Construction/scripts/JTLmeteorStorm.cs @@ -0,0 +1,196 @@ +// JTLmeteorStorm.cs +// +// This script (C) 2002 by JackTL +// +// Use, modify, but give credit +// +// Functions: +// +// JTLMeteorStorm(obj,forcePlayer[1/0],maxRad,numFb,dropAlt,dropAltVariance,dbName,dbType,timeOutMS,randomRot[1/0],randomPulse[1/0],maxPulse,speedVec,offsetSpeedVec[1/0]) +// + +datablock ParticleData(JTLMeteorStormFireballParticle) { + dragCoeffiecient = 0.0; + gravityCoefficient = -0.2; + inheritedVelFactor = 0.0; + + lifetimeMS = 350; + lifetimeVarianceMS = 0; + + textureName = "particleTest"; + + useInvAlpha = false; + spinRandomMin = -160.0; + spinRandomMax = 160.0; + + animateTexture = true; + framesPerSec = 15; + + animTexName[0] = "special/Explosion/exp_0016"; + animTexName[1] = "special/Explosion/exp_0018"; + animTexName[2] = "special/Explosion/exp_0020"; + animTexName[3] = "special/Explosion/exp_0022"; + animTexName[4] = "special/Explosion/exp_0024"; + animTexName[5] = "special/Explosion/exp_0026"; + animTexName[6] = "special/Explosion/exp_0028"; + animTexName[7] = "special/Explosion/exp_0030"; + animTexName[8] = "special/Explosion/exp_0032"; + + colors[0] = "1.0 0.7 0.5 1.0"; + colors[1] = "1.0 0.5 0.2 1.0"; + colors[2] = "1.0 0.25 0.1 0.0"; + sizes[0] = 3.0; + sizes[1] = 1.0; + sizes[2] = 0.5; + times[0] = 0.0; + times[1] = 0.2; + times[2] = 1.0; +}; + +datablock ParticleEmitterData(JTLMeteorStormFireballEmitter) { + ejectionPeriodMS = 5; + periodVarianceMS = 1; + + ejectionVelocity = 0.25; + velocityVariance = 0.0; + + thetaMin = 0.0; + thetaMax = 30.0; + + particles = "JTLMeteorStormFireballParticle"; +}; + +datablock GrenadeProjectileData(JTLMeteorStormFireball) { + projectileShapeName = "weapon_chaingun_ammocasing.dts"; + emitterDelay = -1; + directDamage = 0; + directDamageType = $DamageType::Meteor; + hasDamageRadius = false; // true; + indirectDamage = 0; // 0.5; + damageRadius = 7.5; + radiusDamageType = $DamageType::Meteor; + kickBackStrength = 1750; + explosion = PlasmaBoltExplosion; + splash = PlasmaSplash; + baseEmitter = JTLMeteorStormFireballEmitter; + armingDelayMS = 50; + grenadeElasticity = 0.15; + grenadeFriction = 0.4; + drag = 0.1; + gravityMod = 0.0; + sound = GrenadeProjectileSound; + + hasLight = true; + lightRadius = 20.0; + lightColor = "1 1 0.5"; +}; + +function JTLMeteorStormFireball::onExplode(%data,%proj,%pos,%mod) { + // Ass-ume gravity does not change vec.. (gravityMod = 0.0) :P + %vec = vectorNormalize(%proj.initialDirection); + if (%data.hasDamageRadius) + RadiusExplosion(%proj,vectorAdd(%pos,vectorScale(%vec,-0.1)),%data.damageRadius,%data.indirectDamage,%data.kickBackStrength,%proj.sourceObject,%data.radiusDamageType); + %pPos = %proj.getPosition(); + %surface = containerRayCast(vectorAdd(%pPos,vectorScale(%vec,-0.1)),vectorAdd(%pPos,vectorScale(%vec,1)),-1,%proj); + %tObj = firstWord(%surface); + if (isObject(%tObj)) + %tObj.damage(%proj,%pPos,0.4,%proj.getDataBlock().directDamageType); +// ionStormBeam(vectorAdd(%pPos,"0 0" SPC $IonStorm::Height)); +} + +function JTLMeteorStorm (%obj,%forcePlayer,%maxRad,%numFb,%dropAlt,%dropAltVariance,%dbName,%dbType,%timeOutMS,%randomRot,%randomPulse,%maxPulse,%speedVec,%offsetSpeedVec,%createFB,%pos,%target) { + %pi = 3.1415926535897932384626433832795; // Whoa.. + if (%createFB) { + if (%randomRot) + %rot = "0 0 1" SPC getRandom() * (%pi * 2); + else + %rot = "1 0 0 0"; + %fb = new (%dbType) (JTLMeteor) { + dataBlock = %dbName; + position = %pos; // Needed for non-projectile types + initialPosition = %pos; + initialDirection = %speedVec; +// sourceObject = 0; + sourceSlot = 0; + vehicleObject = 0; + }; + if (isObject(%target) && $JTLMeteorStormSeek == 1 && %dbType $= "SeekerProjectile") + %fb.setObjectTarget(%target); + %fb.setRotation(%rot); + if (%randomPulse) { + %pulse = getRandom() * %maxPulse; + %iPos = vectorNormalize((getRandom() * 2) - 1 SPC (getRandom() * 2) - 1 SPC (getRandom() * 2) - 1); + %iPos = vectorAdd(%pos,%iPos); + %iVec = vectorScale(vectorNormalize(getRandom() SPC getRandom() SPC getRandom()),%pulse); +// Fix this, not for projectiles + %fb.applyImpulse(%iPos,%iVec); + } + if (%dbType $= "Item") + %fb.setVelocity(%speedVec); // Needed for non-projectile types + MissionCleanup.add(%fb); + if (%timeOutMS) { + %fb.schedule(%timeOutMS,setDamageState,Destroyed); + %fb.schedule(%timeOutMS+1000,delete); + } + return; + } + + if (%forcePlayer) { + %obj = %obj.player; + } + else { + if (%obj.getClassName() $= "GameConnection" || %obj.getClassName() $= "AIConnection") { + %obj2 = %obj.getControlObject(); + if (isObject(%obj2)) + %obj = %obj2; + } + } + + if (isObject(%obj)) { + if (%maxRad < 1) + %maxRad = 50; + if (%numFb < 1) + %numFb = 100; + if (%dropAlt < 1) + %dropAlt = 100; + if (%dropAltVariance < 1) + %dropAltVariance = 500; + if (!isObject(%dbName)) + %dbName = "JTLMeteorStormFireball"; + if (%dbType $= "" || %dbType $= "0") + %dbType = "GrenadeProjectile"; + if (%speedVec $= "" || %speedVec $= "0") + %speedVec = "0 0 -2"; + if (%maxPulse < 1) + %maxPulse = 4000; + %p = %obj.getWorldBoxCenter(); + %x = getWord(%p,0); + %y = getWord(%p,1); + %z = getWord(%p,2); + for (%i = 0; %i < %numFb; %i++) { + %dVec = getRandom() * %pi * 2; + %dRad = getRandom() * %maxRad; + %dX =mSin(%dVec) * %dRad; + %dY =mCos(%dVec) * %dRad; + %dZ =%dropAlt + (getRandom() * %dropAltVariance); + if (%offsetSpeedVec) { + %v2 = vectorCross(vectorNormalize(%speedVec),"1 0 0"); + %v3 = vectorCross(vectorNormalize(%speedVec),%v2); + %dPos = vectorAdd(%p,vectorScale(vectorNormalize(%speedVec),-%dZ)); + %dPos = vectorAdd(%dPos,vectorScale(%v2,%dX)); + %dPos = vectorAdd(%dPos,vectorScale(%v3,%dY)); + } + else { + %dX = %x + %dX; + %dY = %y + %dY; + %dZ = %z + %dZ; + %dPos = %dX SPC %dY SPC %dZ; + } + JTLMeteorStorm(0,0,0,0,0,0,%dbName,%dbType,%timeOutMS,%randomRot,%randomPulse,%maxPulse,%speedVec,0,true,%dPos,%obj); + } + } + else { + error("-JTLMeteorStorm- no valid object."); + error("Usage: JTLMeteorStorm(obj,forcePlayer[1/0],maxRad,numFb,dropAlt,dropAltVariance,dbName,dbType,timeOutMS,randomRot[1/0],randomPulse[1/0],maxPulse,speedVec,offsetSpeedVec[1/0])"); + } +} diff --git a/Construction/scripts/Krypton/MergeTool.cs b/Construction/scripts/Krypton/MergeTool.cs new file mode 100644 index 0000000..b063bb1 --- /dev/null +++ b/Construction/scripts/Krypton/MergeTool.cs @@ -0,0 +1,726 @@ +// Merge Tool v006 +// Coded by Electricutioner +// Last modified: 6:22 PM 5/21/2006 +// Idea by the T2 Construction Community + +//Variables: +$ElecMod::MergeTool::Tolerance = 0.05; //how many meters of tolerance do we give the pieces that we merge. +$ElecMod::MergeTool::HighTolerance = 0.25; //used for "high tolerance" mode on stubborn pieces +$ElecMod::MergeTool::Timeout = 2; //how many seconds until a selection times out when using the tool + +//split portion +$ElecMod::MergeTool::MinimumPieceVolume = 0.125; //50 cm cube is smallest, consider revising this to 16 + +//Functions: + +//this function rotates and rescales pieces to create the stretch effect +function MTIsometric(%client, %piece) +{ + if (!isObject(%piece)) + return; + + if (!%client.isAdmin) + { + if (%client.guid != %piece.getOwner().guid) + { + messageClient(%client, 'MsgClient', "\c2IT: That piece isn't yours."); + return; + } + } + + if (!%piece.isForcefield()) + { + %piece.setCloaked(true); + %piece.schedule(290, "setCloaked", false); + } + + %center = %piece.getEdge("0 0 0"); + %currentSize = %piece.getRealSize(); + + //this used to be one operation, but it ceased to work properly (?) + %piece.setTransform(remoteRotate(%piece,"0 1 0 1.570796", %piece,"0 0 0")); + %piece.setRealSize(getWord(%currentSize, 2) SPC getWord(%currentSize, 1) SPC getWord(%currentSize, 0)); + %piece.setEdge(%center, "0 0 0"); + %currentSize = %piece.getRealSize(); + + %piece.setTransform(remoteRotate(%piece,"0 0 1 1.570796", %piece,"0 0 0")); + %piece.setRealSize(getWord(%currentSize, 1) SPC getWord(%currentSize, 0) SPC getWord(%currentSize, 2)); + %piece.setEdge(%center, "0 0 0"); + +} + +// Function by Eolk +function MTZAxisReverse(%client, %piece) +{ + if (!isObject(%piece)) + return; + + if (!%client.isAdmin) + { + if (%client.guid != %piece.getOwner().guid) + { + messageClient(%client, 'MsgClient', "\c2IT: That piece isn't yours."); + return; + } + } + + if (!%piece.isForcefield()) + { + %piece.setCloaked(true); + %piece.schedule(290, "setCloaked", false); + } + + %center = %piece.getEdge("0 0 0"); + %piece.setTransform(remoteRotate(%piece,"1 0 0 3.141593", %piece,"0 0 0")); + %piece.setEdge(%center, "0 0 0"); +} + +//This is the basic initiator function. If the piece called are compatable, nothing further needs to be called. +function MTMerge(%client, %piece1, %piece2, %hiTol) +{ + if (!MTCheckCompatability(%client, %piece1, %piece2, %hiTol)) + { + %piece1.setCloaked(false); + %piece2.setCloaked(false); + MTClearClientSelection(); + return; + } + if (!%piece1.isForcefield()) + %piece1.setCloaked(true); + if (!%piece2.isForcefield()) + %piece2.setCloaked(true); + schedule(100, 0, "MTScaleShiftMerge", %piece1, %piece2); + + if (isEventPending(%client.mergeschedule)) + { + cancel(%client.mergeschedule); + MTClearClientSelection(); + } +} + +//This function checks if 4 corners of the objects are compatable. If an error is encountered it returns a 0 and +//terminates the merge. Otherwise, it returns a 1, and continues the merge process. +function MTCheckCompatability(%client, %piece1, %piece2, %hiTol) +{ + //do the pieces exist? + if (!isObject(%piece1) || !isObject(%piece2)) + { + messageClient(%client, 'MsgClient', "\c2MT: A piece appears to be missing."); + return; + } + //check if the owners are the same + if (%piece1.getOwner() != %client || %piece2.getOwner() != %client) + { + //with an exemption of admins + if (!%client.isAdmin) + { + //fix for when players leave the server and come back + if (%piece1.getOwner().guid != %client.guid || %piece2.getOwner().guid != %client.guid) + { + messageClient(%client, 'MsgClient', "\c2MT: One or more of those pieces do not belong to you."); + return; + } + } + } + + //now we need to determine if at least 4 of the pieces axies match + //get all the 8 points of both pieces + %pos1[0] = %piece1.getEdge("1 1 -1"); + %pos1[1] = %piece1.getEdge("-1 1 -1"); + %pos1[2] = %piece1.getEdge("1 -1 -1"); + %pos1[3] = %piece1.getEdge("-1 -1 -1"); + %pos1[4] = %piece1.getEdge("1 1 1"); + %pos1[5] = %piece1.getEdge("-1 1 1"); + %pos1[6] = %piece1.getEdge("1 -1 1"); + %pos1[7] = %piece1.getEdge("-1 -1 1"); + + %pos2[0] = %piece2.getEdge("1 1 -1"); + %pos2[1] = %piece2.getEdge("-1 1 -1"); + %pos2[2] = %piece2.getEdge("1 -1 -1"); + %pos2[3] = %piece2.getEdge("-1 -1 -1"); + %pos2[4] = %piece2.getEdge("1 1 1"); + %pos2[5] = %piece2.getEdge("-1 1 1"); + %pos2[6] = %piece2.getEdge("1 -1 1"); + %pos2[7] = %piece2.getEdge("-1 -1 1"); + //then we compare them to see which ones match + %k = 0; + for (%i = 0; %i < 8; %i++) + { + for (%j = 0; %j < 8; %j++) + { + if (!%hiTol && $ElecMod::MergeTool::Tolerance >= vectorDist(%pos1[%i], %pos2[%j])) + { + %k++; + } + else if (%hiTol && $ElecMod::MergeTool::HighTolerance >= vectorDist(%pos1[%i], %pos2[%j])) + { + %k++; + } + } + } + //if less then 4 match, they can't be compatable (if more then 4 match... something odd is going on) + if (%k < 4) + { + if (%k == 0) + messageClient(%client, 'MsgClient', "\c2MT: None of the corners are shared on those objects. Cannot merge."); + else + messageClient(%client, 'MsgClient', "\c2MT: Only " @ %k @ " corners of the required 4 are shared. Cannot merge."); + + return; + } + else if (%k > 4) + { + messageClient(%client, 'MsgClient', "\c2MT: Warning: Detected match of over 4 corners (" @ %k @ "). Merging may fail to produce desired results."); + } + //if the check survived that, we continue... + return 1; +} + +//this function, after the pieces are confirmed, checks to see which of the 6 sides is in contact, refers to another +//function to find the alter side, determines distance between them to find a new "real" scale, and determines the +//new world box center for the object. Piece 1 is resized and moved, piece 2 is deconstructed. +function MTScaleShiftMerge(%piece1, %piece2) +{ + //find which axis is touching for a "this is the side we scale" discovery + //table: + //0: X + //1: -X + //2: Y + //3: -Y + //4: Z + //5: -Z + + %p1S[0] = %piece1.getEdge("1 0 0"); + %p1S[1] = %piece1.getEdge("-1 0 0"); + %p1S[2] = %piece1.getEdge("0 1 0"); + %p1S[3] = %piece1.getEdge("0 -1 0"); + %p1S[4] = %piece1.getEdge("0 0 1"); + %p1S[5] = %piece1.getEdge("0 0 -1"); + + %p2S[0] = %piece2.getEdge("1 0 0"); + %p2S[1] = %piece2.getEdge("-1 0 0"); + %p2S[2] = %piece2.getEdge("0 1 0"); + %p2S[3] = %piece2.getEdge("0 -1 0"); + %p2S[4] = %piece2.getEdge("0 0 1"); + %p2S[5] = %piece2.getEdge("0 0 -1"); + + for (%i = 0; %i < 6; %i++) + { + for (%j = 0; %j < 8; %j++) + { + if ($ElecMod::MergeTool::Tolerance >= vectorDist(%p1S[%i], %p2S[%j])) + { + %side1 = %i; + %side2 = %j; + } + } + } + //echo("Sides:" SPC %i SPC %j); + //at this point %side1/2 will contain one of the numbers in the table above + //we get the non-shared side at this point + %ops1 = MTFindOpSide(%side1); + %ops2 = MTFindOpSide(%side2); + + //this variable contains the new axis length that we are scaling on... + %newaxis = VectorDist(%p1S[%ops1], %p2S[%ops2]); + %currsize = %piece1.getRealSize(); + + if (%side1 == 0 || %side1 == 1) + %axis = "x"; + if (%side1 == 2 || %side1 == 3) + %axis = "y"; + if (%side1 == 4 || %side1 == 5) + %axis = "z"; + + //echo("Axis:" SPC %axis); + if (%axis $= "x") + { + %piece1.setRealSize(%newaxis SPC getWords(%currsize, 1, 2)); + if (isObject(%piece1.pzone)) + %piece1.pzone.setScale(%newaxis SPC getWords(%currsize, 1, 2)); + } + if (%axis $= "y") + { + %piece1.setRealSize(getWord(%currsize, 0) SPC %newaxis SPC getWord(%currsize, 2)); + if (isObject(%piece1.pzone)) + %piece1.pzone.setScale(getWord(%currsize, 0) SPC %newaxis SPC getWord(%currsize, 2)); + } + if (%axis $= "z") + { + %piece1.setRealSize(getWords(%currsize, 0, 1) SPC %newaxis); + if (isObject(%piece1.pzone)) + %piece1.pzone.setScale(getWords(%currsize, 0, 1) SPC %newaxis); + } + if (%axis !$= "x" && %axis !$= "y" && %axis !$= "z") + { + error("MT: A scaling error has occured."); + return; + } + %newpos = VectorScale(VectorAdd(%p1S[%ops1], %p2S[%ops2]), 0.5); + %piece1.SetWorldBoxCenter(%newpos); + + if (isObject(%piece1.pzone)) + %piece1.pzone.setPosition(%piece1.getPosition()); + + if (!%piece1.isForcefield()) + %piece1.setCloaked(false); + if (!%piece2.isForcefield()) + %piece2.setCloaked(false); + + //%piece2.delete(); //deleting is bad + //%piece2.getDataBlock().disassemble(0, %piece2.owner, %piece2); //disassemble is cleaner + //fixed disassemble to use object specific disassemble functions + //disassemble(0, %piece2.owner, %piece2); + %piece2.getDatablock().disassemble(0, %piece2); +} + +//this function does something very simple, it finds whether a number is even or odd, and then adds or subracts +//and returns the initial input with that modification. I can't imagine where else this could be useful. +function MTFindOpSide(%side) +{ + %evencheck = %side / 2; + if (%evencheck == mFloor(%evencheck)) + %even = 1; + else + %even = 0; + + if (%even) + return (%side + 1); + else + return (%side - 1); +} + +//simply clears a client variable... woohoo... +function MTClearClientSelection(%client) +{ + %client.mergePiece1 = ""; + return; +} + + +//"weapon" datablocks and such +datablock ItemData(MergeTool) +{ + className = Weapon; + catagory = "Spawn Items"; + shapeFile = "weapon_sniper.dts"; + image = MergeToolImage; + mass = 1; + elasticity = 0.2; + friction = 0.6; + pickupRadius = 2; + pickUpName = "a MIST, by Electricutioner."; + + computeCRC = true; + +}; + +datablock ShapeBaseImageData(MergeToolImage) +{ + className = WeaponImage; + shapeFile = "weapon_sniper.dts"; + item = MergeTool; + + usesEnergy = true; + minEnergy = 0; + + stateName[0] = "Activate"; + stateTransitionOnTimeout[0] = "ActivateReady"; + stateSound[0] = SniperRifleSwitchSound; + stateTimeoutValue[0] = 0.1; + stateSequence[0] = "Activate"; + + stateName[1] = "ActivateReady"; + stateTransitionOnLoaded[1] = "Ready"; + stateTransitionOnNoAmmo[1] = "NoAmmo"; + + stateName[2] = "Ready"; + stateTransitionOnNoAmmo[2] = "NoAmmo"; + stateTransitionOnTriggerDown[2] = "CheckWet"; + + stateName[3] = "Fire"; + stateTransitionOnTimeout[3] = "Reload"; + stateTimeoutValue[3] = 0.2; //reload timeout here + stateFire[3] = true; + stateAllowImageChange[3] = false; + stateSequence[3] = "Fire"; + stateScript[3] = "onFire"; + stateSound[3] = "MergeToolFireSound"; + + stateName[4] = "Reload"; + stateTransitionOnTimeout[4] = "Ready"; + stateTimeoutValue[4] = 0.1; + stateAllowImageChange[4] = false; + + stateName[5] = "CheckWet"; + stateTransitionOnWet[5] = "Fire"; + stateTransitionOnNotWet[5] = "Fire"; + + stateName[6] = "NoAmmo"; + stateTransitionOnAmmo[6] = "Reload"; + stateTransitionOnTriggerDown[6] = "DryFire"; + stateSequence[6] = "NoAmmo"; + + stateName[7] = "DryFire"; + stateSound[7] = SniperRifleDryFireSound; + stateTimeoutValue[7] = 0.1; + stateTransitionOnTimeout[7] = "Ready"; +}; + +function MergeToolImage::onFire(%data,%obj,%slot) +{ + serverPlay3D(SniperRifleFireSound, %obj.getTransform()); + %client = %obj.client; + + %pos = getWords(%obj.getEyeTransform(), 0, 2); + %vec = %obj.getEyeVector(); + %targetpos = VectorAdd(%pos, VectorScale(%vec, 2000)); + %piece = containerRaycast(%pos, %targetpos, $TypeMasks::StaticShapeObjectType | $TypeMasks::ForceFieldObjectType, %obj); + %cast = %piece; + %piece = getWord(%piece, 0); + + if (!isObject(%piece)) + return; + + if (!Deployables.isMember(%piece)) + { + messageClient(%client, 'MsgClient', "\c2MIST: That piece is part of the map and cannot be manipulated."); + return; + } + + if (!%client.isAdmin) + { + if (%piece.getOwner().guid != %client.guid) + { + messageClient(%client, 'MsgClient', "\c2MIST: That piece isn't yours."); + return; + } + } + + if (%client.MTMode == 0) + { + if (!isObject(%client.mergePiece1)) + { + %client.mergePiece1 = %piece; + + if (!%piece.isForcefield()) + { + %piece.setCloaked(true); + %piece.schedule(290, "setCloaked", false); + } + + %client.mergeschedule = schedule($ElecMod::MergeTool::Timeout * 1000, 0, "MTClearClientSelection", %client); + } + else + { + if (%piece != %client.mergePiece1) + { + if (%client.MTSubMode == 1) + { + MTMerge(%client, %client.mergePiece1, %piece, 1); + %client.MTSubMode = 0; + MTShowStatus(%client); + } + else + { + MTMerge(%client, %client.mergePiece1, %piece, 0); + } + MTClearClientSelection(%client); + } + else + { + messageClient(%client, 'MsgClient', "\c2MT: You cannot merge a piece with itself."); + return; + } + } + } + if (%client.MTMode == 1) + { + if (%client.MTSubMode == 1) + MTZAxisReverse(%client, %piece); + else + MTIsometric(%client, %piece); + } + if (%client.MTMode == 2) + { + if (%client.MTSubMode > 4 || %client.MTSubMode == 1) + { + %client.MTSplitMode = 1; //crosshair split + } + else + { + %client.MTSplitMode = 0; //half split + } + if (%client.MTSubMode == 0) + %axis = "a"; + if (%client.MTSubMode == 1) + %axis = "a"; + if (%client.MTSubMode == 2) + %axis = "x"; + if (%client.MTSubMode == 3) + %axis = "y"; + if (%client.MTSubMode == 4) + %axis = "z"; + if (%client.MTSubMode == 5) + %axis = "x"; + if (%client.MTSubMode == 6) + %axis = "y"; + if (%client.MTSubMode == 7) + %axis = "z"; + + MTSplit(%client, %cast, %axis); + } +} + +function MergeToolImage::onMount(%this,%obj,%slot) +{ + Parent::onMount(%this, %obj, %slot); + %obj.mountImage(MergeToolImage, 0); + MTShowStatus(%obj.client); +} + +function MTShowStatus(%client) +{ + if (%client.MTMode $= "") + %client.MTMode = 0; + if (%client.MTSubMode $= "") + %client.MTSubMode = 0; + + switch (%client.MTMode) + { + case 0: + switch (%client.MTSubMode) + { + case 0: + %status = "Mode: Merge. Fire the tool at two pieces. If possible, they will merge. Tolerance: " @ $ElecMod::MergeTool::Tolerance @ " meters."; + case 1: + %status = "Mode: Merge. Fire the tool at two pieces. If possible, they will merge. Tolerance: " @ $ElecMod::MergeTool::HighTolerance @ " meters."; + } + case 1: + switch (%client.MTSubMode) + { + case 0: + %status = "Mode: Isometric. Fire at a piece. It will be rotated isometrically."; + case 1: + %status = "Mode: Isometric Z-axis Reversal. Fire at a piece. It's Z Axis will be reversed."; + } + case 2: + switch (%client.MTSubMode) + { + case 0: + %status = "Mode: Split. Fire at a piece to split it in half. Axis: Automatic."; + case 1: + %status = "Mode: Split. Fire at a piece to split it on crosshair. Axis: Automatic."; + case 2: + %status = "Mode: Split. Fire at a piece to split it in half. Axis: X."; + case 3: + %status = "Mode: Split. Fire at a piece to split it in half. Axis: Y."; + case 4: + %status = "Mode: Split. Fire at a piece to split it in half. Axis: Z."; + case 5: + %status = "Mode: Split. Fire at a piece to split it on crosshair. Axis: X."; + case 6: + %status = "Mode: Split. Fire at a piece to split it on crosshair. Axis: Y."; + case 7: + %status = "Mode: Split. Fire at a piece to split it on crosshair. Axis: Z."; + } + } + CommandToClient(%client, 'BottomPrint', ">>>M/I/S Tool<<<\n" @ %status @ "\nCoded by Electricutioner.", 3, 3 ); +} + +//Split code begins here. +//The goal of this is to be a semi-inverse of the merge... +//The tool will be set to split mode, and aimed at an object. The object axies are checked, and if there is one that is +//disproportionally larger then the rest, it will be split on that axis. If two or more axies are similar, it does +//a check to determine the face where the raycast hits (reducing split possibilities by one axis) and either +//spliting on the remaining axis or using position points to find out in which quadrant of the face, the raycast hit. +//Once the axis is determined, the split axis has the difference halved, a "dominant" piece rescaled and repositioned +//in steps similar to the merge, and a new (nearly-identical) piece is created in the resulting void. + +//startup function, the calling client, and the raycasted piece. Note: %piece contains all raycast operations. +function MTSplit(%client, %piece, %axis) +{ + if(!MTSplitValidate(%client, %piece, %axis)) //validates the client selected piece as valid + return; + + if (!%piece.isForcefield()) + getWord(%piece, 0).setCloaked(true); + + MTSplitScaleShift(%client, %piece, %axis); //split it up +} + +//makes sure that the object can be split +function MTSplitValidate(%client, %piece, %axis) +{ + if (!isObject(getWord(%piece, 0))) + { + messageClient(%client, 'MsgClient', "\c2ST: The piece to split is missing. You should not see this error."); + return; + } + + //restricting to cubics and forcefields. + if (!isCubic(%piece) && !%piece.isForceField()) + { + messageClient(%client, 'MsgClient', "\c2ST: That object is not cubic and it cannot be split."); + return; + } + + %size = %piece.getRealSize(); + %volume = 2 * getWord(%size, 0) * 2 * getWord(%size, 1) * 2 * getWord(%size, 2); + if (%client.MTSplitMode == 0) //half split + { + if ((%volume / 2) < ($ElecMod::MergeTool::MinimumPieceVolume)) + { + messageClient(%client, 'MsgClient', "\c2ST: That piece is too small to split."); + return; + } + } + else + { + %hitPos = getWord(%piece, 1) SPC getWord(%piece, 2) SPC getWord(%piece, 3); + %edge = PointToEdge(getWord(%piece, 0), %hitPos); + + //auto-axis determiner + if (%axis $= "a") + %axis = CalculateSplitAxis(PointToEdge(%piece, %hitPos)); + + switch$ (%axis) + { + case "x": + %ratio = getWord(%edge, 0); + %ratio = (%ratio + 1) / 2; + case "y": + %ratio = getWord(%edge, 1); + %ratio = (%ratio + 1) / 2; + case "z": + %ratio = getWord(%edge, 2); + %ratio = (%ratio + 1) / 2; + } + + %masterSize = %volume * %ratio; + %slaveSize = %volume * (1 - %ratio); + + //echo(%ratio SPC %axis SPC %masterSize SPC %slaveSize); + + if (%masterSize < $ElecMod::MergeTool::MinimumPieceVolume || %slaveSize < $ElecMod::MergeTool::MinimumPieceVolume) + { + messageClient(%client, 'MsgClient', "\c2ST: A resultant piece from that split is too small. Aborting."); + return; + } + } + + return 1; //we survived, thus we continue +} + +//does the actual splitting +function MTSplitScaleShift(%client, %cast, %axis) +{ + %piece = getWord(%cast, 0); + %copy = MTCarbonCopy(%piece); //Merge Tool Support functions + + if (!%piece.isForcefield()) + { + %piece.setCloaked(true); + %copy.setCloaked(true); + } + + %hitPos = getWord(%cast, 1) SPC getWord(%cast, 2) SPC getWord(%cast, 3); + + %size = %piece.getRealSize(); + + //auto axis determiner + if (%axis $= "a") + { + %axis = CalculateSplitAxis(PointToEdge(%piece, %hitPos)); + //echo(%hitPos); + } + + if (%client.MTSplitMode == 0) //split in half + { + %center = %piece.getWorldBoxCenter(); + %sizeFactorMaster = 2; + %sizeFactorSlave = 2; + + switch$ (%axis) + { + case "x": + %piece.setRealSize((getWord(%size, 0) / %sizeFactorMaster) SPC getWords(%size, 1, 2)); + %copy.setRealSize((getWord(%size, 0) / %sizeFactorSlave) SPC getWords(%size, 1, 2)); + %piece.setEdge(%center, "1 0 0"); + %copy.setEdge(%center, "-1 0 0"); + case "y": + %piece.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) / %sizeFactorMaster SPC getWord(%size, 2)); + %copy.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) / %sizeFactorSlave SPC getWord(%size, 2)); + %piece.setEdge(%center, "0 1 0"); + %copy.setEdge(%center, "0 -1 0"); + case "z": + %piece.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) / %sizeFactorMaster); + %copy.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) / %sizeFactorSlave); + %piece.setEdge(%center, "0 0 1"); + %copy.setEdge(%center, "0 0 -1"); + } + } + else + { + %edge = PointToEdge(%piece, %hitPos); //PointToEdge is in the Merge Tool support functions + + switch$ (%axis) + { + case "x": + %ratio = getWord(%edge, 0); + %ratio = (%ratio + 1) / 2; + %center = %piece.getEdge("-1 0 0"); + %piece.setRealSize(getWord(%size, 0) * %ratio SPC getWords(%size, 1, 2)); + %copy.setRealSize(getWord(%size, 0) * (1 - %ratio) SPC getWords(%size, 1, 2)); + %piece.setEdge(%center, "-1 0 0"); + %copy.setEdge(%piece.getEdge("1 0 0"), "-1 0 0"); + case "y": + %ratio = getWord(%edge, 1); + %ratio = (%ratio + 1) / 2; + %center = %piece.getEdge("0 -1 0"); + %piece.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) * %ratio SPC getWord(%size, 2)); + %copy.setRealSize(getWord(%size, 0) SPC getWord(%size, 1) * (1 - %ratio) SPC getWord(%size, 2)); + %piece.setEdge(%center, "0 -1 0"); + %copy.setEdge(%piece.getEdge("0 1 0"), "0 -1 0"); + case "z": + %ratio = getWord(%edge, 2); + %ratio = (%ratio + 1) / 2; + %center = %piece.getEdge("0 0 -1"); + %piece.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) * %ratio); + %copy.setRealSize(getWords(%size, 0, 1) SPC getWord(%size, 2) * (1 - %ratio)); + %piece.setEdge(%center, "0 0 -1"); + %copy.setEdge(%piece.getEdge("0 0 1"), "0 0 -1"); + } + } + + if (isObject(%piece.pzone)) + { + %piece.pzone.setScale(%piece.getScale()); + %piece.pzone.setPosition(%piece.getPosition()); + } + if (isObject(%copy.pzone)) + { + %copy.pzone.setScale(%copy.getScale()); + %copy.pzone.setPosition(%copy.getPosition()); + } + + if (!%piece.isForcefield()) + { + %piece.schedule(290, "setCloaked", false); + %copy.schedule(290, "setCloaked", false); + } +} + +function CalculateSplitAxis(%edge) +{ + //echo("Calculating split axis from edge: " @ %edge); + %edge = mAbs(getWord(%edge, 0)) SPC mAbs(getWord(%edge, 1)) SPC mAbs(getWord(%edge, 2)); + if (getWord(%edge, 0) < getWord(%edge, 1) && getWord(%edge, 0) < getWord(%edge, 2)) + return "x"; + if (getWord(%edge, 1) < getWord(%edge, 0) && getWord(%edge, 1) < getWord(%edge, 2)) + return "y"; + if (getWord(%edge, 2) < getWord(%edge, 0) && getWord(%edge, 2) < getWord(%edge, 1)) + return "z"; +} + +exec("scripts/do_not_delete/MergeToolSupport.cs"); diff --git a/Construction/scripts/Krypton/PermissionSphere.cs b/Construction/scripts/Krypton/PermissionSphere.cs new file mode 100644 index 0000000..4eb9f61 --- /dev/null +++ b/Construction/scripts/Krypton/PermissionSphere.cs @@ -0,0 +1,815 @@ +//-------------------------------------------------------------------------- +// Deployable Permission Sphere +//-------------------------------------- + +datablock ItemData(PermSphereDeployable) { + className = Pack; + catagory = "Deployables"; + shapeFile = "deploy_sensor_pulse.dts"; + scale = 2.5 / 3.85 @ " " @ 2.5 / 3.1 @ " " @ 5 / 3.1; + mass = 1; + + hasLight = true; + lightType = "PulsingLight"; + lightColor = "0.1 0.1 0.8 1.0"; + lightTime = "500"; + lightRadius = "3"; + + elasticity = 0.2; + friction = 0.6; + pickupRadius = 1; + rotate = false; + image = "PermSphereDeployableImage"; + pickUpName = "a Permissions Sphere pack"; + emap = true; +}; + + +datablock StaticShapeData(DeployedOOSphere) : StaticShapeDamageProfile { //Deployed owner-only sphere + className = "oosphere"; + shapeFile = "deploy_sensor_pulse.dts"; + + maxDamage = 1.0; + destroyedLevel = 1.0; + disabledLevel = 1.0; + + isShielded = true; + energyPerDamagePoint = 30; + maxEnergy = 50; + rechargeRate = 0.05; + + explosion = SatchelMainExplosion; + underwaterExplosion = UnderwaterSatchelMainExplosion; + + expDmgRadius = 20.0; + expDamage = 1.25; + expImpulse = 1500.0; + + dynamicType = $TypeMasks::StationObjectType; + renderWhenDestroyed = true; + + hasLight = true; + lightType = "PulsingLight"; + lightColor = "0.1 0.1 0.8 1.0"; + lightTime = "100"; + lightRadius = "3"; + +// humSound = GeneratorHumSound; + + dynamicType = $TypeMasks::StaticShapeObjectType; + deployedObject = true; + cmdCategory = "DSupport"; + cmdIcon = CMDSwitchIcon; + cmdMiniIconName = "commander/MiniIcons/com_switch_grey"; + targetNameTag = 'Deployed'; + targetTypeTag = 'Permission Sphere'; + deployAmbientThread = true; + debrisShapeName = "debris_generic_small.dts"; + debris = DeployableDebris; + heatSignature = 0; +}; + +datablock StaticShapeData(DeployedPeaceSphere) : StaticShapeDamageProfile { //Deployed Peace sphere + className = "oosphere"; + shapeFile = "deploy_sensor_pulse.dts"; + + maxDamage = 1.0; + destroyedLevel = 1.0; + disabledLevel = 1.0; + + isShielded = true; + energyPerDamagePoint = 30; + maxEnergy = 50; + rechargeRate = 0.05; + + explosion = SatchelMainExplosion; + underwaterExplosion = UnderwaterSatchelMainExplosion; + + expDmgRadius = 20.0; + expDamage = 1.25; + expImpulse = 1500.0; + + dynamicType = $TypeMasks::StationObjectType; + renderWhenDestroyed = true; + + hasLight = true; + lightType = "PulsingLight"; + lightColor = "0.1 0.1 0.8 1.0"; + lightTime = "100"; + lightRadius = "3"; + +// humSound = GeneratorHumSound; + + dynamicType = $TypeMasks::StaticShapeObjectType; + deployedObject = true; + cmdCategory = "DSupport"; + cmdIcon = CMDSwitchIcon; + cmdMiniIconName = "commander/MiniIcons/com_switch_grey"; + targetNameTag = 'Deployed'; + targetTypeTag = 'Permission Sphere'; + deployAmbientThread = true; + debrisShapeName = "debris_generic_small.dts"; + debris = DeployableDebris; + heatSignature = 0; +}; + +datablock StaticShapeData(DeployedCombatSphere) : StaticShapeDamageProfile { //Deployed Combat sphere + className = "oosphere"; + shapeFile = "deploy_sensor_pulse.dts"; + + maxDamage = 1.0; + destroyedLevel = 1.0; + disabledLevel = 1.0; + + isShielded = true; + energyPerDamagePoint = 30; + maxEnergy = 50; + rechargeRate = 0.05; + + explosion = SatchelMainExplosion; + underwaterExplosion = UnderwaterSatchelMainExplosion; + + expDmgRadius = 20.0; + expDamage = 1.25; + expImpulse = 1500.0; + + dynamicType = $TypeMasks::StationObjectType; + renderWhenDestroyed = true; + + hasLight = true; + lightType = "PulsingLight"; + lightColor = "0.1 0.1 0.8 1.0"; + lightTime = "100"; + lightRadius = "3"; + +// humSound = GeneratorHumSound; + + dynamicType = $TypeMasks::StaticShapeObjectType; + deployedObject = true; + cmdCategory = "DSupport"; + cmdIcon = CMDSwitchIcon; + cmdMiniIconName = "commander/MiniIcons/com_switch_grey"; + targetNameTag = 'Deployed'; + targetTypeTag = 'Permission Sphere'; + deployAmbientThread = true; + debrisShapeName = "debris_generic_small.dts"; + debris = DeployableDebris; + heatSignature = 0; +}; + +datablock StaticShapeData(DeployedSpawnSphere) : StaticShapeDamageProfile { //Deployed Spawn sphere + className = "oosphere"; + shapeFile = "turret_Muzzlepoint.dts"; + + maxDamage = 1.0; + destroyedLevel = 1.0; + disabledLevel = 1.0; + + isShielded = true; + energyPerDamagePoint = 30; + maxEnergy = 50; + rechargeRate = 0.05; + + explosion = SatchelMainExplosion; + underwaterExplosion = UnderwaterSatchelMainExplosion; + + expDmgRadius = 20.0; + expDamage = 1.25; + expImpulse = 1500.0; + + dynamicType = $TypeMasks::StationObjectType; + renderWhenDestroyed = true; + + hasLight = true; + lightType = "PulsingLight"; + lightColor = "0.1 0.1 0.8 1.0"; + lightTime = "100"; + lightRadius = "3"; + +// humSound = GeneratorHumSound; + + dynamicType = $TypeMasks::StaticShapeObjectType; + deployedObject = true; + cmdCategory = "DSupport"; + cmdIcon = CMDSwitchIcon; + cmdMiniIconName = "commander/MiniIcons/com_switch_grey"; + targetNameTag = 'Deployed'; + targetTypeTag = 'Spawn Sphere'; + deployAmbientThread = true; + debrisShapeName = "debris_generic_small.dts"; + debris = DeployableDebris; + heatSignature = 0; +}; + +datablock ShapeBaseImageData(PermSphereDeployableImage) { + mass = 1; + shapeFile = "deploy_sensor_pulse.dts"; + scale = 2.5 / 3.85 @ " " @ 2.5 / 3.1 @ " " @ 5 / 3.1; + item = PermSphereDeployable; + mountPoint = 1; + offset = "0 0 0"; + deployed = PermSphereDeployed; + stateName[0] = "Idle"; + stateTransitionOnTriggerDown[0] = "Activate"; + + hasLight = true; + lightType = "PulsingLight"; + lightColor = "0.1 0.1 0.8 1.0"; + lightTime = "100"; + lightRadius = "3"; + + stateName[1] = "Activate"; + stateScript[1] = "onActivate"; + stateTransitionOnTriggerUp[1] = "Idle"; + + isLarge = true; + emap = true; + maxDepSlope = 360; + deploySound = TurretDeploySound; + minDeployDis = 0.5; + maxDeployDis = 5.0; +}; + +function PermSphereDeployableImage::onMount(%data, %obj, %node) { + %obj.hasPermSphere = true; // set for PermSpherecheck + %obj.packSet = 0; + %obj.expertSet = 0; +} + +function PermSphereDeployableImage::onUnmount(%data, %obj, %node) { + %obj.hasPermSphere = ""; + %obj.packSet = 0; + %obj.expertSet = 0; +} + +function PermSphereDeployableImage::onDeploy(%item, %plyr, %slot) { + //Object + %className = "StaticShape"; + + %playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0"); + + if (%item.surfaceinher == 0) { + if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1") + %item.surfaceNrm2 = %playerVector; + else + %item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 1")); + } + + %rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2); + %scale = "2 2 2"; + + +if (%plyr.packSet == 0) { //Owner-Only Construct Zone Sphere! + %deplObj = new (%className)() { + dataBlock = "DeployedOOSphere"; + scale = %scale; + }; +} + +if (%plyr.packSet == 1) { //Peace Zone Sphere! + %deplObj = new (%className)() { + dataBlock = "DeployedPeaceSphere"; + scale = %scale; + }; +} + +if (%plyr.packSet == 2) { //Combat Zone Sphere! + %deplObj = new (%className)() { + dataBlock = "DeployedCombatSphere"; + scale = %scale; + }; +} + +//Set the range on this baby + if (%plyr.expertSet == 0) + %deplObj.range = 50; //50 meter range + if (%plyr.expertSet == 1) + %deplObj.range = 100; //100 meter range + if (%plyr.expertSet == 2) + %deplObj.range = 300; //300 meter range + + + // set orientation + %deplObj.setTransform(%item.surfacePt SPC %rot); + + + %deplObj.team = %plyr.client.team; + %deplObj.setOwner(%plyr); + addDSurface(%item.surface,%deplObj); + + if (%deplObj.getTarget() != -1) + setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team); + + addToDeployGroup(%deplObj); + + AIDeployObject(%plyr.client, %deplObj); + + serverPlay3D(%item.deploySound, %deplObj.getTransform()); + if ($SphereCount[%plyr.client.guid] < 0) //If it's somehow in the negatives... + $SphereCount[%plyr.client.guid] = 0; //Set it to zero. + $SphereCount[%plyr.client.guid]++; + %deplObj.deploy(); + + %deplObj.playThread($AmbientThread, "ambient"); + + +//echo("Expert Setting: " @ %plyr.expertSet); +//echo("Pack Setting: " @ %plyr.packSet); + + +if (%plyr.packSet == 0) { //Owner-Only Construct Zone Sphere! + if (%plyr.expertSet == 0) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "OOSphereEmitter50"); + if (%plyr.expertSet == 1) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "OOSphereEmitter100"); + if (%plyr.expertSet == 2) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "OOSphereEmitter300"); + schedule(5000,0,OwnerSphereCheck,%deplObj); //Begin the loop! +} + +if (%plyr.packSet == 1) { //Peace Zone Sphere! + if (%plyr.expertSet == 0) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "PeaceSphereEmitter50"); + if (%plyr.expertSet == 1) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "PeaceSphereEmitter100"); + if (%plyr.expertSet == 2) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "PeaceSphereEmitter300"); + schedule(5000,0,PeaceSphereCheck,%deplObj); //Begin the loop! +} + +if (%plyr.packSet == 2) { //Combat Zone Sphere! + if (%plyr.expertSet == 0) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "CombatSphereEmitter50"); + if (%plyr.expertSet == 1) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "CombatSphereEmitter100"); + if (%plyr.expertSet == 2) + %deplObj.emitter = createEmitter(%deplObj.getPosition(), "CombatSphereEmitter300"); + schedule(5000,0,CombatSphereCheck,%deplObj); //Begin the loop! +} + + %plyr.unmountImage(%slot); + %plyr.decInventory(%item.item, 1); + + return %deplObj; +} + +function DeployedOOSphere::onDestroyed(%this, %obj, %prevState) { + if (%obj.isRemoved) + return; + %obj.isRemoved = true; + Parent::onDestroyed(%this, %obj, %prevState); + $SphereCount[%obj.getOwner().guid]--; + remDSurface(%obj); + %obj.emitter.delete(); + %obj.schedule(500, "delete"); + + RadiusExplosion(%obj, %obj.getWorldBoxCenter(), %obj.expDmgRadius, %obj.expDamage, %obj.expImpulse, %obj, $DamageType::Explosion); + fireBallExplode(%obj,10); +} + +function DeployedPeaceSphere::onDestroyed(%this, %obj, %prevState) { + if (%obj.isRemoved) + return; + %obj.isRemoved = true; + Parent::onDestroyed(%this, %obj, %prevState); + $SphereCount[%obj.getOwner().guid]--; + remDSurface(%obj); + %obj.emitter.delete(); + %obj.schedule(500, "delete"); + + RadiusExplosion(%obj, %obj.getWorldBoxCenter(), %obj.expDmgRadius, %obj.expDamage, %obj.expImpulse, %obj, $DamageType::Explosion); + fireBallExplode(%obj,10); +} + +function DeployedCombatSphere::onDestroyed(%this, %obj, %prevState) { + if (%obj.isRemoved) + return; + %obj.isRemoved = true; + Parent::onDestroyed(%this, %obj, %prevState); + $SphereCount[%obj.getOwner().guid]--; + remDSurface(%obj); + %obj.emitter.delete(); + %obj.schedule(500, "delete"); + + RadiusExplosion(%obj, %obj.getWorldBoxCenter(), %obj.expDmgRadius, %obj.expDamage, %obj.expImpulse, %obj, $DamageType::Explosion); + fireBallExplode(%obj,10); +} + +function OwnerSphereCheck(%thesphere) { + +if (!isObject(%thesphere)) //Do we still exist? + return; + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::StaticShapeObjectType | $TypeMasks::ItemObjectType | $TypeMasks::ForceFieldObjectType); + while((%obj = ContainerSearchNext()) != 0) { + // Extra safety + if (%obj.getOwner().guid !$= %thesphere.getOwner().guid) { + %dataBlockName = %obj.getDataBlock().getName(); + if (saveBuildingCheck(%obj)) { // If it's handled by saveBuilding(), it must be a deployable +// %random = getRandom() * $Prison::RemoveSpamTimer-2000; // prevent duplicate disassemblies -- DISASSEMBLE IT NOW! + %obj.getDataBlock().schedule(10,"disassemble",0,%obj); // Run Item Specific code. + } + } + } + schedule(5000,0,OwnerSphereCheck,%thesphere); +} + +function PeaceSphereCheck(%thesphere) { + +if (!isObject(%thesphere)) //Do we still exist? + return; + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::ProjectileObjectType); + while((%obj = ContainerSearchNext()) != 0) { + %dataBlockName = %obj.getDataBlock().getName(); + if (%dataBlockName !$= "DeathBeam" && %dataBlockName !$= "BasicTargeter" && %dataBlockName !$= "ConstructionTargeter" && %dataBlockName !$= "ConstructionToolBeam" && %dataBlockName !$= "AimingLaser0" && %dataBlockName !$= "AimingLaser1" && %dataBlockName !$= "AimingLaser2" && %dataBlockName !$= "AimingLaser3" && %dataBlockName !$= "AimingLaser4" && %dataBlockName !$= "AimingLaser5") { + //Delete projectiles... + %obj.delete(); + } + + } + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::VehicleObjectType); //Look for MPBs +while((%obj = ContainerSearchNext()) != 0) { + %dataBlockName = %obj.getDataBlock().getName(); + if (%dataBlockName !$= "EscapePodVehicle" && %dataBlockName !$= "AdminATV") { + //Apple ungodly amounts of damage + %obj.getDataBlock().damageObject( %obj, 0,pos( %obj),999999,$DamageType::Explosion); +// %obj.delete(); + } + + } + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::ItemObjectType); //Look for nades +while((%obj = ContainerSearchNext()) != 0) { + %dataBlockName = %obj.getDataBlock().getName(); + if (%dataBlockName $= "GrenadeThrown" || %dataBlockName $= "FlashGrenadeThrown" || %dataBlockName $= "ConcussionGrenadeThrown") { + %obj.delete(); +// %obj.delete(); + } + + } + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::PlayerObjectType); +while((%obj = ContainerSearchNext()) != 0) { + if (%obj.inpeacesphere != %thesphere) { + %obj.inpeacesphere = %thesphere; + messageClient(%obj.client,0,"~wgui/launchMenuOver.wav"); + commandToClient( %obj.client, 'bottomPrint', "[ Sphere Alert ]\nYou have entered a peace sphere.", 4, 2 ); +//No zombies allowed... + %objarmortype = %obj.getdatablock().getname(); + if(%objarmortype $= "ZombieArmor" || %objarmortype $= "FZombieArmor" || %objarmortype $= "LordZombieArmor" || %objarmortype $= "DemonZombieArmor" || %objarmortype $= "RapierZombieArmor") + %obj.getDataBlock().damageObject( %obj, 0,pos( %obj),999999,$DamageType::Explosion); + + } +// if (isEventPending(%obj.spherecancel)) + cancel(%obj.spherecancel); + %obj.spherecancel = schedule(256,0,"eval",%obj @ ".inpeacesphere=\"\";"); + } + schedule(128,0,PeaceSphereCheck,%thesphere); +} + + +function CombatSphereCheck(%thesphere) { + +if (!isObject(%thesphere)) //Do we still exist? + return; + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::PlayerObjectType); +while((%obj = ContainerSearchNext()) != 0) { + if (%obj.incombatsphere != %thesphere) { + %obj.incombatsphere = %thesphere; + messageClient(%obj.client,0,"~wgui/launchMenuOver.wav"); + commandToClient( %obj.client, 'bottomPrint', "[ Sphere Alert ]\nYou have entered a combat sphere.\nMurder is now tolerated.", 4, 3 ); + } +// if (isEventPending(%obj.spherecancel)) + cancel(%obj.combatspherecancel); + %obj.combatspherecancel = schedule(256,0,"eval",%obj @ ".incombatsphere=\"\";"); + } + schedule(128,0,CombatSphereCheck,%thesphere); +} + + +function SpawnSphereCheck(%thesphere) { + +if (!isObject(%thesphere)) //Do we still exist? + return; + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::ProjectileObjectType); + while((%obj = ContainerSearchNext()) != 0) { + %dataBlockName = %obj.getDataBlock().getName(); + if (%dataBlockName !$= "DeathBeam" && %dataBlockName !$= "BasicTargeter" && %dataBlockName !$= "ConstructionTargeter" && %dataBlockName !$= "ConstructionToolBeam" && %dataBlockName !$= "AimingLaser0" && %dataBlockName !$= "AimingLaser1" && %dataBlockName !$= "AimingLaser2" && %dataBlockName !$= "AimingLaser3" && %dataBlockName !$= "AimingLaser4" && %dataBlockName !$= "AimingLaser5") { + //Delete projectiles... + %obj.delete(); + } + + } + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::PlayerObjectType); +while((%obj = ContainerSearchNext()) != 0) { + if (%obj.inpeacesphere != %thesphere) { + %obj.inpeacesphere = %thesphere; + messageClient(%obj.client,0,"~wgui/launchMenuOver.wav"); + commandToClient( %obj.client, 'bottomPrint', "[ Sphere Alert ]\nYou have entered a spawn sphere.", 4, 2 ); +//No zombies allowed... + %objarmortype = %obj.getdatablock().getname(); + if(%objarmortype $= "ZombieArmor" || %objarmortype $= "FZombieArmor" || %objarmortype $= "LordZombieArmor" || %objarmortype $= "DemonZombieArmor" || %objarmortype $= "RapierZombieArmor") + %obj.getDataBlock().damageObject( %obj, 0,pos( %obj),999999,$DamageType::Explosion); + + } +// if (isEventPending(%obj.spherecancel)) + cancel(%obj.spherecancel); + %obj.spherecancel = schedule(256,0,"eval",%obj @ ".inpeacesphere=\"\";"); + } + +InitContainerRadiusSearch(%thesphere.getPosition(),%thesphere.range,$TypeMasks::StaticShapeObjectType | $TypeMasks::ItemObjectType | $TypeMasks::ForceFieldObjectType); + while((%obj = ContainerSearchNext()) != 0) { + // Extra safety + if (%obj.getOwner().guid !$= %thesphere.getOwner().guid) { + %dataBlockName = %obj.getDataBlock().getName(); + if (saveBuildingCheck(%obj)) { // If it's handled by saveBuilding(), it must be a deployable +// %random = getRandom() * $Prison::RemoveSpamTimer-2000; // prevent duplicate disassemblies -- DISASSEMBLE IT NOW! + %obj.getDataBlock().schedule(10,"disassemble",0,%obj); // Run Item Specific code. + } + } + } + + schedule(128,0,SpawnSphereCheck,%thesphere); + +} + +datablock ParticleData(OOSphereSmoke) +{ + dragCoefficient = 0.0; + windCoefficient = 0; + gravityCoefficient = 0; + inheritedVelFactor = 0.0; + constantAcceleration = 0; + lifetimeMS = 5000; + lifetimeVarianceMS = 0; + useInvAlpha = false; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + textureName = "special/lightFalloffMono"; + colors[0] = "0.01 0.01 0.01 1.0"; + colors[1] = "0 1 1 1.0"; + colors[2] = "0.01 0.01 0.01 0.0"; + sizes[0] = 0.1; + sizes[1] = 3.0; + sizes[2] = 0.1; + times[0] = 0.0; + times[1] = 0.7; + times[2] = 1.0; +}; + +datablock ParticleData(PeaceSphereSmoke) +{ + dragCoefficient = 0.0; + windCoefficient = 0; + gravityCoefficient = 0; + inheritedVelFactor = 0.0; + constantAcceleration = 0; + lifetimeMS = 5000; + lifetimeVarianceMS = 0; + useInvAlpha = false; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + textureName = "special/lightFalloffMono"; + colors[0] = "0.01 0.01 0.01 1.0"; + colors[1] = "0 1 0 1.0"; + colors[2] = "0.01 0.01 0.01 0.0"; + sizes[0] = 0.1; + sizes[1] = 3.0; + sizes[2] = 0.1; + times[0] = 0.0; + times[1] = 0.7; + times[2] = 1.0; +}; + +datablock ParticleData(CombatSphereSmoke) +{ + dragCoefficient = 0.0; + windCoefficient = 0; + gravityCoefficient = 0; + inheritedVelFactor = 0.0; + constantAcceleration = 0; + lifetimeMS = 5000; + lifetimeVarianceMS = 0; + useInvAlpha = false; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + textureName = "special/lightFalloffMono"; + colors[0] = "0.01 0.01 0.01 1.0"; + colors[1] = "1 0 0 1.0"; + colors[2] = "0.01 0.01 0.01 0.0"; + sizes[0] = 0.1; + sizes[1] = 3.0; + sizes[2] = 0.1; + times[0] = 0.0; + times[1] = 0.7; + times[2] = 1.0; +}; + +datablock ParticleData(SpawnSphereSmoke) +{ + dragCoefficient = 0.0; + windCoefficient = 0; + gravityCoefficient = 0; + inheritedVelFactor = 0.0; + constantAcceleration = 0; + lifetimeMS = 5000; + lifetimeVarianceMS = 0; + useInvAlpha = false; + spinRandomMin = -200.0; + spinRandomMax = 200.0; + textureName = "special/lightFalloffMono"; + colors[0] = "0.01 0.01 0.01 1.0"; + colors[1] = "1 1 0 1.0"; + colors[2] = "0.01 0.01 0.01 0.0"; + sizes[0] = 0.1; + sizes[1] = 3.0; + sizes[2] = 0.1; + times[0] = 0.0; + times[1] = 0.7; + times[2] = 1.0; +}; + + +datablock ParticleEmitterData(SpawnSphereEmitter70) //owner-only 50 radius. +{ + ejectionPeriodMS = 8; + ejectionOffset = 70; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "SpawnSphereSmoke"; +}; + +//-------------------------- +//Owner-Only sphere emitters. +//-------------------------- +datablock ParticleEmitterData(OOSphereEmitter50) //owner-only 50 radius. +{ + ejectionPeriodMS = 5; + ejectionOffset = 50; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "OOSphereSmoke"; +}; + +datablock ParticleEmitterData(OOSphereEmitter100) //owner-only 100 radius. +{ + ejectionPeriodMS = 3; + ejectionOffset = 100; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "OOSphereSmoke"; +}; + +datablock ParticleEmitterData(OOSphereEmitter300) //owner-only 300 radius. +{ + ejectionPeriodMS = 1; + ejectionOffset = 300; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "OOSphereSmoke"; +}; + +//-------------------------- +//Peace sphere emitters. +//-------------------------- +datablock ParticleEmitterData(PeaceSphereEmitter50) //Peace 50 radius. +{ + ejectionPeriodMS = 5; + ejectionOffset = 50; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "PeaceSphereSmoke"; +}; + +datablock ParticleEmitterData(PeaceSphereEmitter100) //Peace 100 radius. +{ + ejectionPeriodMS = 3; + ejectionOffset = 100; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "PeaceSphereSmoke"; +}; + +datablock ParticleEmitterData(PeaceSphereEmitter300) //Peace 300 radius. +{ + ejectionPeriodMS = 1; + ejectionOffset = 300; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "PeaceSphereSmoke"; +}; + +//-------------------------- +//Combat sphere emitters. +//-------------------------- +datablock ParticleEmitterData(CombatSphereEmitter50) //Combat 50 radius. +{ + ejectionPeriodMS = 5; + ejectionOffset = 50; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "CombatSphereSmoke"; +}; + +datablock ParticleEmitterData(CombatSphereEmitter100) //Combat 100 radius. +{ + ejectionPeriodMS = 3; + ejectionOffset = 100; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "CombatSphereSmoke"; +}; + +datablock ParticleEmitterData(CombatSphereEmitter300) //Combat 300 radius. +{ + ejectionPeriodMS = 1; + ejectionOffset = 300; + periodVarianceMS = 0; + ejectionVelocity = 0.0; + velocityVariance = 0.0; +// ejectionOffset = 0.0; + thetaMin = 5; + thetaMax = 175; + phiReferenceVel = 0; + phiVariance = 360; + overrideAdvances = false; +// lifetimeMS = 30000; To infitinity! and beyond! + particles = "CombatSphereSmoke"; +}; \ No newline at end of file diff --git a/Construction/scripts/Krypton/Quantium/decoypack.cs b/Construction/scripts/Krypton/Quantium/decoypack.cs new file mode 100644 index 0000000..2fd5723 --- /dev/null +++ b/Construction/scripts/Krypton/Quantium/decoypack.cs @@ -0,0 +1,583 @@ +//--------------------------------------------------------- +// Deployable Decoy +//--------------------------------------------------------- + +$expertSettings[DecoyDeployableImage] = "5 -1 Decoy Pack:[Options]"; +$expertSetting[DecoyDeployableImage,0] = "Select Armor"; +$expertSetting[DecoyDeployableImage,1] = "Select Skin"; +$expertSetting[DecoyDeployableImage,2] = "Select Pack mounted"; +$expertSetting[DecoyDeployableImage,3] = "Select Weapon mounted"; +$expertSetting[DecoyDeployableImage,4] = "Select Power options"; +$expertSetting[DecoyDeployableImage,5] = "Select Emote"; + +$packSettings[DecoyDeployableImage] = "8 -1 Decoy Pack:[Armor]"; +$packSetting[DecoyDeployableImage,0] = "LightMaleHumanArmor | Light Male Armor"; +$packSetting[DecoyDeployableImage,1] = "MediumMaleHumanArmor | Medium Male Armor"; +$packSetting[DecoyDeployableImage,2] = "HeavyMaleHumanArmor | Large Male Armor"; +$packSetting[DecoyDeployableImage,3] = "LightFemaleHumanArmor | Light Female Armor"; +$packSetting[DecoyDeployableImage,4] = "MediumFemaleHumanArmor | Medium Female Armor"; +$packSetting[DecoyDeployableImage,5] = "HeavyFemaleHumanArmor | Large Female Armor"; +$packSetting[DecoyDeployableImage,6] = "LightMaleBiodermArmor | Light Bioderm Armor"; +$packSetting[DecoyDeployableImage,7] = "MediumMaleBiodermArmor | Medium Bioderm Armor"; +$packSetting[DecoyDeployableImage,8] = "HeavyMaleBiodermArmor | Large Bioderm Armor"; + +$packSettings[DecoyDeployableImage,1] = "10 -2 Decoy Pack: [Skin]"; +$packSetting[DecoyDeployableImage,0,1] = "BEagle Blood eagle"; +$packSetting[DecoyDeployableImage,1,1] = "COTP Inferno"; +$packSetting[DecoyDeployableImage,2,1] = "DSword Diamond Sword"; +$packSetting[DecoyDeployableImage,3,1] = "Swolf Starwolf"; +$packSetting[DecoyDeployableImage,4,1] = "BaseB Base1"; +$packSetting[DecoyDeployableImage,5,1] = "Base Base2"; +$packSetting[DecoyDeployableImage,6,1] = "basebbot Bot1 (MALE ONLY)"; +$packSetting[DecoyDeployableImage,7,1] = "basebot Bot2 (MALE ONLY)"; +$packSetting[DecoyDeployableImage,8,1] = "TR2-1 Tr2 1 (FEMALE ONLY)"; +$packSetting[DecoyDeployableImage,9,1] = "TR2-2 Tr2 2 (FEMALE ONLY)"; +$packSetting[DecoyDeployableImage,10,1] = "horde Horde (BIODERM ONLY)"; + +$packSettings[DecoyDeployableImage,5] = "15 -1 Decoy Pack: [Emote]"; +$packSetting[DecoyDeployableImage,0,5] = "Standing"; +$packSetting[DecoyDeployableImage,1,5] = "Sniper rifle pose"; +$packSetting[DecoyDeployableImage,2,5] = "Death1"; +$packSetting[DecoyDeployableImage,3,5] = "Death2"; +$packSetting[DecoyDeployableImage,4,5] = "Death3"; +$packSetting[DecoyDeployableImage,5,5] = "Death4"; +$packSetting[DecoyDeployableImage,6,5] = "Looking"; +$packSetting[DecoyDeployableImage,7,5] = "Standjump"; +$packSetting[DecoyDeployableImage,8,5] = "Missile launcher pose"; +$packSetting[DecoyDeployableImage,9,5] = "Peeing pose =)"; +$packSetting[DecoyDeployableImage,10,5] = "Hopping pose"; +$packSetting[DecoyDeployableImage,11,5] = "Crawl"; +$packSetting[DecoyDeployableImage,12,5] = "Sitting"; +$packSetting[DecoyDeployableImage,13,5] = "Headside"; +$packSetting[DecoyDeployableImage,14,5] = "Dancing"; +$packSetting[DecoyDeployableImage,15,5] = "Prox. Wave"; + +$packSettings[DecoyDeployableImage,2] = "7 -2 Decoy Pack: [Pack]"; +$packSetting[DecoyDeployableImage,0,2] = "CloakPack Cloak pack"; +$packSetting[DecoyDeployableImage,1,2] = "RepairPack Repair pack"; +$packSetting[DecoyDeployableImage,2,2] = "CrateDeployable Bigbox"; +$packSetting[DecoyDeployableImage,3,2] = "AmmoPack Ammo pack"; +$packSetting[DecoyDeployableImage,4,2] = "ShieldPack Shield pack"; +$packSetting[DecoyDeployableImage,5,2] = "spineDeployable2 LSB pack"; +$packSetting[DecoyDeployableImage,6,2] = "E Energy pack"; +$packSetting[DecoyDeployableImage,7,2] = "E Empty"; + +$packSettings[DecoyDeployableImage,3] = "8 -2 Decoy Pack: [Weapon]"; +$packSetting[DecoyDeployableImage,0,3] = "Plasma Plasma rifle"; +$packSetting[DecoyDeployableImage,1,3] = "Disc Spinfusor"; +$packSetting[DecoyDeployableImage,2,3] = "SniperRifle Sniper rifle"; +$packSetting[DecoyDeployableImage,3,3] = "Mortar Fusion mortar"; +$packSetting[DecoyDeployableImage,4,3] = "Shocklance Shocklance"; +$packSetting[DecoyDeployableImage,5,3] = "ElfGun ELF"; +$packSetting[DecoyDeployableImage,6,3] = "Chaingun Chaingun"; +$packSetting[DecoyDeployableImage,7,3] = "ElfGun Empty"; +$packSetting[DecoyDeployableImage,8,3] = "MS Missile Launcher"; + +$packSettings[DecoyDeployableImage,4] = "1 -1 Decoy Pack: [Power Options]"; +$packSetting[DecoyDeployableImage,0,4] = "Showing when powered"; +$packSetting[DecoyDeployableImage,1,4] = "Always showing"; + + +datablock StaticShapeData(BiodermPlayerProjection) +{ + shapeFile = "bioderm_light.dts"; + skin = ""; + isStatic = true; +collideable = 0; +}; +datablock StaticShapeData(HumanPlayerProjection) +{ + shapeFile = "light_male.dts"; + isStatic = true; + skin = ""; +collideable = 0; +}; +datablock StaticShapeData(HumanFemalePlayerProjection) +{ + shapeFile = "light_female.dts"; + isStatic = true; + skin = ""; +collideable = 0; +}; + + + + + + +datablock StaticShapeData(DeployedDecoy) : StaticShapeDamageProfile { + className = "lightbase"; + shapeFile = "camera.dts"; + + maxDamage = 0.5; + destroyedLevel = 0.5; + disabledLevel = 0.3; + + maxEnergy = 50; + rechargeRate = 0.25; + + explosion = HandGrenadeExplosion; + expDmgRadius = 1.0; + expDamage = 0.05; + expImpulse = 200; + + dynamicType = $TypeMasks::StaticShapeObjectType; + deployedObject = true; + cmdCategory = "DSupport"; + cmdIcon = CMDSensorIcon; + cmdMiniIconName = "commander/MiniIcons/com_deploymotionsensor"; + targetNameTag = 'Deployed Decoy'; + deployAmbientThread = true; + debrisShapeName = "debris_generic_small.dts"; + debris = DeployableDebris; + heatSignature = 0; + needsPower = true; +}; + +datablock ShapeBaseImageData(DecoyDeployableImage) { + mass = 20; + emap = true; + shapeFile = "stackable1s.dts"; + item = DecoyDeployable; + mountPoint = 1; + offset = "0 0 0"; + deployed = DeployedDecoy; + heatSignature = 0; + + stateName[0] = "Idle"; + stateTransitionOnTriggerDown[0] = "Activate"; + + stateName[1] = "Activate"; + stateScript[1] = "onActivate"; + stateTransitionOnTriggerUp[1] = "Idle"; + + isLarge = false; + maxDepSlope = 360; + deploySound = ItemPickupSound; + + minDeployDis = 0.5; + maxDeployDis = 50.0; +}; + +datablock ItemData(DecoyDeployable) { + className = Pack; + catagory = "Deployables"; + shapeFile = "stackable1s.dts"; + mass = 5.0; + elasticity = 0.2; + friction = 0.6; + pickupRadius = 1; + rotate = true; + image = "DecoyDeployableImage"; + pickUpName = "a deployable decoy pack"; + heatSignature = 0; + emap = true; +}; + +function DecoyDeployableImage::testObjectTooClose(%item) { + return ""; +} + +function DecoyDeployableImage::testNoTerrainFound(%item) { + // don't check this for non-Landspike turret deployables +} + +//function DecoyDeployable::onPickup(%this, %obj, %shape, %amount) { +// // created to prevent console errors +//} +function DecoyDeployableImage::onDeploy(%item, %plyr, %slot) { +if(%plyr.decoyCount == 4 && !%plyr.client.isAdmin) { +messageClient(%plyr.client,0,'\c2Too many decoys deployed'); +return; +} +%plyr.decoyCount++; + %className = "StaticShape"; + %pos2 = rayDist(%item.surfacePt SPC %item.surfaceNrm); + %playerVector = vectorNormalize(-1 * getWord(%plyr.getEyeVector(),1) SPC getWord(%plyr.getEyeVector(),0) SPC "0"); + + if (vAbs(floorVec(%item.surfaceNrm,100)) $= "0 0 1") + %item.surfaceNrm2 = %playerVector; + else + %item.surfaceNrm2 = vectorNormalize(vectorCross(%item.surfaceNrm,"0 0 -1")); + + %rot = fullRot(%item.surfaceNrm,%item.surfaceNrm2); + + %deplObj = new (%className)() { + dataBlock = %item.deployed; + }; + + %mode = %plyr.packSet[4]; + if (%mode $= "2") + %deplObj.mode = 1; + else + %deplObj.mode = %mode; + + %deplObj.decoyType = firstWord($packsetting[DecoyDeployableImage,%plyr.packset]); + %deplObj.decoySkin = %plyr.packSet[1]; + %deplObj.decoyPack = %plyr.packSet[2]; + %deplObj.decoyWeapon = %plyr.packSet[3]; + %deplObj.decoyEmote = %plyr.packSet[5]; + %deplObj.decoyName = %plyr.decoyName; + +// this is such a pain in the ass.... + if(%deplObj.decoyPack == 0) + %logo23 = "CloakPack"; + else if(%deplObj.decoyPack == 1) + %logo23 = "RepairPack"; + else if(%deplObj.decoyPack == 2) + %logo23 = "CrateDeployable"; + else if(%deplObj.decoyPack == 3) + %logo23 = "AmmoPack"; + else if(%deplObj.decoyPack == 4) + %logo23 = "ShieldPack"; + else if(%deplObj.decoyPack == 5) + %logo23 = "spineDeployable2"; + else if(%deplObj.decoyPack == 6) + %logo23 = "EnergyPack"; + else if(%deplObj.decoyPack == 7) + %logo23 = ""; + else + %logo23 = "0"; + + %deplObj.decoyPack = %logo23; + + if(%deplObj.decoyWeapon == 0) + %logo2 = "Plasma"; + else if(%deplObj.decoyWeapon == 1) + %logo2 = "Disc"; + else if(%deplObj.decoyWeapon == 2) + %logo2 = "SniperRifle"; + else if(%deplObj.decoyWeapon == 3) + %logo2 = "Mortar"; + else if(%deplObj.decoyWeapon == 4) + %logo2 = "Shocklance"; + else if(%deplObj.decoyWeapon == 5) + %logo2 = "ELFGun"; + else if(%deplObj.decoyWeapon == 6) + %logo2 = "Chaingun"; + else if(%deplObj.decoyWeapon == 7) + %logo2 = ""; + else if(%deplObj.decoyWeapon == 8) + %logo2 = "MissileLauncher"; + else + %logo2 = "0"; + + %deplObj.decoyWeapon = %logo2; + + if(%deplObj.decoySkin == 0) + %logo = "BEagle"; + else if(%deplObj.decoySkin == 1) + %logo = "COTP"; + else if(%deplObj.decoySkin == 2) + %logo = "DSword"; + else if(%deplObj.decoySkin == 3) + %logo = "Swolf"; + else if(%deplObj.decoySkin == 4) + %logo = "BaseB"; + else if(%deplObj.decoySkin == 5) + %logo = "Base"; + else if(%deplObj.decoySkin == 6) + %logo = "basebbot"; + else if(%deplObj.decoySkin == 7) + %logo = "basebot"; + else if(%deplObj.decoySkin == 8) + %logo = "TR2-1"; + else if(%deplObj.decoySkin == 9) + %logo = "TR2-2"; + else if(%deplObj.decoySkin == 10) + %logo = "Horde"; + else + %logo = "0"; + + %deplObj.decoySkin = addTaggedString(%logo); + %logo = ""; + + if(%delObj.decoyEmote < 14) { + if(%deplObj.decoyEmote == 0) + %logoa = "root"; + else if(%deplObj.decoyEmote == 1) + %logoa = "looksn"; + else if(%deplObj.decoyEmote == 2) + %logoa = "Death9"; + else if(%deplObj.decoyEmote == 3) + %logoa = "Death3"; + else if(%deplObj.decoyEmote == 4) + %logoa = "Death8"; + else if(%deplObj.decoyEmote == 5) + %logoa = "Death11"; + else if(%deplObj.decoyEmote == 6) + %logoa = "look"; + else if(%deplObj.decoyEmote == 7) + %logoa = "standjump"; + else if(%deplObj.decoyEmote == 8) + %logoa = "lookms"; + else if(%deplObj.decoyEmote == 9) + %logoa = "looknw"; + else if(%deplObj.decoyEmote == 10) + %logoa = "ski"; + else if(%deplObj.decoyEmote == 11) + %logoa = "scoutroot"; + else if(%deplObj.decoyEmote == 12) + %logoa = "sitting"; + else if(%deplObj.decoyEmote == 13) + %logoa = "headside"; + else { + %logoa = "0"; + if(%deplObj.decoyEmote == 14) + %deplObj.decoyEmote = 14; + else if(%deplObj.decoyEmote == 15) + %deplObj.decoyEmote = 15; + else + %deplObj.decoyEmote = %logoa; + + } + } + + + // set orientation + %deplObj.setTransform(%item.surfacePt SPC %rot); + + // set the recharge rate right away + if (%deplObj.getDatablock().rechargeRate) + %deplObj.setRechargeRate(%deplObj.getDatablock().rechargeRate); + + // set team, owner, and handle + %deplObj.setOwner(%plyr); + %deplObj.team = %plyr.client.Team; + %deplObj.owner = %plyr.client; + %deplObj.powerFreq = %plyr.powerFreq; + %deplObj.decoy = createNewDecoy(%deplObj); + + if(%deplObj.decoyEmote == 14 || %deplObj.decoyEmote == 15) { + if(%deplObj.decoyEmote == 14) { + decoyRepeat(%deplObj,"cel5"); + %deplObj.decoyEmote = 14; + } + if(%deplObj.decoyEmote == 15) { + decoyRepeat(%deplObj,"cel2"); + %deplObj.decoyEmote = 15; + } + } + // set the sensor group if it needs one + if (%deplObj.getTarget() != -1) + setTargetSensorGroup(%deplObj.getTarget(), %plyr.client.team); + + // place the deployable in the MissionCleanup/Deployables group (AI reasons) + addToDeployGroup(%deplObj); + + //let the AI know as well... + AIDeployObject(%plyr.client, %deplObj); + + // play the deploy sound + serverPlay3D(%item.deploySound, %deplObj.getTransform()); + + // increment the team count for this deployed object + $TeamDeployedCount[%plyr.team, %item.item]++; + + addDSurface(%item.surface,%deplObj); + + if(%deplObj.mode == 2) + %deplObj.startFade(1000,0,true); + + + checkPowerObject(%deplObj); + // take the deployable off the player's back and out of inventory +// %plyr.unmountImage(%slot); +// %plyr.decInventory(%item.item, 1); + + return %deplObj; +} + +function DeployedDecoy::onDestroyed(%this,%obj,%prevState) { + if (%obj.isRemoved) + return; + %obj.isRemoved = true; +if (isObject(%obj.decoy)) + %obj.decoy.delete(); +%this.decoyCount--; + Parent::onDestroyed(%this,%obj,%prevState); + $TeamDeployedCount[%obj.team, DecoyDeployable]--; + remDSurface(%obj); + %obj.schedule(500, "delete"); + +} +function DeployedDecoy::disassemble(%data,%plyr,%obj) { +//%obj.decoy.target.delete(); +freeClientTarget(%obj.decoy); +%plyr.decoyCount--; + %obj.decoy.delete(); + disassemble(%data,%plyr,%obj); +} +function createNewDecoy(%obj) { +echo("CREATINGDECOY"); +%mountimage = %obj.decoyType; +%mountweapon = %obj.decoyWeapon; +%mountpack = %obj.decoyPack; +%mountskin = %obj.decoySkin; +%mountname = %obj.decoyName; +%mountemote = %obj.decoyEmote; + + %ABCCount = 11; + %ABC[0] = "Boo Boo the boomer"; + %ABC[1] = "????????"; + %ABC[2] = "Amanda hugnkiss"; + %ABC[3] = "Ivana tinkle"; + %ABC[4] = "Jack Goff"; + %ABC[5] = "Willy Leak"; + %ABC[6] = "Use /decoyname and replace me"; + %ABC[7] = "Santa claws"; + %ABC[8] = "Seemore Butts"; + %ABC[9] = "Nauq Nus"; + %ABC[10] = "Cereal killer"; + %ABC[11] = "Saddam whosayin"; + %name = %ABC[mFloor(getRandom()*%ABCCount)]; + +if(%mountname $= "") + %mountname = %name; +%objdecoy = new Player() + { + dataBlock = %mountimage; + // rotation = %obj.getRotation(); + Position = %obj.getPosition(); + }; +%objdecoy.target = createTarget(%objdecoy, %mountname, %mountskin, "Male1", '', 0, PlayerSensor); + setTargetDataBlock(%objdecoy.target, %objdecoy.getDatablock()); + setTargetSensorData(%objdecoy.target, PlayerSensor); + setTargetSensorGroup(%objdecoy.target, 0); + setTargetSkin(%objdecoy.target, %mountskin); + setTargetName(%objdecoy.target, addtaggedstring(%mountname)); + if(%obj.decoyEmote != 15 || %obj.decoyEmote != 14) + %objdecoy.setActionThread(%mountemote,true); + + %objdecoy.setInventory(%mountweapon,1,1); + %objdecoy.setInventory(%mountweapon.ammo,0,555); + %objdecoy.setInventory(%mountpack,1,1); + %objdecoy.use(%mountweapon); + %objdecoy.isStatic = true; + %obj.decoy = %objdecoy; + %objdecoy.setTransform(VectorAdd(%obj.getPosition(),"0 0 0") SPC rot(%obj)); + %objdecoy.disableMove(true); + + return %objdecoy; +} +function DecoyDeployableImage::onMount(%data, %obj, %node) { + //%obj.hasDecoy = true; // set for lightcheck + %obj.packSet[0] = 0; + %obj.packSet[1] = 0; + %obj.packSet[2] = 0; + %obj.packSet[3] = 0; + %obj.packSet[4] = 0; + %obj.packSet[5] = 0; + %obj.expertSet = 0; + displayPowerFreq(%obj); +} + +function DecoyDeployableImage::onUnmount(%data, %obj, %node) { + //%obj.hasDecoy = ""; + %obj.packSet = 0; + %obj.packSet[0] = 0; + %obj.packSet[1] = 0; + %obj.packSet[2] = 0; + %obj.packSet[3] = 0; + %obj.packSet[4] = 0; + %obj.packSet[5] = 0; + %obj.expertSet = 0; +} +function DeployedDecoy::onGainPowerEnabled(%data,%obj) { + if (shouldChangePowerState(%obj,true)) { + if(%obj.mode == 0) { + if (isObject(%obj.decoy)) + %obj.decoy.delete(); + %obj.decoy = createNewDecoy(%obj); + %obj.startFade(1000,0,true); + if(%obj.decoyEmote == 15) + decoyRepeat(%obj,"cel2"); + if(%obj.decoyEmote == 14) + decoyRepeat(%obj,"cel5"); + %obj.decoy.setTransform(%obj.getPosition() SPC %obj.getRotation()); + } + else + { + } + Parent::onGainPowerEnabled(%data,%obj); + } + } + + +function DeployedDecoy::onLosePowerDisabled(%data,%obj) { + if (shouldChangePowerState(%obj,false)) { + if(%obj.mode == 0) { + %obj.decoy.startFade(1000,0,true); + %obj.startFade(1000,0,false); + cancel(%obj.decoyLoop); + %obj.decoy.setTransform("0 0 -10000 0 0 0 0"); + } + else + { + } + Parent::onLosePowerDisabled(%data,%obj); + } + } +function decoyRepeat(%obj,%cel) { + cancel(%obj.decoyLoop); + + if(!isObject(%obj.decoy)) + return; + + if(%cel $= "cel2") { + %pos=%obj.decoy.getMuzzlePoint(0); + %vec = %obj.decoy.getMuzzleVector(0); + %targetpos = vectoradd(%pos,vectorscale(%vec,5)); + %newobj=containerraycast(%pos,%targetpos,$typemasks::playerobjecttype,%obj.decoy); + %newobj = getWord(%newobj,0); + if(isObject(%newObj)) + if(%newobj != %obj.decoy) + %obj.decoy.setActionThread("cel2",0); + + + %obj.decoyLoop = schedule(1000,0,decoyRepeat,%obj,%cel); + } + else { + %obj.decoy.setActionThread("cel5",0); + %obj.decoyLoop = schedule(3000,0,decoyRepeat,%obj,%cel); + } +} +function DecoyDeployableImage::ChangeMode(%data,%plyr,%val,%level) +{ +if (%level == 0) + { + //Selecting Detonation + if (!%plyr.expertSet) + { + Parent::ChangeMode(%data,%plyr,%val,%level); + %plyr.packset[0] = GetWord($packSetting[DecoyDeployableImage,%plyr.packset],0); + } + //Selecting selection mode/PowerLogic/CloakLogic + if (%plyr.expertSet > 0) + { + %set = %plyr.expertSet; + %image = %data.getName(); + %settings = $packSettings[%image,%set]; + + %plyr.packSet[%set] = %plyr.packSet[%set] + %val; + if (%plyr.packSet[%set] > getWord(%settings,0)) + %plyr.packSet[%set] = 0; + if (%plyr.packSet[%set] < 0) + %plyr.packSet[%set] = getWord(%settings,0); + + %packname = GetWords(%settings,2,getWordCount(%settings)); + %curset = $PackSetting[%image,%plyr.packSet[%set],%set]; + if (getWord(%settings,1) == -1) + %line = GetWords(%curset,0,getWordCount(%curset)); + else if(getWord(%settings,1) == -2) + %line= getWords(%curset,1,getWordCount(%curset)); + else + %line = GetWords(%curset,0,getWord(%settings,1)); + bottomPrint(%plyr.client,%packname SPC "set to"SPC %line,2,1); + } + } +else + { + Parent::ChangeMode(%data,%plyr,%val,%level); + } +} diff --git a/Construction/scripts/Krypton/ScoreMenu.cs b/Construction/scripts/Krypton/ScoreMenu.cs new file mode 100644 index 0000000..de88bd4 --- /dev/null +++ b/Construction/scripts/Krypton/ScoreMenu.cs @@ -0,0 +1,762 @@ +function ConstructionGame::updateScoreHud(%game, %client, %tag){ +if (%client.SCMPage $= "") %client.SCMPage = 1; +if (%client.SCMPage $= "SM") return; +$TagToUseForScoreMenu = %tag; +messageClient( %client, 'ClearHud', "", %tag, 0 ); +messageClient( %client, 'SetScoreHudHeader', "", "" ); +messageClient( %client, 'SetScoreHudHeader', "", "Commands MenuClose" ); +messageClient( %client, 'SetScoreHudSubheader', "", "Main Menu" ); +scoreCmdMainMenu(%game,%client,%tag,%client.SCMPage); +} + +function ConstructionGame::processGameLink(%game, %client, %arg1, %arg2, %arg3, %arg4, %arg5){ +%tag = $TagToUseForScoreMenu; +messageClient( %client, 'ClearHud', "", %tag, 1 ); +switch$ (%arg1) + { + case "GTP": + scoreCmdMainMenu(%game,%client,$TagToUseForScoreMenu,%arg2); + %client.SCMPage = %arg2; + return; + + case "BF": + if (isobject(%client.player)) buyfavorites(%client); + + case "SZONK": + %cid=plnametocid("zonkman"); + %sender = %cid; + if (isobject(%cid)) { + if (!isobject(%sender.player)) { + serverCmdClientMakeObserver( %sender ); + serverCmdClientJoinTeam( %sender, 1 ); + } + } + %cid.player.scriptkill(); + messageall('MsgClient','%1 killed zonkman.',%client.name); + + case "PC": + %client.SCMPage = "SM"; + messageClient( %client, 'SetScoreHudSubheader', "", "Piece Count" ); + %count=clientgroup.getcount(); + %counter=deployables.getcount(); + for (%n=0;%n<%counter;%n++) { + %obj = deployables.getObject(%n); + %piececount[%obj.ownerguid]++; + } + %count=clientgroup.getcount(); + for (%i = 0; %i < %count; %i++){ + %cid = ClientGroup.getObject( %i ); + messageClient( %client, 'SetLineHud', "", $TagToUseForScoreMenu, %index, '\t%1%2', + %cid.namebase,%piececount[%cid.guid] ); + %index++; + } + messageClient( %client, 'SetLineHud', "", %tag, %index, 'Back to main menu'); + %index++; + messageClient( %client, 'ClearHud', "", %tag, %index ); + return; + + case "TP": //PERSONAL TELEPORT + %client.SCMPage = "SM"; + personalteleport(%client,%tag,%arg2); + return; + + case "SP": //Save Pieces -- XENON CONTENT BLAERGHHHGHGHAAGH + %client.SCMPage = "SM"; + savestuffings(%client,%tag,%arg2); + return; + + case "KASS": //Save Pieces + %client.SCMPage = "SM"; + kasshud(%client,%tag,%arg2); + return; + + case "KLIST": //Player List + %client.SCMPage = "SM"; + klisthud(%client,%tag,%arg2); + return; + + case "PREFS": //Player Preferences + %client.SCMPage = "SM"; + kpphud(%client,%tag,%arg2); + return; + + case "AL": //Toggle aiming laser XENON ARGH! + %plyr = %client.player; + if (isObject(%plyr)) + mountLaser(%plyr); + closeScoreHudFSERV(%client); + return; + + case "HV": //Toggle hover mode XENON ARGH! + %plyr = %client.player; + if(%client.player.on) + hoverPackOff(%client.player); + else + hoverPackOn(%client.player); + closeScoreHudFSERV(%client); + return; + + case "RO": //READ ONLY just incase + return; + + case "CH": //ARMOR + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/togglegender -- Toggles the player's gender."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/togglerace -- Toggles the player's race."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/togglearmor -- Toggles the player's armor."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/voicepitch -- Changes the player's voice pitch."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + + case "BL": //DEPLOYABLE + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/setsize -- Scales the object to X, Y, and Z parameters."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/getsize -- Tells you the object's X, Y, and Z scaling parameters."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/objectname -- Sets the name of an object."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "/giveto -- Gives all current pieces to defined player."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + + case "DC": //DOOR + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Under Construction."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + + case "VM": //ELEVATOR + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Elevators currently unavailable."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + + case "RC": //MISC + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Under Construction"); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + + case "AC": //PROJECTILE TURRET + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Projectile Turrets currently unavailable."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + + case "WC": //VEHICLE + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Theorem, get weather -- Theorem will give you the current weather for this zip code."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Theorem, let's talk/chat. -- Initiate a conversation with Theorem."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Theorem, stop talking. -- Stop a conversation with Theorem."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "What time is it?. -- Theorem will give you the current time."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + + case "WG": // WARPGATE + %client.SCMPage = "SM"; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Warpgates Currently Unavailable."); +%index++; +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; + return; + +// case "GC": //GHOST +// %client.SCMPage = "SM"; +// helps(%client,%tag,%arg,"GC"); +// return; +// +// case "ZDS": //ZDS +// %client.SCMPage = "SM"; +// helps(%client,%tag,%arg,"ZDS"); +// return; +// +// case "AC": //Admin +// %client.SCMPage = "SM"; +// helps(%client,%tag,%arg,"AC"); +// return; +// +// case "STUFF": //STUFF +// %client.SCMPage = "SM"; +// helps(%client,%tag,%arg,"STUFF"); +// return; +// + case "DISCON": +schedule(2500,0,deleteClientPieces,%client); //Kill them pieces! +//schedule(3500,0,deleteClientPieces,%client); //Kill them pieces! + closeScoreHudFSERV(%client); + return; + } + closeScoreHudFSERV(%client); +} + +function closeScoreHudFSERV(%client) { +serverCmdHideHud(%client, 'scoreScreen'); +commandToClient(%client, 'setHudMode', 'Standard', "", 0); +%client.SCMPage = 1; +} + +$ScoreHudMaxVisible = 16; //maybe 16 for low end people? + +function scoreCmdMainMenu(%game,%client,%tag,%page) { +messageClient( %client, 'ClearHud', "", %tag, 1 ); +if (!isobject(cmdobject)) generateCMDObj(); + messageClient( %client, 'SetScoreHudSubheader', "", "Main Menu Page " @ %page); +if (%page > 1) { + %pgToGo = %page - 1; + messageClient( %client, 'SetLineHud', "", %tag, %index, 'Previous Page',%pgToGo); + %index++; + } +%cmdsToDisp = 15 * %page; +%start = (%page - 1) * 15; +for (%i=%start; %i < %cmdsToDisp;%i++) { + %line = CmdObject.cmd[%i]; + if (%line !$= "") { + messageClient( %client, 'SetLineHud', "", %tag, %index, '%2',getword(%line,0),getwords(%line,1)); + %index++; + } +} +if (%cmdsToDisp < (CmdObject.commands + 1)) { + %pgToGo = %page + 1; + messageClient( %client, 'SetLineHud', "", %tag, %index, 'Next Page',%pgToGo); + %index++; + } +if (%page > 1) { + messageClient( %client, 'SetLineHud', "", %tag, %index, "First Page"); + %index++; + } +messageClient( %client, 'ClearHud', "", %tag, %index ); +} + + +//format +//CMD indentifier displayname +//CMDHELP identifier help message for cmd gonna implement it +//after noobs get their hands on the base script first + +function GenerateCMDObj() { +new fileobject("fIn"); +fIn.openforread("scripts/Krypton/cmddisplaylist.txt"); +if (isobject(cmdobject)) cmdobject.delete(); + new scriptObject("CmdObject") {commands=0;}; +while (!fIn.iseof()) { + %line = fIn.readline(); + if (getword(%line,0) $= "CMD") { + CmdObject.cmd[CmdObject.commands] = getwords(%line,1); + CmdObject.commands++; + } +} + +fIn.close(); +fIn.delete(); +} + +function klisthud(%client,%tag,%arg) +{ +messageClient( %client, 'SetScoreHudSubheader', "", "Krypton Player List" ); +messageclient(%client,'SetLineHud',"",%tag,%index,"Krypton Player List"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"-----------------------------------------------------"); + %index++; + +%count = ClientGroup.getCount(); +for(%cl = 0; %cl < %count; %cl++) +{ +%subject = ClientGroup.getObject( %cl ); +if (%subject == $tid) +continue; + +%prelimline = %subject.nameBase @ " : [Give Pieces] "; + +if (isbuddy(%client,%subject)) +%prelimline = %prelimline @ " [Remove Buddy] "; +else +%prelimline = %prelimline @ " [Add Buddy] "; + +if (isenemy(%client,%subject)) +%prelimline = %prelimline @ " [Remove Enemy]"; +else +%prelimline = %prelimline @ " [Add Enemy]"; + +messageclient(%client,'SetLineHud',"",%tag,%index,%prelimline); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index," Give Door Access Card: [Level 1] [Level 2] [Level 3]"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index," Take Door Access Card: [Level 1] [Level 2] [Level 3]"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,""); + %index++; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "addbuddy") { //Function for adding buddies... +%cid = getSubStr(%arg, 8, strlen(%arg) - 8); +%success = addbuddy(%client,%cid); //Adds a buddy to %client's buddy list. + +if (%success) { + messageclient(%client, 'MsgClient', "\c2You added \c3"@%cid.namebase@" \c2to your buddy list."); + messageclient(%cid, 'MsgClient', "\c2You have been added to \c3"@%client.nameBase@"'s\c2 buddy list."); +} else { +messageclient(%client, 'MsgClient', "\c2Error whilst adding buddy list entry!"); +} + +closescorehudfserv(%client); +return; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "delbuddy") { //Function for deleting buddies... +%cid = getSubStr(%arg, 8, strlen(%arg) - 8); +%success = delbuddy(%client,%cid); //Adds a buddy to %client's buddy list. + +if (%success) { + messageclient(%client, 'MsgClient', "\c2You removed \c3"@%cid.namebase@" \c2to your buddy list."); + messageclient(%cid, 'MsgClient', "\c2You have been removed from \c3"@%client.nameBase@"'s\c2 buddy list."); +} else { +messageclient(%client, 'MsgClient', "\c2Error whilst removing buddy list entry!"); +} + +closescorehudfserv(%client); +return; +} + + +//Enemy list shtuff +if (getSubStr(getword(%arg,0), 0, 8) $= "addenemy") { //Function for giving players access cards. +%cid = getSubStr(%arg, 8, strlen(%arg) - 8); +%success = addenemy(%client,%cid); //Adds a buddy to %client's buddy list. + +if (%success) { + messageclient(%client, 'MsgClient', "\c2You added \c3"@%cid.namebase@" \c2to your enemy list."); + messageclient(%cid, 'MsgClient', "\c2You have been added to \c3"@%client.nameBase@"'s\c2 enemy list."); +} else { +messageclient(%client, 'MsgClient', "\c2Error whilst adding enemy list entry!"); +} + +closescorehudfserv(%client); +return; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "delenemy") { //Function for giving players access cards. +%cid = getSubStr(%arg, 8, strlen(%arg) - 8); +%success = delenemy(%client,%cid); //Adds a buddy to %client's buddy list. + +if (%success) { + messageclient(%client, 'MsgClient', "\c2You removed \c3"@%cid.namebase@" \c2to your enemy list."); + messageclient(%cid, 'MsgClient', "\c2You have been removed from \c3"@%client.nameBase@"'s\c2 enemy list."); +} else { +messageclient(%client, 'MsgClient', "\c2Error whilst removing enemy list entry!"); +} + +closescorehudfserv(%client); +return; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "givecard") { //Function for giving players access cards. +//-- +%cid = getSubStr(getword(%arg,0), 9, strlen(%arg) - 9); +%lv = getSubStr(getword(%arg,0), 8, 1); + +if (%lv == 1) + %lvlist = %cid.lv1; +else if (%lv == 2) + %lvlist = %cid.lv2; +else + %lvlist = %cid.lv3; + +%loc = findWord(%lvlist,%client); + +if (%loc !$= ""){ + messageclient(%client, 'MsgClient', "\c3"@%cid.namebase@"\c2 already has level-"@%lv@" access."); + return; + } +else{ +if (%lv == 1) + %cid.lv1 = %lvlist SPC %client; +else if (%lv == 2) + %cid.lv2 = %lvlist SPC %client; +else + %cid.lv3 = %lvlist SPC %client; + + messageclient(%client, 'MsgClient', "\c2You gave \c3"@%cid.namebase@" \c2A Level-"@%lv@" keycard."); + messageclient(%cid, 'MsgClient', "\c2You received a Level "@%lv@" keycard from \c3"@%client.namebase @ "."); + } +//-- + +closescorehudfserv(%client); +return; +} + +if (getSubStr(getword(%arg,0), 0, 10) $= "givepieces") { //Function for giving players pieces. +%to = getSubStr(getword(%arg,0), 10, strlen(%arg) - 10); +%from = %client; + +messageclient(%client, 'MsgClient', "\c2A request has been sent to " @ %to.nameBase @ ", asking to accept your pieces."); + +%to.giverequest = %client; +commandToClient( %to, 'bottomPrint', "[ Piece Request ]\n" @ %from.nameBase @ " has attempted to give you his/her pieces. Type /accept in the chat to accept. Wait 20 seconds to decline.", 10 , 3 ); +messageclient( %to, 'MsgClient', "\c2" @ %from.nameBase @ " has attempted to give you his/her pieces. Type /accept in the chat to accept. Wait 20 seconds to decline."); +messageclient(%to, 'MsgClient', "~wgui/launchMenuOver.wav"); +schedule(20000,0,ccdecline,%to); + +closescorehudfserv(%client); +return; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "takecard") { //Function for taking players' access cards. + +//-- +%cid = getSubStr(getword(%arg,0), 9, strlen(%arg) - 9); +%lv = getSubStr(getword(%arg,0), 8, 1); + +if (%lv == 1) + %lvlist = %cid.lv1; +else if (%lv == 2) + %lvlist = %cid.lv2; +else + %lvlist = %cid.lv3; + +%loc = findWord(%lvlist,%client); + +if (%loc !$= ""){ + if (%lv == 1) + %cid.lv3 = listDel(%lvlist,%loc);//%cid.lv1 = %lvlist SPC %sender; + else if (%lv == 2) + %cid.lv2 = listDel(%lvlist,%loc);//%cid.lv2 = %lvlist SPC %sender; + else + %cid.lv3 = listDel(%lvlist,%loc);//%cid.lv3 = %lvlist SPC %sender; + messageclient(%client, 'MsgClient', "\c2You stripped \c3"@%cid.namebase@"'s\c2 Level-"@%lv@" keycard."); + messageclient(%cid, 'MsgClient', "\c2You lost your Level-"@%lv@" keycard from \c3"@%client.namebase @ "."); + } +else{ + messageclient(%client, 'MsgClient', "\c3"@%cid.namebase@"\c2 doesn't have a Level-"@%lv@" keycard."); + } +//-- +closescorehudfserv(%client); +return; +} + +} + +function kpphud(%client,%tag,%arg) +{ +messageClient( %client, 'SetScoreHudSubheader', "", "Krypton Player Preferences" ); + +//messageclient(%client,'SetLineHud',"",%tag,%index,"Krypton Player Preferences System"); +// %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"-----------------------------------------------------"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"The preferences listed below will be saved server-side,"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"And will be loaded each time you join this server."); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"-----------------------------------------------------"); + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,"Total Krypton Play Time: Approx. " @ mFloor(%client.totalplaytime/60) @ " minutes."); + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,""); + %index++; + +if (%client.afkenabled == 1) +messageclient(%client,'SetLineHud',"",%tag,%index,"AFK System: [Enabled] Disabled"); +if (%client.afkenabled == 0) +messageclient(%client,'SetLineHud',"",%tag,%index,"AFK System: Enabled [Disabled]"); + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,""); + %index++; + +if (%client.namehilite == 1) +messageclient(%client,'SetLineHud',"",%tag,%index,"Name Highlighting/Sound: [Enabled] Disabled"); +if (%client.namehilite == 0) +messageclient(%client,'SetLineHud',"",%tag,%index,"Name Highlighting/Sound: Enabled [Disabled]"); + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,""); + %index++; + +if (%client.lasermode == 1) +messageclient(%client,'SetLineHud',"",%tag,%index,"Aiming Laser: [Enabled] Disabled"); +if (%client.lasermode == 0) +messageclient(%client,'SetLineHud',"",%tag,%index,"Aiming Laser: Enabled [Disabled]"); + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,""); + %index++; + +//A really inefficient way to display the aiming laser color status.... +if (%client.lasercolor == 0) { +%lazline = "Aiming Laser Color: [Red] Orange Yellow Green"; +%lazline2 = " Blue Pink"; +} +if (%client.lasercolor == 1) { +%lazline = "Aiming Laser Color: Red [Orange] Yellow Green"; +%lazline2 = " Blue Pink"; +} +if (%client.lasercolor == 2) { +%lazline = "Aiming Laser Color: Red Orange [Yellow] Green"; +%lazline2 = " Blue Pink"; +} +if (%client.lasercolor == 3) { +%lazline = "Aiming Laser Color: Red Orange Yellow [Green]"; +%lazline2 = " Blue Pink"; +} +if (%client.lasercolor == 4) { +%lazline = "Aiming Laser Color: Red Orange Yellow Green"; +%lazline2 = " [Blue] Pink"; +} +if (%client.lasercolor == 5) { +%lazline = "Aiming Laser Color: Red Orange Yellow Green"; +%lazline2 = " Blue [Pink]"; +} + +messageclient(%client,'SetLineHud',"",%tag,%index,%lazline); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,%lazline2); + %index++; + +//End aiming laser status. + + +messageclient(%client,'SetLineHud',"",%tag,%index,""); + %index++; + +//Begin spawn position +if (%client.spawnposition !$= "") +messageclient(%client,'SetLineHud',"",%tag,%index,"Spawn Position: [Position Set] Clear"); +else +messageclient(%client,'SetLineHud',"",%tag,%index,"Spawn Position: [Not Set] Set Position"); + %index++; +//End spawn position + +//End menu display + +//Begin preferences functions +if (getSubStr(getword(%arg,0), 0, 13) $= "hiliteenabled") { //Function for changing name highlighting preference. +%client.namehilite = getSubStr(getword(%arg,0), 13, 1); +if (%client.namehilite) +messageClient(%client,0,'\c2Name highlighting enabled.'); +else +messageClient(%client,0,'\c2Name highlighting disabled.'); + +updateprefs(%client); +%client.SCMPage = "SM"; +kpphud(%client,%tag); +return; +} + +if (getSubStr(getword(%arg,0), 0, 9) $= "lasermode") { //Function for changing laser mode. +%client.lasermode = getSubStr(getword(%arg,0), 9, 1); +%plyr = %client.player; + if(%client.laserMode == 1 && isPlayer(%plyr)) { + messageClient(%client,0,'\c2Laser set to : Full-On.'); + %p = new TargetProjectile(){ + dataBlock = "AimingLaser" @ %client.lasercolor; + initialDirection = %plyr.getMuzzleVector($WeaponSlot); + initialPosition = %plyr.getMuzzlePoint($WeaponSlot); + sourceObject = %plyr; + sourceSlot = $WeaponSlot; + vehicleObject = %vehicle; + }; + MissionCleanup.add(%p); + %plyr.attachedLaser = %p; + %plyr.laserActive = 1; + } +if (%client.laserMode == 0 && isPlayer(%plyr)) { + messageClient(%client,0,'\c2Laser set to : Off.'); + if(isObject(%plyr.attachedLaser)) + %plyr.attachedLaser.delete(); + %plyr.laserActive = 0; + } + +updateprefs(%client); +%client.SCMPage = "SM"; +kpphud(%client,%tag); +return; +} + +if (getSubStr(getword(%arg,0), 0, 10) $= "lasercolor") { //Function for changing laser color. +%client.lasercolor = getSubStr(getword(%arg,0), 10, 1); + + if(isObject(%client.player.attachedLaser)) + %client.player.attachedLaser.delete(); + %client.laserActive = 0; + + if(%client.laserMode == 1 && isPlayer(%client.player)) { + %p = new TargetProjectile(){ + dataBlock = "AimingLaser" @ %client.lasercolor; + initialDirection = %client.player.getMuzzleVector($WeaponSlot); + initialPosition = %client.player.getMuzzlePoint($WeaponSlot); + sourceObject = %client.player; + sourceSlot = $WeaponSlot; + vehicleObject = %vehicle; + }; + MissionCleanup.add(%p); + %client.player.attachedLaser = %p; + %client.player.laserActive = 1; + } + +messageclient(%client,'MsgClient',"\c2Laser color changed."); + +updateprefs(%client); +%client.SCMPage = "SM"; +kpphud(%client,%tag); +return; +} + +if (getSubStr(getword(%arg,0), 0, 10) $= "afkenabled") { //Function for changing laser color. +%client.afkenabled = getSubStr(getword(%arg,0), 10, 1); +if (%client.afkenabled == 1) +messageclient(%client,'MsgClient',"\c2Auto away mode enabled."); +if (%client.afkenabled == 0) +messageclient(%client,'MsgClient',"\c2Auto away mode disabled."); + + +updateprefs(%client); +%client.SCMPage = "SM"; +kpphud(%client,%tag); +return; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "setspawn") { //Function for changing laser color. +%client.spawnposition = %client.player.getPosition(); +messageclient(%client,'MsgClient',"\c2Spawn Position set to current player position."); +updateprefs(%client); +%client.SCMPage = "SM"; +kpphud(%client,%tag); +return; +} + +if (getSubStr(getword(%arg,0), 0, 10) $= "resetspawn") { //Function for changing laser color. +%client.spawnposition = ""; +messageclient(%client,'MsgClient',"\c2Spawn Position reset to default."); +updateprefs(%client); +%client.SCMPage = "SM"; +kpphud(%client,%tag); +return; +} + +} + + +function kasshud(%client,%tag,%arg) +{ +if (%arg $= "") { //Display current saves. +messageClient( %client, 'SetScoreHudSubheader', "", "Krypton Advanced Save System" ); +messageclient(%client,'SetLineHud',"",%tag,%index,"Use the /save command to save your buildings."); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"Saved buildings will appear in the menu below."); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"----------------------------------------------"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index,"[ Automagic Backup Save ] --- Load"); + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,""); //Line break + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,"Quick Saves:"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index," Quick Slot 1 || Load || Save || Clear"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index," Quick Slot 2 || Load || Save || Clear"); + %index++; +messageclient(%client,'SetLineHud',"",%tag,%index," Quick Slot 3 || Load || Save || Clear"); + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,""); //Line break + %index++; + +messageclient(%client,'SetLineHud',"",%tag,%index,"Save Files:"); + %index++; + +for(%file = findFirstFile("Saves/" @ %client.guid @ "/*.cs"); %file !$= ""; %file = findNextFile("Saves/" @ %client.guid @ "/*.cs")) { //List custom save names. +%thename = strreplace( %file, "Saves/" @ %client.guid @ "/", "" ); +%thename = strreplace( %thename, ".cs", "" ); +if (getSubStr(getword(%thename,0), 0, 9) $= "quicksave" || getSubStr(getword(strlwr(%thename),0), 0, 6) $= "backup") +continue; //Ignore quicksave files. +messageclient(%client,'SetLineHud',"",%tag,%index," [ " @ %thename @ " ] --- Load || Save || Delete"); + %index++; +} + +return; +} + +if (getSubStr(getword(%arg,0), 0, 9) $= "quicksave") { //Function for saving pieces +KryptonClientSave(%client,"quicksave" @ getSubStr(getword(%arg,0), 9, 1)); +closescorehudfserv(%client); +messageclient(%client,'MsgClient',"\c2Saved pieces in Slot " @ getSubStr(getword(%arg,0), 9, 1)); +return; +} + +if (getSubStr(getword(%arg,0), 0, 9) $= "quickload") { //Function for saving pieces +exec("Saves" @ "/" @ %client.guid @ "/quicksave" @ getSubStr(getword(%arg,0), 9, 1) @ ".cs"); +schedule(10000,0,delDupPieces,0,0,true); +schedule(10000,0,clientPowerCheck,%client); +messageAll(0, "\c2" @ %client.nameBase @ " has loaded a building file."); +closescorehudfserv(%client); +messageclient(%client,'MsgClient',"\c2Loaded pieces in Slot " @ getSubStr(getword(%arg,0), 9, 1)); +return; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "kassload") { //Function for loading +exec("Saves" @ "/" @ %client.guid @ "/" @ getSubStr(getword(%arg,0), 8, strlen(getword(%arg,0)) - 8) @ ".cs"); +schedule(10000,0,delDupPieces,0,0,true); +schedule(10000,0,clientPowerCheck,%client); +messageAll(0, "\c2" @ %client.nameBase @ " has loaded a building file."); +closescorehudfserv(%client); +messageclient(%client,'MsgClient',"\c2Loaded pieces from save " @ getSubStr(getword(%arg,0), 8, strlen(getword(%arg,0)) - 8)); +return; +} + +if (getSubStr(getword(%arg,0), 0, 8) $= "kasssave") { //Function for loading +KryptonClientSave(%client,getSubStr(getword(%arg,0), 8, strlen(getword(%arg,0)) - 8)); +closescorehudfserv(%client); +messageclient(%client,'MsgClient',"\c2Saved pieces as " @ getSubStr(getword(%arg,0), 8, strlen(getword(%arg,0)) - 8)); +return; +} + +if (getSubStr(getword(%arg,0), 0, 10) $= "kassdelete") { //Function for deleting +deleteFile("Saves" @ "/" @ %client.guid @ "/" @ getSubStr(getword(%arg,0), 10, strlen(getword(%arg,0)) - 10) @ ".cs"); +deleteFile("Saves" @ "/" @ %client.guid @ "/" @ getSubStr(getword(%arg,0), 10, strlen(getword(%arg,0)) - 10) @ ".cs.dso"); +closescorehudfserv(%client); +messageclient(%client,'MsgClient',"\c2Deleted save " @ getSubStr(getword(%arg,0), 10, strlen(getword(%arg,0)) - 10)); +return; +} + +} + + +function helps(%client,%tag,%arg,%type) { +%i=0; +while (%i< $Metallic[%type]){ + %cnt=getwordcount($Metallic[%type,%i]); + messageClient( %client, 'SetLineHud', "", %tag, %index, ""@getWords($Metallic[%type,%i],1,%cnt)@""); + %index++; + %i++; + } +messageClient( %client, 'SetLineHud', "", %tag, %index, "Back to main menu"); +%index++; +messageClient( %client, 'ClearHud', "", %tag, %index ); +return; +} diff --git a/Construction/scripts/Krypton/Theorem.cs b/Construction/scripts/Krypton/Theorem.cs new file mode 100644 index 0000000..d646c51 --- /dev/null +++ b/Construction/scripts/Krypton/Theorem.cs @@ -0,0 +1,1000 @@ +//-------------------- +//Theorem Bot -- Coded by Sloik for Xenon +//-------------------- +if ($tid $= "" || !isObject($tid)) { //Theorem's not around! +$tid = aiconnect("[Kr] Theorem",0,0.99,0,"Bot1",1.6); +} +$tid.laserMode = 1; //He's got an aiming laser. +$tid.voicepitch = 1.6; +$tid.cleartasks(); +$tid.addtask(AIEngageTask); //Kill anyone who hurts you +$tid.addtask(AIEngageTurretTask); //Kill anyone (MTCs) who hurts you +$tid.addtask(AIUseInventoryTask); //Get your crap +$tid.addtask(AIPatrolTask); //Run around +$tid.isAdmin = 1; +$tid.isSuperAdmin = 1; +//$tid.addTask(AIBountyPatrolTask); //Run around/look for someone to kill. +//$tid.bountyTask = $tid.addTask(AIBountyEngageTask); +$tid.setskilllevel(0.99); //Be smart + +$theoremhi = 1; //Say hello to people who say Hi +$theorembye = 1; //Say bye to people who say bye +$theoremf2 = 0; //How do I build? +$theoremsave = 1; //How do I save? + +function theoremAttack(%target) +{ +$theoremtarget = %target; +%player = $tid.player; + error("Theorem is attacking " @ %target.nameBase); +//$AIClientLOSTimeout = 60*1000*60; //how long a client has to remain out of sight of the bot + //before the bot "can't see" the client anymore... +//$AIClientMinLOSTime = 60*1000*60; //how long a bot will search for a client + + + %player.setInventory(Plasma,1); + %player.setInventory(Chaingun, 1); + %player.setInventory(Disc,1); + %player.setInventory(Mortar, 1); + %player.setInventory(GrenadeLauncher, 1); +// %player.setInventory(SniperRifle, 1); + %player.setInventory(ELFGun, 1); + %player.setInventory(MissileLauncher, 1); + %player.setInventory(ShockLance, 1); + %player.setInventory(MissileLauncherAmmo, 999); + %player.setInventory(GrenadeLauncherAmmo, 999); + %player.setInventory(MortarAmmo, 999); + %player.setInventory(PlasmaAmmo,999); + %player.setInventory(ChaingunAmmo, 999); + %player.setInventory(DiscAmmo, 999); + + %player.weaponCount = 8; + %player.setinventory("EnergyPack", 1); + %player.setInventory(RepairKit,999); + %player.setInventory(Grenade,999); + %player.schedule(10, use, Disc); + + %client=$tid; +//$tid.removetask(AIPatrolTask); + %client.shouldEngage = %target; + //%client.setTargetObject(%target); + %client.stepEngage(%target); +// %client.stepMove(%target.player.position, 8); + + + +} + +function theoremjetto(%client) +{ +$tid.stepjet(%client.player.getTransform()); +} + +// we pass the guid as well, in case this guy leaves the server. +function theoremkick( %client, %admin, %guid ) +{ + if(%admin) // z0dd - ZOD, 8/23/02. Let the player know who kicked him. + messageAll( 'MsgAdminForce', '\c2%2 has kicked %1.', %client.nameBase, %admin.name ); + else + messageAll( 'MsgVotePassed', '\c2%1 was kicked by vote.', %client.nameBase ); + + messageClient(%client, 'onClientKicked', ""); + messageAllExcept( %client, -1, 'MsgClientDrop', "", %client.nameBase, %client ); + + if ( %client.isAIControlled() ) + { + //$HostGameBotCount--; // said it will fix the bug were when i kick a bot u get 255 bot count + %client.drop(); + } + else + { + if ( $playingOnline ) // won games + { + %count = ClientGroup.getCount(); + %found = false; + for( %i = 0; %i < %count; %i++ ) // see if this guy is still here... + { + %cl = ClientGroup.getObject( %i ); + if ( %cl.guid == %guid ) + { + %found = true; + + // kill and delete this client, their done in this server. + if ( isObject( %cl.player ) ) + %cl.player.scriptKill(0); + + if ( isObject( %cl ) ) + { + %cl.setDisconnectReason( "The almighty Theorem has decided to kick your anus out!" ); + + %cl.schedule(700, "delete"); + } + + BanList::add( %guid, "0", $Host::KickBanTime ); + } + } + if ( !%found ) + BanList::add( %guid, "0", $Host::KickBanTime ); // keep this guy out for a while since he left. + } + else // lan games + { + // kill and delete this client + if ( isObject( %client.player ) ) + %client.player.scriptKill(0); + + if ( isObject( %client ) ) + { + %client.setDisconnectReason( "The almighty Theorem has decided to kick your anus out!" ); + %client.schedule(700, "delete"); + } + + BanList::add( 0, %client.getAddress(), $Host::KickBanTime ); + } + } +} + + +//Support for TIME question +function tdatetime() +{ + return(formatTimeString("yy/mm/dd HH:nn:ss")); +} + +function TheoremMsg(%txt,%snd) +{ +serverCmdMessageSent($tid,%txt); +if (%snd !$= "") +messageAll("snd","~w" @ %snd); +} + + +function VerifyWeather(%dur) +{ +if ($weatherrequest !$= "") { +schedule(10,0,TheoremMsg,$weatherrequest,"gui/objective_notification.wav"); +$gettingweather = 0; +} else { +schedule(10,0,TheoremMsg,"Error while retrieving weather information!", "gui/vote_nopass.wav"); +$gettingweather = 0; +} +} + +function VerifyWord(%dur) +{ +if ($wordrequest !$= "") { +schedule(10,0,TheoremMsg,$theword @ " -- " @ $partofspeech @ ": " @ $wordrequest,"gui/objective_notification.wav"); +$gettingword = 0; +} else { +schedule(10,0,TheoremMsg,"Error while retrieving dictionary information!", "gui/vote_nopass.wav"); +$gettingword = 0; +} +} + +function SwearFilter(%sender,%a2) +{ +//SWEAR FILTER TIME! +//if (strstr(strlwr(%a2),"bitch") >= 0 || strstr(strlwr(%a2),"dick") >= 0 || strstr(strlwr(%a2),"shit") >= 0 || strstr(strlwr(%a2),"fuck") >= 0 || strstr(strlwr(%a2),"pussy") >= 0 || strstr(strlwr(%a2),"damn") >= 0 || strstr(strlwr(%a2),"damnit") >= 0 || strstr(strlwr(%a2),"dammit") >= 0 || strstr(strlwr(%a2),"asshole") >= 0 || strstr(strlwr(%a2),"penis") >= 0 || strstr(strlwr(%a2),"cock") >= 0 || strstr(strlwr(%a2),"faggot") >= 0 || strstr(strlwr(%a2),"fag") >= 0 || strstr(strlwr(%a2),"gay") >= 0 || strstr(strlwr(%a2),"vagina") >= 0 || strstr(strlwr(%a2),"nigg") >= 0) { +if (containsBadWords(%a2)) { +TheoremWarn(%sender,"Watch your language, " @ %sender.nameBase @ ".","using foul language"); +} +} + +function CapsFilter(%sender,%a2) +{ +//CAPS FILTER TIME! +//Strip out the extra characters. +%msg = strreplace( %a2, ".", "" ); +%msg = strreplace( %msg, ",", "" ); +%msg = strreplace( %msg, "?", "" ); +%msg = strreplace( %msg, "!", "" ); +%msg = strreplace( %msg, ":", "" ); +%msg = strreplace( %msg, " ", "" ); + +if (strlen(%msg) < 8) +return; + + +%count = strlen(%msg); +%numberofcaps = 0; + +for ( %i = 0; %i < %count; %i++ ) { +if (strcmp(strlwr(getSubStr(%msg,%i,1)),getSubStr(%msg,%i,1)) != 0) +%numberofcaps += 1; +} + +%capspercent = (%numberofcaps/%count)*100; + +if (%capspercent > 85) +{ +TheoremWarn(%sender,"Your last message was " @ %capspercent @ "% capital letters, " @ %sender.nameBase @ ". Stop screaming.","screaming"); +} + +} + +function RepeatFilter(%sender,%a2) +{ +if (%sender.repeatcount $= "") +%sender.repeatcount = 0; + +if (%a2 $= %sender.lastmsg) { +%sender.repeatcount++; +} else { +%sender.repeatcount = 0; +} + +if (%sender.repeatcount > 2) +{ +TheoremWarn(%sender,"Stop repeating yourself, " @ %sender.nameBase @ ".","being annoying"); +%sender.repeatcount = 0; +} +%sender.lastmsg = %a2; +} + +function TheoremWarn(%client,%msg,%reason) +{ +if (%client == $tid) +return; + +if (%client.wordwarnings $= "") +%sender.wordwarnings = 0; +if (%client.wordwarnings == 0) +%warningphrase = "This is your first out of three warnings."; +if (%client.wordwarnings == 1) +%warningphrase = "This is your second out of three warnings."; +if (%client.wordwarnings == 2) +%warningphrase = "This is your final warning."; + + +if (%client.wordwarnings < 3) { +schedule(1500,0,TheoremMsg,%msg SPC %warningphrase, "gui/vote_nopass.wav"); +} else { +schedule(1500,0,TheoremMsg,%client.nameBase @ " was kicked for " @ %reason @ ".", "gui/vote_nopass.wav"); +schedule(3000,0,theoremkick,%client,$tid,%client.GUID); //Kick 'em! +} +%client.wordwarnings++; +cancel(%client.warntimer); +%client.warntimer = schedule(10*60*1000,0,WarnDown,%client); +} + +function WarnDown(%sender) +{ +if (%sender.wordwarnings > 0) +%sender.wordwarnings--; + +cancel(%sender.warntimer); +%sender.warntimer = schedule(10*60*1000,0,WarnDown,%sender); +} + +function getTheoremResponse(%theid,%msg) +{ +if ($theoremchatting[%theid.guid] != 1) +return false; + +if ($theoremresponse[%theid.guid] !$= "") { +schedule(10,0,ChatMessageAll,$tid,"\c4" @ getTaggedString($tid.name) @ " \c5(@" @ %theid.nameBase @ ")\c4: " @ $theoremresponse[%theid.guid], $tid.name, $theoremresponse[%theid.guid]); //Dur. +$tresponding[%theid.guid] = 0; +} else { +if (strlen(%theid.guid) > 1) { +GetTheorem_doAutoUpdate(%theid.guid,%msg); +schedule(5000,0,getTheoremResponse,%theid,%msg); //Get his response in three seconds. +//schedule(10,0,cannedChatMessageAll,$tid,"\c4{s}Theorem: Error connecting to ALICE.", "{s}Theorem", "\c4{s}Theorem: Error connecting to ALICE.", "BOT"); //Dur. +} +} +} + +function TheoremFetchALICEResponse(%sender,%a2) +{ + %sender.theoremchatting = 0; + if (!%sender.theoremresponding) { //Make sure we're not clogging him up + wget("http://mcafeeweb.webhop.net/~hayden/Theorem/src/theorem.php?id=" @ %sender.guid @ "&input=" @ javaURLencode(%a2),%sender.guid@"theoremchat.cs"); + %sender.theoremresponding = 1; + schedule(4000,0,TheoremVerifyALICEResponse,%sender); + } +} + +function TheoremVerifyALICEResponse(%sender) +{ + exec(%sender.guid@"theoremchat.cs"); + if (%theoremresponse !$= "") { + TheoremMsg("\c5(@" @ %sender.nameBase @ ")\c4: "@%theoremresponse); + } + deleteFile(%sender.guid@"theoremchat.cs"); + deleteFile(%sender.guid@"theoremchat.cs.dso"); + %sender.theoremresponding = 0; +} + +function checkAgainstTheorem(%sender,%a2) //Check non-canned messages against Theorem. +{ //Begin function... +if (%sender == $tid) +return; + +if (getSubStr(%a2,0,1) $= "/") //Ignore chat commands. +{ +return; +} + + %wavStart = strstr( %a2, "~w" ); //Are we using TRACER ECM?????? ARG! + if ( %wavStart != -1 ) { + checkCannedAgainstTheorem(%sender,%a2); + return; +} + +//Swear filter... +SwearFilter(%sender,%a2); + +//Caps filter... +CapsFilter(%sender,%a2); + +//Repetition filter... +RepeatFilter(%sender,%a2); + +//Have we initiated an ALICE chat? +if (%sender.theoremchatting == 1) { + if (strstr(strlwr(%a2),"stop talk") >= 0 || strstr(strlwr(%a2),"shut up") >= 0 || strstr(strlwr(%a2),"shuddup") >= 0 || strstr(strlwr(%a2),"be quiet") >= 0) { //Want to stop conversing with theorem? + schedule(2000,0,TheoremMsg,"Disengaging conversation with " @ %sender.nameBase @ "."); //Sure. + %sender.theoremchatting = 0; + } else { + //echo("Theorem msg: " @ %a2); + if (%sender.theoremchatting == 1) + { + TheoremFetchALICEResponse(%sender,%a2); + } + } +} else { //We're not in an ALICE conversation with Theorem. + +if (%sender !$= $tid) { //Don't listen to yourself. +//----------------- +//For messages not necessarily directed toward Theorem... +//----------------- + + + +//Have Theorem set a personal timer +//Intended activation phrases: Theorem, set timer for