factorio-types 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -11
- package/dist/prototypes.d.ts +1 -1
- package/index.d.ts +4 -2
- package/package.json +5 -6
- package/{dist → src}/core.d.ts +6 -0
- package/src/lualib/noise.d.ts +194 -0
- package/src/settings.d.ts +133 -0
- package/tsconfig.base.json +1 -1
- /package/{dist → src}/serpent.d.ts +0 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Intended to be used with [Typescript to Lua](https://github.com/TypeScriptToLua/
|
|
|
10
10
|
|
|
11
11
|
## Configuration
|
|
12
12
|
|
|
13
|
-
This library includes [tsconfig.base.json](
|
|
13
|
+
This library includes [tsconfig.base.json](https://github.com/sguest/factorio-types/blob/master/tsconfig.base.json) in the root of the package with recommended configuration. This can be used as follows
|
|
14
14
|
|
|
15
15
|
`tsconfig.json`:
|
|
16
16
|
|
|
@@ -21,30 +21,90 @@ This library includes [tsconfig.base.json](./tsconfig.base.json) in the root of
|
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
## Stages
|
|
25
|
+
|
|
26
|
+
Factorio mods and the api go through [three distinct stages](https://lua-api.factorio.com/latest/). Types are organized into namespaces `runtime`, `prototype`, and `settings` representing the types to be used in each stage. These types, and therefore their corresponding namespaces, are a compile-time-only feature as lua does not have types, however using a type from the wrong namespace during the wrong stage is likely to result in a runtime error as you will be attempting to access something Factorio does not let you access at that time.
|
|
27
|
+
|
|
28
|
+
Note there is some overlap between the types for the Settings and Prototype phases since both regularly provide prototype data to `data.extend()`, and in fact the settings-phase prototypes extend `prototype.PrototypeBase`. However, you should only be providing types from the `settings` namespace during the settings phase, and from the `prototype` namespace during the prototype phase.
|
|
29
|
+
|
|
24
30
|
## Examples
|
|
25
31
|
|
|
26
32
|
A very minimal proof-of-concept showing basic toolchain setup can be found [Here](https://github.com/sguest/factorio-fire-armor-typescript)
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
A slightly more in-depth and realistic mode can be found [Here](https://github.com/sguest/basic-seablock)
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
## Lualib
|
|
31
37
|
|
|
32
|
-
|
|
38
|
+
Factorio makes various lua functions available to mods via [LuaLib](https://github.com/wube/factorio-data/tree/master/core/lualib)
|
|
39
|
+
|
|
40
|
+
Unlike the main parts of the factorio API, these do not exist as ambient globals but instead must be imported
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import * as noise from "noise";
|
|
44
|
+
let x = noise.var_get('x');
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Also unlike the main factorio API, these types are not documented in a machine-readable way and therefore are not generated here along with the main API types. Instead, they are hand-written as needed and as a result are incomplete and more likely to be wrong. See the [existing declarations](https://github.com/sguest/factorio-types/tree/master/src/lualib).
|
|
48
|
+
|
|
49
|
+
If there are types of lualib that you need but do not exist, either open an issue asking for it, or write the type definitions and open a pull request. If you would like to continue working with these types while they do not exist in `factorio-types`, you can add the import path to `tstl.noResolvePaths` in tsconfig.json, and then `require()` the paths, which will be typed as `any`.
|
|
50
|
+
|
|
51
|
+
`tsconfig.json`
|
|
33
52
|
|
|
34
53
|
```json
|
|
35
54
|
{
|
|
36
55
|
"tstl": {
|
|
37
|
-
"noResolvePaths": ["
|
|
56
|
+
"noResolvePaths": ["math2d"]
|
|
38
57
|
}
|
|
39
58
|
}
|
|
40
59
|
```
|
|
41
60
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
`noise.d.ts`:
|
|
61
|
+
`some-file.ts`
|
|
45
62
|
|
|
46
63
|
```typescript
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
const math2d = require('math2d');
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Noise
|
|
68
|
+
|
|
69
|
+
The `noise` module has mostly-complete type definitions. A couple notes on usage due to the limitations of typescript
|
|
70
|
+
|
|
71
|
+
The `noise.var` function is named `noise.var_get` since `var` is a reserved word in typscript. It will be emitted as `noise.var` thanks to a [@customName compiler annotation](https://typescripttolua.github.io/docs/advanced/compiler-annotations/#customname).
|
|
72
|
+
|
|
73
|
+
typescript
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import * as noise from "noise";
|
|
77
|
+
let x = noise.var_get('x');
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
output lua
|
|
81
|
+
|
|
82
|
+
```lua
|
|
83
|
+
local noise = require("noise")
|
|
84
|
+
local x = noise.var("x")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Noise values have operator overloads for common arithmetic operations, however Typescript does not support operator overloading. These are implemented as [Operator map types](https://typescripttolua.github.io/docs/advanced/language-extensions#operator-map-types) in the noise library, which will emit as regular operators in lua. Available operators are named following lua conventions for overloaded operators without the preceding double-underscore:
|
|
88
|
+
|
|
89
|
+
- Addition: `noise.add`
|
|
90
|
+
- Subraction: `noise.sub`
|
|
91
|
+
- Multiplication: `noise.mul`
|
|
92
|
+
- Division: `noise.div`
|
|
93
|
+
- Unary Negation: `noise.unm`
|
|
94
|
+
- Exponentiation: `noise.pow`
|
|
95
|
+
|
|
96
|
+
typescript
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
let x = noise.var_get('x');
|
|
100
|
+
let y = noise.var_get('y');
|
|
101
|
+
let sum = noise.add(x, y);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Output lua
|
|
105
|
+
|
|
106
|
+
```lua
|
|
107
|
+
local x = noise.var("x")
|
|
108
|
+
local y = noise.var("y")
|
|
109
|
+
local sum = x + y;
|
|
50
110
|
```
|
package/dist/prototypes.d.ts
CHANGED
|
@@ -10105,5 +10105,5 @@ interface WindSound {
|
|
|
10105
10105
|
type: 'wind-sound'
|
|
10106
10106
|
}
|
|
10107
10107
|
|
|
10108
|
-
type dataExtendType = ({ type: 'accumulator' } & AccumulatorPrototype) | ({ type: 'achievement' } & AchievementPrototype) | ({ type: 'active-defense-equipment' } & ActiveDefenseEquipmentPrototype) | ({ type: 'ambient-sound' } & AmbientSound) | ({ type: 'ammo-category' } & AmmoCategory) | ({ type: 'ammo' } & AmmoItemPrototype) | ({ type: 'ammo-turret' } & AmmoTurretPrototype) | ({ type: 'animation' } & AnimationPrototype) | ({ type: 'arithmetic-combinator' } & ArithmeticCombinatorPrototype) | ({ type: 'armor' } & ArmorPrototype) | ({ type: 'arrow' } & ArrowPrototype) | ({ type: 'artillery-flare' } & ArtilleryFlarePrototype) | ({ type: 'artillery-projectile' } & ArtilleryProjectilePrototype) | ({ type: 'artillery-turret' } & ArtilleryTurretPrototype) | ({ type: 'artillery-wagon' } & ArtilleryWagonPrototype) | ({ type: 'assembling-machine' } & AssemblingMachinePrototype) | ({ type: 'autoplace-control' } & AutoplaceControl) | ({ type: 'battery-equipment' } & BatteryEquipmentPrototype) | ({ type: 'beacon' } & BeaconPrototype) | ({ type: 'beam' } & BeamPrototype) | ({ type: 'belt-immunity-equipment' } & BeltImmunityEquipmentPrototype) | ({ type: 'blueprint-book' } & BlueprintBookPrototype) | ({ type: 'blueprint' } & BlueprintItemPrototype) | ({ type: 'boiler' } & BoilerPrototype) | ({ type: 'build-entity-achievement' } & BuildEntityAchievementPrototype) | ({ type: 'burner-generator' } & BurnerGeneratorPrototype) | ({ type: 'capsule' } & CapsulePrototype) | ({ type: 'car' } & CarPrototype) | ({ type: 'cargo-wagon' } & CargoWagonPrototype) | ({ type: 'character-corpse' } & CharacterCorpsePrototype) | ({ type: 'character' } & CharacterPrototype) | ({ type: 'cliff' } & CliffPrototype) | ({ type: 'combat-robot-count' } & CombatRobotCountAchievementPrototype) | ({ type: 'combat-robot' } & CombatRobotPrototype) | ({ type: 'constant-combinator' } & ConstantCombinatorPrototype) | ({ type: 'construct-with-robots-achievement' } & ConstructWithRobotsAchievementPrototype) | ({ type: 'construction-robot' } & ConstructionRobotPrototype) | ({ type: 'container' } & ContainerPrototype) | ({ type: 'copy-paste-tool' } & CopyPasteToolPrototype) | ({ type: 'corpse' } & CorpsePrototype) | ({ type: 'curved-rail' } & CurvedRailPrototype) | ({ type: 'custom-input' } & CustomInputPrototype) | ({ type: 'damage-type' } & DamageType) | ({ type: 'decider-combinator' } & DeciderCombinatorPrototype) | ({ type: 'deconstruct-with-robots-achievement' } & DeconstructWithRobotsAchievementPrototype) | ({ type: 'deconstructible-tile-proxy' } & DeconstructibleTileProxyPrototype) | ({ type: 'deconstruction-item' } & DeconstructionItemPrototype) | ({ type: 'optimized-decorative' } & DecorativePrototype) | ({ type: 'deliver-by-robots-achievement' } & DeliverByRobotsAchievementPrototype) | ({ type: 'dont-build-entity-achievement' } & DontBuildEntityAchievementPrototype) | ({ type: 'dont-craft-manually-achievement' } & DontCraftManuallyAchievementPrototype) | ({ type: 'dont-use-entity-in-energy-production-achievement' } & DontUseEntityInEnergyProductionAchievementPrototype) | ({ type: 'editor-controller' } & EditorControllerPrototype) | ({ type: 'electric-energy-interface' } & ElectricEnergyInterfacePrototype) | ({ type: 'electric-pole' } & ElectricPolePrototype) | ({ type: 'electric-turret' } & ElectricTurretPrototype) | ({ type: 'unit-spawner' } & EnemySpawnerPrototype) | ({ type: 'energy-shield-equipment' } & EnergyShieldEquipmentPrototype) | ({ type: 'entity-ghost' } & EntityGhostPrototype) | ({ type: 'particle' } & EntityParticlePrototype) | ({ type: 'equipment-category' } & EquipmentCategory) | ({ type: 'equipment-grid' } & EquipmentGridPrototype) | ({ type: 'explosion' } & ExplosionPrototype) | ({ type: 'finish-the-game-achievement' } & FinishTheGameAchievementPrototype) | ({ type: 'fire' } & FireFlamePrototype) | ({ type: 'fish' } & FishPrototype) | ({ type: 'flame-thrower-explosion' } & FlameThrowerExplosionPrototype) | ({ type: 'fluid' } & FluidPrototype) | ({ type: 'stream' } & FluidStreamPrototype) | ({ type: 'fluid-turret' } & FluidTurretPrototype) | ({ type: 'fluid-wagon' } & FluidWagonPrototype) | ({ type: 'flying-text' } & FlyingTextPrototype) | ({ type: 'font' } & FontPrototype) | ({ type: 'fuel-category' } & FuelCategory) | ({ type: 'furnace' } & FurnacePrototype) | ({ type: 'gate' } & GatePrototype) | ({ type: 'generator-equipment' } & GeneratorEquipmentPrototype) | ({ type: 'generator' } & GeneratorPrototype) | ({ type: 'god-controller' } & GodControllerPrototype) | ({ type: 'group-attack-achievement' } & GroupAttackAchievementPrototype) | ({ type: 'gui-style' } & GuiStyle) | ({ type: 'gun' } & GunPrototype) | ({ type: 'heat-interface' } & HeatInterfacePrototype) | ({ type: 'heat-pipe' } & HeatPipePrototype) | ({ type: 'highlight-box' } & HighlightBoxEntityPrototype) | ({ type: 'infinity-container' } & InfinityContainerPrototype) | ({ type: 'infinity-pipe' } & InfinityPipePrototype) | ({ type: 'inserter' } & InserterPrototype) | ({ type: 'item-entity' } & ItemEntityPrototype) | ({ type: 'item-group' } & ItemGroup) | ({ type: 'item' } & ItemPrototype) | ({ type: 'item-request-proxy' } & ItemRequestProxyPrototype) | ({ type: 'item-subgroup' } & ItemSubGroup) | ({ type: 'item-with-entity-data' } & ItemWithEntityDataPrototype) | ({ type: 'item-with-inventory' } & ItemWithInventoryPrototype) | ({ type: 'item-with-label' } & ItemWithLabelPrototype) | ({ type: 'item-with-tags' } & ItemWithTagsPrototype) | ({ type: 'kill-achievement' } & KillAchievementPrototype) | ({ type: 'lab' } & LabPrototype) | ({ type: 'lamp' } & LampPrototype) | ({ type: 'land-mine' } & LandMinePrototype) | ({ type: 'leaf-particle' } & LeafParticlePrototype) | ({ type: 'linked-belt' } & LinkedBeltPrototype) | ({ type: 'linked-container' } & LinkedContainerPrototype) | ({ type: 'loader-1x1' } & Loader1x1Prototype) | ({ type: 'loader' } & Loader1x2Prototype) | ({ type: 'locomotive' } & LocomotivePrototype) | ({ type: 'logistic-container' } & LogisticContainerPrototype) | ({ type: 'logistic-robot' } & LogisticRobotPrototype) | ({ type: 'map-gen-presets' } & MapGenPresets) | ({ type: 'map-settings' } & MapSettings) | ({ type: 'market' } & MarketPrototype) | ({ type: 'mining-drill' } & MiningDrillPrototype) | ({ type: 'mining-tool' } & MiningToolPrototype) | ({ type: 'module-category' } & ModuleCategory) | ({ type: 'module' } & ModulePrototype) | ({ type: 'mouse-cursor' } & MouseCursor) | ({ type: 'movement-bonus-equipment' } & MovementBonusEquipmentPrototype) | ({ type: 'noise-expression' } & NamedNoiseExpression) | ({ type: 'night-vision-equipment' } & NightVisionEquipmentPrototype) | ({ type: 'noise-layer' } & NoiseLayer) | ({ type: 'offshore-pump' } & OffshorePumpPrototype) | ({ type: 'optimized-particle' } & ParticlePrototype) | ({ type: 'particle-source' } & ParticleSourcePrototype) | ({ type: 'pipe' } & PipePrototype) | ({ type: 'pipe-to-ground' } & PipeToGroundPrototype) | ({ type: 'player-damaged-achievement' } & PlayerDamagedAchievementPrototype) | ({ type: 'player-port' } & PlayerPortPrototype) | ({ type: 'power-switch' } & PowerSwitchPrototype) | ({ type: 'produce-achievement' } & ProduceAchievementPrototype) | ({ type: 'produce-per-hour-achievement' } & ProducePerHourAchievementPrototype) | ({ type: 'programmable-speaker' } & ProgrammableSpeakerPrototype) | ({ type: 'projectile' } & ProjectilePrototype) | ({ type: 'pump' } & PumpPrototype) | ({ type: 'radar' } & RadarPrototype) | ({ type: 'rail-chain-signal' } & RailChainSignalPrototype) | ({ type: 'rail-planner' } & RailPlannerPrototype) | ({ type: 'rail-remnants' } & RailRemnantsPrototype) | ({ type: 'rail-signal' } & RailSignalPrototype) | ({ type: 'reactor' } & ReactorPrototype) | ({ type: 'recipe-category' } & RecipeCategory) | ({ type: 'recipe' } & RecipePrototype) | ({ type: 'repair-tool' } & RepairToolPrototype) | ({ type: 'research-achievement' } & ResearchAchievementPrototype) | ({ type: 'resource-category' } & ResourceCategory) | ({ type: 'resource' } & ResourceEntityPrototype) | ({ type: 'roboport-equipment' } & RoboportEquipmentPrototype) | ({ type: 'roboport' } & RoboportPrototype) | ({ type: 'rocket-silo' } & RocketSiloPrototype) | ({ type: 'rocket-silo-rocket' } & RocketSiloRocketPrototype) | ({ type: 'rocket-silo-rocket-shadow' } & RocketSiloRocketShadowPrototype) | ({ type: 'selection-tool' } & SelectionToolPrototype) | ({ type: 'shortcut' } & ShortcutPrototype) | ({ type: 'simple-entity' } & SimpleEntityPrototype) | ({ type: 'simple-entity-with-force' } & SimpleEntityWithForcePrototype) | ({ type: 'simple-entity-with-owner' } & SimpleEntityWithOwnerPrototype) | ({ type: 'smoke' } & SimpleSmokePrototype) | ({ type: 'smoke-with-trigger' } & SmokeWithTriggerPrototype) | ({ type: 'solar-panel-equipment' } & SolarPanelEquipmentPrototype) | ({ type: 'solar-panel' } & SolarPanelPrototype) | ({ type: 'sound' } & SoundPrototype) | ({ type: 'spectator-controller' } & SpectatorControllerPrototype) | ({ type: 'speech-bubble' } & SpeechBubblePrototype) | ({ type: 'spider-leg' } & SpiderLegPrototype) | ({ type: 'spider-vehicle' } & SpiderVehiclePrototype) | ({ type: 'spidertron-remote' } & SpidertronRemotePrototype) | ({ type: 'splitter' } & SplitterPrototype) | ({ type: 'sprite' } & SpritePrototype) | ({ type: 'sticker' } & StickerPrototype) | ({ type: 'storage-tank' } & StorageTankPrototype) | ({ type: 'straight-rail' } & StraightRailPrototype) | ({ type: 'technology' } & TechnologyPrototype) | ({ type: 'tile-effect' } & TileEffectDefinition) | ({ type: 'tile-ghost' } & TileGhostPrototype) | ({ type: 'tile' } & TilePrototype) | ({ type: 'tips-and-tricks-item' } & TipsAndTricksItem) | ({ type: 'tips-and-tricks-item-category' } & TipsAndTricksItemCategory) | ({ type: 'tool' } & ToolPrototype) | ({ type: 'train-path-achievement' } & TrainPathAchievementPrototype) | ({ type: 'train-stop' } & TrainStopPrototype) | ({ type: 'transport-belt' } & TransportBeltPrototype) | ({ type: 'tree' } & TreePrototype) | ({ type: 'trigger-target-type' } & TriggerTargetType) | ({ type: 'trivial-smoke' } & TrivialSmokePrototype) | ({ type: 'turret' } & TurretPrototype) | ({ type: 'tutorial' } & TutorialDefinition) | ({ type: 'underground-belt' } & UndergroundBeltPrototype) | ({ type: 'unit' } & UnitPrototype) | ({ type: 'upgrade-item' } & UpgradeItemPrototype) | ({ type: 'utility-constants' } & UtilityConstants) | ({ type: 'utility-sounds' } & UtilitySounds) | ({ type: 'utility-sprites' } & UtilitySprites) | ({ type: 'virtual-signal' } & VirtualSignalPrototype) | ({ type: 'wall' } & WallPrototype) | ({ type: 'wind-sound' } & WindSound) | PrototypeBase
|
|
10108
|
+
type dataExtendType = ({ type: 'accumulator' } & AccumulatorPrototype) | ({ type: 'achievement' } & AchievementPrototype) | ({ type: 'active-defense-equipment' } & ActiveDefenseEquipmentPrototype) | ({ type: 'ambient-sound' } & AmbientSound) | ({ type: 'ammo-category' } & AmmoCategory) | ({ type: 'ammo' } & AmmoItemPrototype) | ({ type: 'ammo-turret' } & AmmoTurretPrototype) | ({ type: 'animation' } & AnimationPrototype) | ({ type: 'arithmetic-combinator' } & ArithmeticCombinatorPrototype) | ({ type: 'armor' } & ArmorPrototype) | ({ type: 'arrow' } & ArrowPrototype) | ({ type: 'artillery-flare' } & ArtilleryFlarePrototype) | ({ type: 'artillery-projectile' } & ArtilleryProjectilePrototype) | ({ type: 'artillery-turret' } & ArtilleryTurretPrototype) | ({ type: 'artillery-wagon' } & ArtilleryWagonPrototype) | ({ type: 'assembling-machine' } & AssemblingMachinePrototype) | ({ type: 'autoplace-control' } & AutoplaceControl) | ({ type: 'battery-equipment' } & BatteryEquipmentPrototype) | ({ type: 'beacon' } & BeaconPrototype) | ({ type: 'beam' } & BeamPrototype) | ({ type: 'belt-immunity-equipment' } & BeltImmunityEquipmentPrototype) | ({ type: 'blueprint-book' } & BlueprintBookPrototype) | ({ type: 'blueprint' } & BlueprintItemPrototype) | ({ type: 'boiler' } & BoilerPrototype) | ({ type: 'build-entity-achievement' } & BuildEntityAchievementPrototype) | ({ type: 'burner-generator' } & BurnerGeneratorPrototype) | ({ type: 'capsule' } & CapsulePrototype) | ({ type: 'car' } & CarPrototype) | ({ type: 'cargo-wagon' } & CargoWagonPrototype) | ({ type: 'character-corpse' } & CharacterCorpsePrototype) | ({ type: 'character' } & CharacterPrototype) | ({ type: 'cliff' } & CliffPrototype) | ({ type: 'combat-robot-count' } & CombatRobotCountAchievementPrototype) | ({ type: 'combat-robot' } & CombatRobotPrototype) | ({ type: 'constant-combinator' } & ConstantCombinatorPrototype) | ({ type: 'construct-with-robots-achievement' } & ConstructWithRobotsAchievementPrototype) | ({ type: 'construction-robot' } & ConstructionRobotPrototype) | ({ type: 'container' } & ContainerPrototype) | ({ type: 'copy-paste-tool' } & CopyPasteToolPrototype) | ({ type: 'corpse' } & CorpsePrototype) | ({ type: 'curved-rail' } & CurvedRailPrototype) | ({ type: 'custom-input' } & CustomInputPrototype) | ({ type: 'damage-type' } & DamageType) | ({ type: 'decider-combinator' } & DeciderCombinatorPrototype) | ({ type: 'deconstruct-with-robots-achievement' } & DeconstructWithRobotsAchievementPrototype) | ({ type: 'deconstructible-tile-proxy' } & DeconstructibleTileProxyPrototype) | ({ type: 'deconstruction-item' } & DeconstructionItemPrototype) | ({ type: 'optimized-decorative' } & DecorativePrototype) | ({ type: 'deliver-by-robots-achievement' } & DeliverByRobotsAchievementPrototype) | ({ type: 'dont-build-entity-achievement' } & DontBuildEntityAchievementPrototype) | ({ type: 'dont-craft-manually-achievement' } & DontCraftManuallyAchievementPrototype) | ({ type: 'dont-use-entity-in-energy-production-achievement' } & DontUseEntityInEnergyProductionAchievementPrototype) | ({ type: 'editor-controller' } & EditorControllerPrototype) | ({ type: 'electric-energy-interface' } & ElectricEnergyInterfacePrototype) | ({ type: 'electric-pole' } & ElectricPolePrototype) | ({ type: 'electric-turret' } & ElectricTurretPrototype) | ({ type: 'unit-spawner' } & EnemySpawnerPrototype) | ({ type: 'energy-shield-equipment' } & EnergyShieldEquipmentPrototype) | ({ type: 'entity-ghost' } & EntityGhostPrototype) | ({ type: 'particle' } & EntityParticlePrototype) | ({ type: 'equipment-category' } & EquipmentCategory) | ({ type: 'equipment-grid' } & EquipmentGridPrototype) | ({ type: 'explosion' } & ExplosionPrototype) | ({ type: 'finish-the-game-achievement' } & FinishTheGameAchievementPrototype) | ({ type: 'fire' } & FireFlamePrototype) | ({ type: 'fish' } & FishPrototype) | ({ type: 'flame-thrower-explosion' } & FlameThrowerExplosionPrototype) | ({ type: 'fluid' } & FluidPrototype) | ({ type: 'stream' } & FluidStreamPrototype) | ({ type: 'fluid-turret' } & FluidTurretPrototype) | ({ type: 'fluid-wagon' } & FluidWagonPrototype) | ({ type: 'flying-text' } & FlyingTextPrototype) | ({ type: 'font' } & FontPrototype) | ({ type: 'fuel-category' } & FuelCategory) | ({ type: 'furnace' } & FurnacePrototype) | ({ type: 'gate' } & GatePrototype) | ({ type: 'generator-equipment' } & GeneratorEquipmentPrototype) | ({ type: 'generator' } & GeneratorPrototype) | ({ type: 'god-controller' } & GodControllerPrototype) | ({ type: 'group-attack-achievement' } & GroupAttackAchievementPrototype) | ({ type: 'gui-style' } & GuiStyle) | ({ type: 'gun' } & GunPrototype) | ({ type: 'heat-interface' } & HeatInterfacePrototype) | ({ type: 'heat-pipe' } & HeatPipePrototype) | ({ type: 'highlight-box' } & HighlightBoxEntityPrototype) | ({ type: 'infinity-container' } & InfinityContainerPrototype) | ({ type: 'infinity-pipe' } & InfinityPipePrototype) | ({ type: 'inserter' } & InserterPrototype) | ({ type: 'item-entity' } & ItemEntityPrototype) | ({ type: 'item-group' } & ItemGroup) | ({ type: 'item' } & ItemPrototype) | ({ type: 'item-request-proxy' } & ItemRequestProxyPrototype) | ({ type: 'item-subgroup' } & ItemSubGroup) | ({ type: 'item-with-entity-data' } & ItemWithEntityDataPrototype) | ({ type: 'item-with-inventory' } & ItemWithInventoryPrototype) | ({ type: 'item-with-label' } & ItemWithLabelPrototype) | ({ type: 'item-with-tags' } & ItemWithTagsPrototype) | ({ type: 'kill-achievement' } & KillAchievementPrototype) | ({ type: 'lab' } & LabPrototype) | ({ type: 'lamp' } & LampPrototype) | ({ type: 'land-mine' } & LandMinePrototype) | ({ type: 'leaf-particle' } & LeafParticlePrototype) | ({ type: 'linked-belt' } & LinkedBeltPrototype) | ({ type: 'linked-container' } & LinkedContainerPrototype) | ({ type: 'loader-1x1' } & Loader1x1Prototype) | ({ type: 'loader' } & Loader1x2Prototype) | ({ type: 'locomotive' } & LocomotivePrototype) | ({ type: 'logistic-container' } & LogisticContainerPrototype) | ({ type: 'logistic-robot' } & LogisticRobotPrototype) | ({ type: 'map-gen-presets' } & MapGenPresets) | ({ type: 'map-settings' } & MapSettings) | ({ type: 'market' } & MarketPrototype) | ({ type: 'mining-drill' } & MiningDrillPrototype) | ({ type: 'mining-tool' } & MiningToolPrototype) | ({ type: 'module-category' } & ModuleCategory) | ({ type: 'module' } & ModulePrototype) | ({ type: 'mouse-cursor' } & MouseCursor) | ({ type: 'movement-bonus-equipment' } & MovementBonusEquipmentPrototype) | ({ type: 'noise-expression' } & NamedNoiseExpression) | ({ type: 'night-vision-equipment' } & NightVisionEquipmentPrototype) | ({ type: 'noise-layer' } & NoiseLayer) | ({ type: 'offshore-pump' } & OffshorePumpPrototype) | ({ type: 'optimized-particle' } & ParticlePrototype) | ({ type: 'particle-source' } & ParticleSourcePrototype) | ({ type: 'pipe' } & PipePrototype) | ({ type: 'pipe-to-ground' } & PipeToGroundPrototype) | ({ type: 'player-damaged-achievement' } & PlayerDamagedAchievementPrototype) | ({ type: 'player-port' } & PlayerPortPrototype) | ({ type: 'power-switch' } & PowerSwitchPrototype) | ({ type: 'produce-achievement' } & ProduceAchievementPrototype) | ({ type: 'produce-per-hour-achievement' } & ProducePerHourAchievementPrototype) | ({ type: 'programmable-speaker' } & ProgrammableSpeakerPrototype) | ({ type: 'projectile' } & ProjectilePrototype) | ({ type: 'pump' } & PumpPrototype) | ({ type: 'radar' } & RadarPrototype) | ({ type: 'rail-chain-signal' } & RailChainSignalPrototype) | ({ type: 'rail-planner' } & RailPlannerPrototype) | ({ type: 'rail-remnants' } & RailRemnantsPrototype) | ({ type: 'rail-signal' } & RailSignalPrototype) | ({ type: 'reactor' } & ReactorPrototype) | ({ type: 'recipe-category' } & RecipeCategory) | ({ type: 'recipe' } & RecipePrototype) | ({ type: 'repair-tool' } & RepairToolPrototype) | ({ type: 'research-achievement' } & ResearchAchievementPrototype) | ({ type: 'resource-category' } & ResourceCategory) | ({ type: 'resource' } & ResourceEntityPrototype) | ({ type: 'roboport-equipment' } & RoboportEquipmentPrototype) | ({ type: 'roboport' } & RoboportPrototype) | ({ type: 'rocket-silo' } & RocketSiloPrototype) | ({ type: 'rocket-silo-rocket' } & RocketSiloRocketPrototype) | ({ type: 'rocket-silo-rocket-shadow' } & RocketSiloRocketShadowPrototype) | ({ type: 'selection-tool' } & SelectionToolPrototype) | ({ type: 'shortcut' } & ShortcutPrototype) | ({ type: 'simple-entity' } & SimpleEntityPrototype) | ({ type: 'simple-entity-with-force' } & SimpleEntityWithForcePrototype) | ({ type: 'simple-entity-with-owner' } & SimpleEntityWithOwnerPrototype) | ({ type: 'smoke' } & SimpleSmokePrototype) | ({ type: 'smoke-with-trigger' } & SmokeWithTriggerPrototype) | ({ type: 'solar-panel-equipment' } & SolarPanelEquipmentPrototype) | ({ type: 'solar-panel' } & SolarPanelPrototype) | ({ type: 'sound' } & SoundPrototype) | ({ type: 'spectator-controller' } & SpectatorControllerPrototype) | ({ type: 'speech-bubble' } & SpeechBubblePrototype) | ({ type: 'spider-leg' } & SpiderLegPrototype) | ({ type: 'spider-vehicle' } & SpiderVehiclePrototype) | ({ type: 'spidertron-remote' } & SpidertronRemotePrototype) | ({ type: 'splitter' } & SplitterPrototype) | ({ type: 'sprite' } & SpritePrototype) | ({ type: 'sticker' } & StickerPrototype) | ({ type: 'storage-tank' } & StorageTankPrototype) | ({ type: 'straight-rail' } & StraightRailPrototype) | ({ type: 'technology' } & TechnologyPrototype) | ({ type: 'tile-effect' } & TileEffectDefinition) | ({ type: 'tile-ghost' } & TileGhostPrototype) | ({ type: 'tile' } & TilePrototype) | ({ type: 'tips-and-tricks-item' } & TipsAndTricksItem) | ({ type: 'tips-and-tricks-item-category' } & TipsAndTricksItemCategory) | ({ type: 'tool' } & ToolPrototype) | ({ type: 'train-path-achievement' } & TrainPathAchievementPrototype) | ({ type: 'train-stop' } & TrainStopPrototype) | ({ type: 'transport-belt' } & TransportBeltPrototype) | ({ type: 'tree' } & TreePrototype) | ({ type: 'trigger-target-type' } & TriggerTargetType) | ({ type: 'trivial-smoke' } & TrivialSmokePrototype) | ({ type: 'turret' } & TurretPrototype) | ({ type: 'tutorial' } & TutorialDefinition) | ({ type: 'underground-belt' } & UndergroundBeltPrototype) | ({ type: 'unit' } & UnitPrototype) | ({ type: 'upgrade-item' } & UpgradeItemPrototype) | ({ type: 'utility-constants' } & UtilityConstants) | ({ type: 'utility-sounds' } & UtilitySounds) | ({ type: 'utility-sprites' } & UtilitySprites) | ({ type: 'virtual-signal' } & VirtualSignalPrototype) | ({ type: 'wall' } & WallPrototype) | ({ type: 'wind-sound' } & WindSound) | settings.dataExtendType | PrototypeBase
|
|
10109
10109
|
}
|
package/index.d.ts
CHANGED
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
// Generated from JSON source https://lua-api.factorio.com/latest/runtime-api.json and https://lua-api.factorio.com/latest/prototype-api.json
|
|
4
4
|
// Definition source https://github.com/sguest/factorio-types
|
|
5
5
|
|
|
6
|
-
/// <reference path="./
|
|
6
|
+
/// <reference path="./src/core.d.ts" />
|
|
7
|
+
/// <reference path="./src/settings.d.ts" />
|
|
8
|
+
/// <reference path="./src/serpent.d.ts" />
|
|
9
|
+
/// <reference path="./src/lualib/noise.d.ts" />
|
|
7
10
|
/// <reference path="./dist/global.d.ts" />
|
|
8
11
|
/// <reference path="./dist/classes.d.ts" />
|
|
9
12
|
/// <reference path="./dist/concepts.d.ts" />
|
|
10
13
|
/// <reference path="./dist/defines.d.ts" />
|
|
11
14
|
/// <reference path="./dist/events.d.ts" />
|
|
12
|
-
/// <reference path="./dist/serpent.d.ts" />
|
|
13
15
|
/// <reference path="./dist/prototypes.d.ts" />
|
|
14
16
|
/// <reference path="./dist/types.d.ts" />
|
|
15
17
|
/// <reference types="lua-types/jit" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "factorio-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Typescript declarations for the Factorio mod API",
|
|
5
5
|
"main": "index.d.ts",
|
|
6
6
|
"repository": "https://github.com/sguest/factorio-types.git",
|
|
@@ -8,13 +8,11 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"validate": "tsc -p tsconfig.json",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"rebuild": "ts-node json_parser/parser.ts -clean && yarn run copy-source"
|
|
11
|
+
"build": "ts-node json_parser/parser.ts",
|
|
12
|
+
"rebuild": "ts-node json_parser/parser.ts -clean"
|
|
14
13
|
},
|
|
15
14
|
"devDependencies": {
|
|
16
15
|
"@types/node": "^15.12.2",
|
|
17
|
-
"cpy-cli": "^3.1.1",
|
|
18
16
|
"node-html-parser": "^1.1.16",
|
|
19
17
|
"ts-node": "^10.0.0",
|
|
20
18
|
"typescript": "^5.4.2",
|
|
@@ -23,6 +21,7 @@
|
|
|
23
21
|
"files": [
|
|
24
22
|
"index.d.ts",
|
|
25
23
|
"tsconfig.base.json",
|
|
24
|
+
"src/**/*.d.ts",
|
|
26
25
|
"dist/**/*.d.ts"
|
|
27
26
|
],
|
|
28
27
|
"factorioVersion": "1.1.107",
|
|
@@ -32,4 +31,4 @@
|
|
|
32
31
|
"peerDependencies": {
|
|
33
32
|
"typescript-to-lua": "^1.25.1"
|
|
34
33
|
}
|
|
35
|
-
}
|
|
34
|
+
}
|
package/{dist → src}/core.d.ts
RENAMED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
declare namespace table {
|
|
7
7
|
function deepcopy<T>(this: void, value: T): T;
|
|
8
|
+
function compare(this: void, table1: object | [], table2: object | []): boolean;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
declare const data: {
|
|
@@ -12,6 +13,11 @@ declare const data: {
|
|
|
12
13
|
extend(values: prototype.dataExtendType[]): void,
|
|
13
14
|
};
|
|
14
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Mapping of currently loaded mods to their version. Only exists at the data stage.
|
|
18
|
+
*/
|
|
19
|
+
declare const mods: { [key: string] : string}
|
|
20
|
+
|
|
15
21
|
declare const global: { [key: string]: any };
|
|
16
22
|
|
|
17
23
|
declare function log(str: runtime.LocalisedString): void;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/** @noSelfInFile */
|
|
2
|
+
/** @noResolution */
|
|
3
|
+
declare module "noise" {
|
|
4
|
+
interface tileProps {
|
|
5
|
+
x: prototype.NoiseVariable,
|
|
6
|
+
y: prototype.NoiseVariable,
|
|
7
|
+
distance: prototype.NoiseExpression,
|
|
8
|
+
tier: prototype.NoiseExpression,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface mapProps {
|
|
12
|
+
seed: prototype.NoiseVariable
|
|
13
|
+
width: prototype.NoiseVariable
|
|
14
|
+
height: prototype.NoiseVariable
|
|
15
|
+
starting_area_radius: prototype.NoiseVariable
|
|
16
|
+
segmentation_multiplier: prototype.NoiseVariable
|
|
17
|
+
terrace_elevation_offset: prototype.NoiseVariable
|
|
18
|
+
terrace_elevation_interval: prototype.NoiseVariable
|
|
19
|
+
/**
|
|
20
|
+
* Add this to your (presumably centered around 0) elevation to correct water coverage
|
|
21
|
+
*/
|
|
22
|
+
wlc_elevation_offset: prototype.NoiseVariable
|
|
23
|
+
/**
|
|
24
|
+
* minimum elevation to be applied to areas outside the starting lake *after* the offset
|
|
25
|
+
*/
|
|
26
|
+
wlc_elevation_minimum: prototype.NoiseVariable
|
|
27
|
+
water_level: prototype.NoiseVariable
|
|
28
|
+
finite_water_level: prototype.NoiseVariable
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type NoiseOperand = prototype.NoiseExpression | number;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Emitted as overloaded operator - `noise.add(x, y)` becomes `x + y`
|
|
35
|
+
*/
|
|
36
|
+
const add: LuaAddition<NoiseOperand, NoiseOperand, prototype.NoiseFunctionAdd>;
|
|
37
|
+
/**
|
|
38
|
+
* Emitted as overloaded operator - `noise.sub(x, y)` becomes `x - y`
|
|
39
|
+
*/
|
|
40
|
+
const sub: LuaSubtraction<NoiseOperand, NoiseOperand, prototype.NoiseFunctionSubtract>;
|
|
41
|
+
/**
|
|
42
|
+
* Emitted as overloaded operator - `noise.mul(x, y)` becomes `x * y`
|
|
43
|
+
*/
|
|
44
|
+
const mul: LuaMultiplication<NoiseOperand, NoiseOperand, prototype.NoiseFunctionMultiply>;
|
|
45
|
+
/**
|
|
46
|
+
* Emitted as overloaded operator - `noise.div(x, y)` becomes `x / y`
|
|
47
|
+
*/
|
|
48
|
+
const div: LuaDivision<NoiseOperand, NoiseOperand, prototype.NoiseFunctionDivide>;
|
|
49
|
+
/**
|
|
50
|
+
* Emitted as overloaded operator - `noise.unm(x)` becomes `-x`
|
|
51
|
+
*/
|
|
52
|
+
const unm: LuaNegation<NoiseOperand, prototype.NoiseFunctionSubtract>;
|
|
53
|
+
/**
|
|
54
|
+
* Emitted as overloaded operator - `noise.pow(x, y)` becomes `x ^ y`
|
|
55
|
+
*/
|
|
56
|
+
const pow: LuaPower<NoiseOperand, NoiseOperand, prototype.NoiseFunctionExponentiate>;
|
|
57
|
+
|
|
58
|
+
type NoiseNumberLike = prototype.NoiseNumber | number;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @customName var
|
|
62
|
+
* @noSelf
|
|
63
|
+
* This is named "var" in lua and will compile as such thanks to annotations. However, var is a reserved word in typescript
|
|
64
|
+
*/
|
|
65
|
+
function var_get(name: prototype.NoiseVariable['variable_name']): prototype.NoiseVariable
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param level number of levels up *from the caller* we want to take our location from, defaulting to 1.
|
|
70
|
+
*/
|
|
71
|
+
function csloc(level: number): { filename: string, line_number: number }
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 'to noise expression'
|
|
75
|
+
* turns simple values into noise expressions and adds a metatable so you can do arithmetic operations on noise expresssions
|
|
76
|
+
*/
|
|
77
|
+
function to_noise_expression(v: any, sloc: string): prototype.NoiseExpression
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Call this to...define a noise function using lua syntax.
|
|
81
|
+
* Your lua function will be passed x, y, tile properties, and map properties.
|
|
82
|
+
* The arguments are 'noise expression' objects to which arithmetic operations may be applied.
|
|
83
|
+
*/
|
|
84
|
+
function define_noise_function(callback: (x: prototype.NoiseVariable, y: prototype.NoiseVariable, tileProps: tileProps, mapProps: mapProps) => void): prototype.NoiseExpression
|
|
85
|
+
|
|
86
|
+
function clamp(v: NoiseNumberLike, min: NoiseNumberLike, max: NoiseNumberLike, sloc: string): prototype.NoiseFunctionClamp
|
|
87
|
+
|
|
88
|
+
function compile_time_log(...args: NoiseNumberLike[]): prototype.NoiseFunctionCompileTimeLog
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Useful for preventing tail-calls
|
|
92
|
+
* because we want to not lose part of the stacktrace
|
|
93
|
+
* in order that csloc() gives the desired result
|
|
94
|
+
*/
|
|
95
|
+
function ident(x: prototype.NoiseExpression): prototype.NoiseExpression
|
|
96
|
+
|
|
97
|
+
function min(...args: NoiseNumberLike[]): prototype.NoiseNumber
|
|
98
|
+
|
|
99
|
+
function max(...args: NoiseNumberLike[]): prototype.NoiseNumber
|
|
100
|
+
|
|
101
|
+
function ridge(v: NoiseNumberLike, min: NoiseNumberLike, max: NoiseNumberLike, sloc: string): prototype.NoiseFunctionRidge
|
|
102
|
+
|
|
103
|
+
function terrace(v: NoiseNumberLike, offset: prototype.ConstantNoiseNumber, width: prototype.ConstantNoiseNumber, strength: NoiseNumberLike): prototype.NoiseFunctionTerrace
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Terrace at elevations at which the game will place cliffs
|
|
107
|
+
* if change in elevation is steep enough.
|
|
108
|
+
* strength = 0: no-op; strength = 1: vertical slopes between terrace elevations
|
|
109
|
+
*/
|
|
110
|
+
function terrace_for_cliffs(
|
|
111
|
+
v: NoiseNumberLike,
|
|
112
|
+
strength: NoiseNumberLike,
|
|
113
|
+
map: {
|
|
114
|
+
terrace_elevation_offset: prototype.NoiseVariable,
|
|
115
|
+
terrace_elevation_interval: prototype.NoiseVariable
|
|
116
|
+
}): prototype.NoiseExpression
|
|
117
|
+
|
|
118
|
+
function make_array(list: any[]): prototype.NoiseExpression
|
|
119
|
+
|
|
120
|
+
function make_point_list(list: any[]): prototype.NoiseArrayConstruction
|
|
121
|
+
|
|
122
|
+
function distance_from(
|
|
123
|
+
maximum_distance: prototype.ConstantNoiseNumber | undefined,
|
|
124
|
+
points: prototype.NoiseArrayConstruction,
|
|
125
|
+
x: NoiseNumberLike,
|
|
126
|
+
y: NoiseNumberLike): prototype.NoiseFunctionDistanceFromNearestPoint
|
|
127
|
+
|
|
128
|
+
function get_control_setting(name: string): prototype.NoiseExpression
|
|
129
|
+
|
|
130
|
+
function absolute_value(val: NoiseNumberLike): prototype.NoiseFunctionAbsoluteValue
|
|
131
|
+
|
|
132
|
+
function autoplace_probabililty(autoplace: prototype.NoiseLiteralObject): prototype.NoiseFunctionAutoplaceProbability
|
|
133
|
+
|
|
134
|
+
function autoplace_richness(autoplace: prototype.NoiseLiteralObject): prototype.NoiseFunctionAutoplaceRichness
|
|
135
|
+
|
|
136
|
+
function fraction(num: NoiseNumberLike, den: NoiseNumberLike): prototype.NoiseNumber
|
|
137
|
+
|
|
138
|
+
function function_application(name: string, arguments: prototype.NoiseExpression[], sloc: string): prototype.NoiseFunctionApplication
|
|
139
|
+
|
|
140
|
+
function if_else_chain(...arugments: prototype.NoiseExpression[]): prototype.NoiseIfElseChain
|
|
141
|
+
|
|
142
|
+
function literal_expression(x: prototype.NoiseExpression): prototype.NoiseLiteralExpression
|
|
143
|
+
|
|
144
|
+
function literal_object(val: prototype.AutoplaceSpecification): prototype.NoiseLiteralObject
|
|
145
|
+
|
|
146
|
+
function literal_string(str: string, sloc: string): prototype.NoiseLiteralString
|
|
147
|
+
|
|
148
|
+
function noise_layer_name_to_id(name: prototype.NoiseLiteralString): prototype.NoiseFunctionNoiseLayerNameToID
|
|
149
|
+
|
|
150
|
+
function random(amplitude: prototype.ConstantNoiseNumber): prototype.NoiseFunctionRandomPenalty
|
|
151
|
+
|
|
152
|
+
function random_between(lower: NoiseNumberLike, upper: NoiseNumberLike): prototype.NoiseFunctionRandomPenalty
|
|
153
|
+
|
|
154
|
+
function random_penalty(source: NoiseNumberLike, random_penalty_amplitude: prototype.ConstantNoiseNumber, opts: prototype.RandomPenaltyArguments): prototype.NoiseFunctionRandomPenalty
|
|
155
|
+
|
|
156
|
+
function delimit_procedure(expression: prototype.NoiseExpression): prototype.NoiseProcedureDelimiter
|
|
157
|
+
|
|
158
|
+
function log2(power: NoiseNumberLike): prototype.NoiseFunctionLog2
|
|
159
|
+
|
|
160
|
+
function fmod(lhs: NoiseNumberLike, rhs: NoiseNumberLike): prototype.NoiseFunctionModulo
|
|
161
|
+
|
|
162
|
+
function floor(value: NoiseNumberLike): prototype.NoiseFunctionFloor
|
|
163
|
+
|
|
164
|
+
function ceil(value: NoiseNumberLike): prototype.NoiseFunctionCeil
|
|
165
|
+
|
|
166
|
+
function band(...arguments: NoiseNumberLike[]): prototype.NoiseFunctionBitwiseAnd
|
|
167
|
+
|
|
168
|
+
function bor(...arguments: NoiseNumberLike[]): prototype.NoiseFunctionBitwiseOr
|
|
169
|
+
|
|
170
|
+
function bxor(...arguments: NoiseNumberLike[]): prototype.NoiseFunctionBitwiseXor
|
|
171
|
+
|
|
172
|
+
function bnot(...arguments: NoiseNumberLike[]): prototype.NoiseFunctionBitwiseNot
|
|
173
|
+
|
|
174
|
+
function sin(value: NoiseNumberLike): prototype.NoiseFunctionSin
|
|
175
|
+
|
|
176
|
+
function cos(value: NoiseNumberLike): prototype.NoiseFunctionCos
|
|
177
|
+
|
|
178
|
+
function atan2(value: NoiseNumberLike): prototype.NoiseFunctionAtan2
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* This results in a number that is '0' for 'false' or '1' for 'true'.
|
|
182
|
+
*/
|
|
183
|
+
function less_than(lhs: NoiseNumberLike, rhs: NoiseNumberLike): prototype.NoiseFunctionLessThan
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* This results in a number that is '0' for 'false' or '1' for 'true'.
|
|
187
|
+
*/
|
|
188
|
+
function less_or_equal(lhs: NoiseNumberLike, rhs: NoiseNumberLike): prototype.NoiseFunctionLessOrEqual
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* This results in a number that is '0' for 'false' or '1' for 'true'.
|
|
192
|
+
*/
|
|
193
|
+
function equals(lhs: NoiseNumberLike, rhs: NoiseNumberLike): prototype.NoiseFunctionEquals
|
|
194
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
declare namespace settings {
|
|
2
|
+
type settingType =
|
|
3
|
+
/** This kind of seting is available in the prototype stage, and cannot be changed runtime. They have to be set to the same values for all players on a server.*/
|
|
4
|
+
'startup' |
|
|
5
|
+
/** This kind of setting is global to an entire save game and can be changed runtime. On servers, only admins can change these settings. */
|
|
6
|
+
'runtime-global' |
|
|
7
|
+
/** This kind of setting is only available runtime in the control.lua stage and each player has their own intance of this setting. When a player joins a server their local setting of "keep mod settings per save" determines if the local settings they have set are synced to the loaded save or if the save's settings are used. */
|
|
8
|
+
'runtime-per-user'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The base type for all settings. Defines common values
|
|
12
|
+
*/
|
|
13
|
+
interface SettingBase extends prototype.PrototypeBase {
|
|
14
|
+
/**
|
|
15
|
+
* The hidden property can be used to hide mod settings from GUIs, so that they cannot be seen or changed by players.
|
|
16
|
+
* However, other mods can still access hidden settings.
|
|
17
|
+
*/
|
|
18
|
+
hidden?: boolean
|
|
19
|
+
/**
|
|
20
|
+
* Determines the stage of game at which the setting is available and which tab it is shown in the mod settings menu.
|
|
21
|
+
*/
|
|
22
|
+
setting_type: settingType
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A true/false checkbox
|
|
27
|
+
*/
|
|
28
|
+
interface BoolSetting extends SettingBase {
|
|
29
|
+
/**
|
|
30
|
+
* Defines the default value of the setting, in this case whether the checkbox is checked or not.
|
|
31
|
+
*/
|
|
32
|
+
default_value: boolean
|
|
33
|
+
/**
|
|
34
|
+
* Only loadoed if `hidden = true`. This forces the setting to be of this value. This can be useful for mod compatibility.
|
|
35
|
+
*/
|
|
36
|
+
forced_value?: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A signed 64 bit integer textfield (or selection dropdown)
|
|
41
|
+
*/
|
|
42
|
+
interface IntSetting extends SettingBase {
|
|
43
|
+
/**
|
|
44
|
+
* Defines the value of the setting.
|
|
45
|
+
*/
|
|
46
|
+
default_value: number
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Defines the lowest possible number.
|
|
50
|
+
*/
|
|
51
|
+
minimum_value?: number
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Defines the highest possible number.
|
|
55
|
+
*/
|
|
56
|
+
maximum_value?: number
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a textfield.
|
|
60
|
+
* If only one allowed value is given, the setting is forced to be of that value.
|
|
61
|
+
*/
|
|
62
|
+
allowed_values?: number[]
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A double precision floating point textfield (or selection dropdown)
|
|
67
|
+
*/
|
|
68
|
+
interface DoubleSetting extends SettingBase {
|
|
69
|
+
/**
|
|
70
|
+
* Defines the value of the setting.
|
|
71
|
+
*/
|
|
72
|
+
default_value: number
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Defines the lowest possible number.
|
|
76
|
+
*/
|
|
77
|
+
minimum_value?: number
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Defines the highest possible number.
|
|
81
|
+
*/
|
|
82
|
+
maximum_value?: number
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Makes it possible to force the player to choose between the defined numbers, creates a dropdown instead of a textfield.
|
|
86
|
+
* If only one allowed value is given, the setting is forced to be of that value.
|
|
87
|
+
*/
|
|
88
|
+
allowed_values?: number[]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A string textfield (or selection dropdown)
|
|
93
|
+
*/
|
|
94
|
+
interface StringSetting extends SettingBase {
|
|
95
|
+
/**
|
|
96
|
+
* Defines the default value of the setting.
|
|
97
|
+
*/
|
|
98
|
+
default_value: string
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Defines whether it's possible for the user to set the textfield to empty and apply the setting.
|
|
102
|
+
*/
|
|
103
|
+
allow_blank?: boolean
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Whether values that are input by the user should have whitespace removed from both ends of the string.
|
|
107
|
+
*/
|
|
108
|
+
auto_trim?: boolean
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Makes it possible to force the player to choose between the defined strings, creates a dropdown instead of a textfield. The strings in the dropdown can be localized (translated) and can have a tooltip
|
|
112
|
+
* If only one allowed value is given, the setting is forced to be of that value.
|
|
113
|
+
*/
|
|
114
|
+
allowed_values?: string[]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* A color picker (sliders), with whole number textfields. Includes alpha.
|
|
119
|
+
*/
|
|
120
|
+
interface ColorSetting extends SettingBase {
|
|
121
|
+
/**
|
|
122
|
+
* Defines the default value of the setting.
|
|
123
|
+
*/
|
|
124
|
+
default_value: prototype.Color
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
type dataExtendType =
|
|
128
|
+
({ type: 'bool-setting' } & BoolSetting) |
|
|
129
|
+
({ type: 'int-setting' } & IntSetting) |
|
|
130
|
+
({ type: 'double-setting' } & DoubleSetting) |
|
|
131
|
+
({ type: 'string-setting' } & StringSetting) |
|
|
132
|
+
({ type: 'color-setting' } & ColorSetting)
|
|
133
|
+
}
|
package/tsconfig.base.json
CHANGED
|
File without changes
|