this post should give some basic description how to create and/or modify levels and the game. This describes the current state in the game, and many things are very ligkely to be changed in future, so we cannot ensure any backwards compatibility.
There are two types of files which allow easy modifications:
- .json files describe the game objects and their properties. For example the furnace object is described by this file:
Using these files, you can modify recipes, and some behavior of the objects. It is limited mostly to simple modifications and changing numbers.
Code: Select all
{ "type": "furnace", "name": "stone-furnace", "flags": ["placeable-neutral", "player-creation"], "collision-box": [[-0.7, -0.7], [0.7, 0.7]], "selection-box": [[-0.8, -1], [0.8, 1]], "minable": { "mining-time": 1, "result": "stone-furnace"}, "max-health": 20, "source-inventory-size": 1, "result-inventory-size": 1, "burner": { "heat-capacity": 100, "heat-loss": 0.01, "heat-transport-speed": 0.005, "burning-speed": 0.001, "effectivity": 1000, "fuel-inventory-size": 1, "smoke": [ { "name": "smoke", "frequency": 0.5, "deviation": [0.1, 0.1], "position": [0, -2.3] } ] }, "picture": { "filename": "entity/stone-furnace/stone-furnace.png", "priority": "extra-high", "width": 96, "height": 96 }, "fire-animation": { "filename": "entity/stone-furnace/stone-furnace-fire.png", "priority": "extra-high", "frame-width": 18, "frame-height": 17, "frame-count": 16 }, "drawing-position": [0.35, -0.1], "fire-drawing-position": [-0.021875, 0.5234375], "drawing-scale": 0.7 },
- .lua files describe behavior of the level. You can script events such as attacks of enemies or starting position. There is an interface to the C++ code which allow you to call some functions of the game.
For example, if you want to remove the creeper attacks in the 3rd demo level, you can just delete the following lines in the control.lua file:And if you want to modify it in some existing save game, you can remove it from the control.lua file from the save game.Code: Select all
game.setmulticommand({type=defines.command.attack, target=glob.player, distraction=defines.distraction.byenemy}, glob.attackcount)