Tank Editor

The **tank editor** (Accessible in Test Servers by clicking the blue button in the bottom left corner (If you do not see the button, run /editmode in the chat first)) is the new method of editing tanks that replaced /exportbody, /exportweapon, /loadweapon and /loadbody. It allows for easy modification and manipulation of a tank. You can import/export the full, body, or weapon of a tank. You can also export the image of the current tank, or load in an upgrade from the base game (like mono, base, riot...).

If you die, you can do ctrl+z (**⌘**+z on Mac) in the editor to "undo the death," allowing you to continue working on your tank rather than starting anew. (Note: Reloading the tab cannot be undone.)

## Weapon editing

### Barrel Editing

A barrel of a tank has four basic attributes: Reload, Delay, Width, and Height. The normal, drone, and trap barrels share the bullet attributes. A minion barrel accepts a full tank code for the minion, its attributes are the Health, Body Damage and Speed multipliers of the minions. There is also an unnamed barrel, that does not shoot any bullet, but can have recoil. Barrels can have a X and Y offset.

## Body editing

### Gadget Editing

There are 3 types of gadgets: Auto Cannon, Mounted Drone Spawner, Aura, and Tank Section. The Auto Cannon is like a normal barrel but with a detect and forget distance. The Mounted Drone Spawner acts like its weapon counterpart. **All gadgets can have a X and Y offset.**

#### Auto Cannons

**Auto Cannons** are regular cannons that are mounted on the body of a tank, which automatically fire at targets within their detection range, and will continue to shoot at that target until it exceeds their adjustable 'forget' distance. Other than the auto-targeting, the barrel is modified like a normal cannon, being able to have a longer/shorter barrel, higher/lower damage, etc.

##### Custom Autos

Custom Auto Cannons are Auto-Cannons that can be customized by the players. You can add Custom auto-cannons by making a Tank Section gadget and change its idle behaviour. For instance, you can export the code of a tank, and put it in the place for code for code in tank section.

##### Notes

* When adjusting the width, it also increases the radius of the base.

#### Auras

**Auras** are a type of gadget which have a specified effect in an adjustable radius, such as dealing damage, healing, pushing or pulling. Auras can have the effect interval and damage of their auras adjusted, aside from Cosmetic auras. All auras can also have their colour and amount of sides changed.

##### Types of Aura:

1. **Damaging auras** (previously reffered to as fire auras) deal damage within their radius over time, exactly like the Hearth branch. You can set the attack time (reload) and attack damage. You can also set the radius and opacity for all auras (1 radius is the diameter of the tank, 1 opacity is completely solid).
2. **Healing auras** increase the rate at which your health regeneration kicks in and how fast it heals you while in the aura, exactly like the Mender branch.
3. **Attraction auras** suck in nearby shapes, bullets and players (but not minions or traps, currently), like other auras, you can adjust the interval between each pull and the strength of the attraction. (Note: setting the strength of the attraction to absurd values may have adverse effects on other player's cameras which can persist through death, so please refrain from doing this)
4. **Repulsion auras** push away nearby shapes, bullets and players (but not minions or traps, currently), like other auras, you can adjust the interval between each push and the strength of the repulsion. (Note: setting the strength of the repulsion to absurd values may have adverse effects on other player's cameras which can persist through death, so please refrain from doing this)
5. **Cosmetic auras** do exactly what you'd expect them to do. Nothing.

##### Notes

* Creating an Aura with a Radius greater than *exactly* 98802724889.44 causes it to become completely invisible.
* The hitbox of an Aura does not change with the amount of sides it has (hitbox is always a circle).

**Tank Sections** are a type of gadget that allows the player to create a secondary body. The player can also add code into the tank section to make more advanced builds.

### Layers

A layer can have a X and Y offset, sides and additionally, outer sides and size.

A layer can have negative sides like -5, which will render as a star.

The outer part of a layer can also have negative sides, and if its size is 0, then it won't appear. It renders slightly different from a layer.

## The tank's stats

A tank has some attributes: weapon and body FOV, name, team, type, speed, health, body damage, max weapon/body drones, barrels, layers, and gadgets.

For the type you can pick between normal and celestial, if you pick Celestial, your tank will act like a celestial (automatically level 75, much larger than normal tanks)

The weapon and body FOV is self-explanatory.

There are three types of names, the override tank name, weapon upgrade, and body upgrade names.

**The override tank name, if any set will always cover the Weapon/Body upgrade name.**

The max drones will determine the max count of drones/minions that can be spawned, though do note that bullet penetration influnces this stat (full penetration bar = 2 times max drone count).

## Code compression

scenexe.io uses pako library to DEFLATE

compression procedure:1. compress tank code using DEFLATE
2. encode result from step 1 using Base64
3. compress result from step 2 using DEFLATE
4. encode result from step 3 using Base64
5. if (length of result from step 2) < (length of result from step 4):
	* compressed tank code is result from step 2else:
	* compressed tank code is result from step 4

javascript from ALPHA 0.9.10 pretty printed and with comments
```
 function compress(e) {
 // this function deflates and base64 encodes argument
 // pako\_\_WEBPACK\_IMPORTED\_MODULE\_10\_\_.e is deflate
 return Object(base64\_js\_\_WEBPACK\_IMPORTED\_MODULE\_9\_\_.fromByteArray) (Object(pako\_\_WEBPACK\_IMPORTED\_MODULE\_10\_\_.a) (e))
 }
 function decompress(e) {
 // this function base64 decodes and inflates argument
 // pako\_\_WEBPACK\_IMPORTED\_MODULE\_10\_\_.b is inflate
 return Object(pako\_\_WEBPACK\_IMPORTED\_MODULE\_10\_\_.b) (Object(base64\_js\_\_WEBPACK\_IMPORTED\_MODULE\_9\_\_.toByteArray) (e), {
 to: 'string'
 })
 }
 function codeToObject(e) {
 var t;
 try {
 t = JSON.parse(e)
 } catch (n) {
 try {
 t = JSON.parse(decompress(e.trim()))
 } catch (n) {
 try {
 t = JSON.parse(decompress(decompress(e.trim())))
 } catch (e) {
 return {
 error: 'Invalid Code'
 }
 }
 return t || {
 error: 'Invalid Code'
 }
 }
 return t || {
 error: 'Invalid Code'
 }
 }
 return t
 }
 function objectToCode(e) {
 var t = JSON.stringify(e);
 if (\_settings\_\_WEBPACK\_IMPORTED\_MODULE\_8\_\_.i.compressCodes) {
 var n = compress(t),
 r = compress(n);
 t = n.length < r.length ? n : r
 }
 return t
 }

```

## External tank code generators

https://scenexeimagegen.chromaticpixels.repl.co/
image to full tank code (binary transparency) (image is made of barrels) (server side)
https://scnxwged.glitch.me/img2weapon.html
mirror: http://scnxneoswebsite.byethost22.com/BZZZZ/img2weapon.html
image to weapon code (no transparency) (image is made of barrels) (client side)
https://scnxwged.glitch.me/img2body.html
mirror: http://scnxneoswebsite.byethost22.com/BZZZZ/img2body.html
image to body code (supports transparency using **#RRGGBBAA** and **#RGBA** hex codes) (image is made of layers) (client side)