Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book/
12 changes: 11 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Summary

- [Chapter 1](./chapter_1.md)
- [Contributor Guide](./contributor-guide.md)
- [Internal APIs](./internal_apis/README.md)
- [PyPostProcessing Data Stage](./internal_apis/pypostprocessing/data_stage.md)
- [Item](./internal_apis/pypostprocessing/item.md)
- [Entity](./internal_apis/pypostprocessing/entity.md)
- [Fluid](./internal_apis/pypostprocessing/fluid.md)
- [Recipe](./internal_apis/pypostprocessing/recipe.md)
- [Technology](./internal_apis/pypostprocessing/technology.md)
- [Tile](./internal_apis/pypostprocessing/tile.md)
- [Special APIs](./special_apis/README.md)
- [Digosaurs](./special_apis/digosaurs.md)
48 changes: 48 additions & 0 deletions src/contributor-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Contributor Guide

### How to commit

List of good resources to find out what to do:
- [Good first Issues](https://github.com/pyanodon/pybugreports/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22)
- [Py Roadmap](https://github.com/orgs/pyanodon/projects/2/views/4)

How can I contribute?
1. Clone the repo you want to commit to
2. Create a new branch off of main
3. Create the changes you want to add
4. Create a pull request describing what you fixed or what you're adding, for simple bug reports you can just say “Fixes <issue link>”
5. Wait for approval
6. Make changes if needed
7. Boom dopamine

### General Layout

We have 2 branches for different updates: Master or Main and Breaking Changes
- Main or Master is used for bug fixes, general fixes, or non-removing enhancements.
- Breaking changes is used for breaking changes like changing the output of a recipe to have a new byproduct.

The codebase will look something like this typically
```
pytesting
├── control.lua
├── data.lua
├── scripts
│ └── example.lua
└── prototypes
├── buildings
│ └── example-building.lua
├── items
│ └── items.lua
├── recipes
│ └── recipes.lua
└── technologies
└── exmple-technology.lua
```

### Frequently Asked Questions

Where are pypostprocessing functions located at?

`pypostprocessing/lib` for in-general stuff<br>
`pypostprocessing/lib/metas` for prototyping functions<br>
`pypostprocessing/lib/events` for control event functions
3 changes: 3 additions & 0 deletions src/internal_apis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Internal APIs

Internal APIs are things like `pypostprocessing` functions.
8 changes: 8 additions & 0 deletions src/internal_apis/pypostprocessing/data_stage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# PyPostProcessing Data Stage

- [Item](./item.md) Information about the `ITEM` function.
- [Entity](./entity.md) Information about the `ENTITY` function.
- [Fluid](./fluid.md) Information about the `FLUID` function.
- [Recipe](./recipe.md) Information about the `RECIPE` function.
- [Technology](./technology.md) Information about the `TECHNOLOGY` function.
- [Tile](./tile.md) Information about the `TILE` function.
46 changes: 46 additions & 0 deletions src/internal_apis/pypostprocessing/entity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Entity
```lua
---@class data.EntityPrototype
---@field public standardize fun(self: data.EntityPrototype): data.EntityPrototype
---@field public add_flag fun(self: data.EntityPrototype, flag: string): data.EntityPrototype
---@field public remove_flag fun(self: data.EntityPrototype, flag: string): data.EntityPrototype
---@field public has_flag fun(self: data.EntityPrototype, flag: string): boolean
```

## Example Usage
`ENTITY` function can be used like this to create a new entity:
```lua
ENTITY {
type = "assembling-machine",
name = "example-entity",
icon = "__pyexample__/graphics/icons/example.png",
icon_size = 64,
...
}
```
It can also be used to get an existing entity:
```lua
ENTITY("example-entity")
```

## Entity Functions
### Add Flag
`@field public add_flag fun(self: data.EntityPrototype, flag: string): data.EntityPrototype`
```lua
local flag = "placeable-by-player"
ENTITY("example-item"):add_flag(flag)
```

### Remove Flag
`@field public remove_flag fun(self: data.EntityPrototype, flag: string): data.EntityPrototype`
```lua
local flag = "placeable-by-player"
ENTITY("example-item"):remove_flag(flag)
```

### Has Flag
`@field public has_flag fun(self: data.EntityPrototype, flag: string): boolean`
```lua
local flag = "placeable-by-player"
local has_flag = ENTITY("example-item"):has_flag(flag)
```
12 changes: 12 additions & 0 deletions src/internal_apis/pypostprocessing/fluid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Fluid
`FLUID` can be used like so:
```lua
FLUID{
type = "fluid",
name = "example-fluid"
}
```
You can also use it to get existing fluids
```lua
FLUID("example-fluid")
```
54 changes: 54 additions & 0 deletions src/internal_apis/pypostprocessing/item.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Items
```lua
---@class data.ItemPrototype
---@field public add_flag fun(self: data.ItemPrototype, flag: string): data.ItemPrototype
---@field public remove_flag fun(self: data.ItemPrototype, flag: string): data.ItemPrototype
---@field public has_flag fun(self: data.ItemPrototype, flag: string): boolean
---@field public spoil fun(self: data.ItemPrototype, spoil_result: (string | table), spoil_ticks: number): data.ItemPrototype
```

## Example Usage
`ITEM` function can be used like this to create a new item:
```lua
ITEM {
type = "item",
name = "example-item",
icon = "__pyexample__/graphics/icons/example.png",
icon_size = 64,
stack_size = 50
}
```
It can also be used like this to get an existing item:
```lua
ITEM("example-item")
```

## Item Functions
### Spoil
`@field public spoil fun(self: data.ItemPrototype, spoil_result: (string | table), spoil_ticks: number): data.ItemPrototype`
```lua
local spoil_result = "iron-plate"
local spoil_ticks = 5 * 60 -- 5 Seconds
ITEM("example-item"):spoil(spoil_result, spoil_ticks)
```

### Add Flag
`@field public add_flag fun(self: data.ItemPrototype, flag: string): data.ItemPrototype`
```lua
local flag = "placeable-by-player"
ITEM("example-item"):add_flag(flag)
```

### Remove Flag
`@field public remove_flag fun(self: data.ItemPrototype, flag: string): data.ItemPrototype`
```lua
local flag = "placeable-by-player"
ITEM("example-item"):remove_flag(flag)
```

### Has Flag
`@field public has_flag fun(self: data.ItemPrototype, flag: string): boolean`
```lua
local flag = "placeable-by-player"
local has_flag = ITEM("example-item"):has_flag(flag)
```
Loading
Loading