Skip to content

Commit

Permalink
Add action0x00 and act.0 stations
Browse files Browse the repository at this point in the history
  • Loading branch information
WenSimEHRP committed Oct 6, 2024
1 parent 173c801 commit 95c8c62
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
36 changes: 36 additions & 0 deletions docs/newgrf/actions/_action_0x00.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Action0x00 物品特性

Action0x00 可以用来定义新的物品,或是修改现有物品的属性。
物品即为游戏中的载具、车站、物件(Object)等。
每项物品有独特的属性,你可以在子页面找到物品的属性列表与解释。

```{toctree}
:glob:
:titlesonly:
./action0x00/*
```

## 语法

Action0x00 在 yagl 中使用 `properties` 呈现。

```cpp
// 1145 在这里表示任意值
// 此处定义的为车站
properties<Stations, 0x1145> // Action00
{
// instance_id: 0x1145
// 具体属性与对应数值
{
class_id: "1145";
station_name_id: 0x1145;
can_train_enter_tile: 0x11;
pylon_placement: 0x11;
overhead_wire_placement: 0x11;
little_lots_threshold: 0x1145;
general_flags: 0x11;
cargo_type_triggers: 0x11451145;
}
}
```
62 changes: 62 additions & 0 deletions docs/newgrf/actions/action0x00/station.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 车站

| 序号 | 大小 | 版本 | 描述 |
|------|------|------|------------------------------------|
| 08 | D | 0.6 | 类别 ID |
| 09 | V | 0.6 | 图像布局 |
| 0A | B/B* | 0.6 | 复制图像布局 |
| 0B | B | 0.6 | 回调标志 |
| 0C | B | 0.6 | 禁用站台数量掩码 |
| 0D | B | 0.6 | 禁用站台长度掩码 |
| 0E | V | 0.6 | 自定义布局 |
| 0F | B/B* | 0.6 | 从参数给定的车站 ID 复制自定义布局 |
| 10 | W | 0.6 | 车站货物少量/大量阈值 |
| 11 | B | 0.6 | 接触网杆设置 |
| 12 | D | 0.6 | 触发随机化的货物类别 |
| 13 | B | 0.6 | 一般标志 |
| 14 | B | 0.6 | 接触网设置 |
| 15 | B | 0.6 | 列车是否可以通过车站格 |
| 16 | W | 0.7 | 动画信息 |
| 17 | B | 0.7 | 动画速度 |
| 18 | W | 0.7 | 动画触发条件 |
| 1A | V | 1.2 | 高级图像布局(带临时变量) |
| 1B | | | 预留 |
| 1C | W | 14 | 车站名称指针 |
| 1D | W | 14 | 类别名称指针 |
| 1E | V | 15 | 车站图像布局标识 |

## 车站名称(1C)

OpenTTD 14 提供了车站属性 1C,允许用新方式指定车站名称。
在 OTTD 14 以前,车站名称是使用特定的 Action0x04 编号实现的(0xC500—0xC5FF)。

1C 的数值是一个指向 Action0x04 的指针。这个 Action0x04 当中的文本将作为车站名称使用。
此处指定的 Action0x04 编号必须在 0xDC00—0xFFFF 区间内。

## 类别名称(1D)

1D 与 1C 极其相似。

OpenTTD 14 提供了车站属性 1D,允许用新方式指定类别名称。
在 OTTD 14 以前,车站名称是使用特定的 Action0x04 编号实现的(0xC400—0xC4FF)。

1D 的数值是一个指向 Action0x04 的指针。这个 Action0x04 当中的文本将作为类别名称使用。
此处指定的 Action0x04 编号必须在 0xDC00—0xFFFF 区间内。

### 样例

```cpp
strings<Stations, default, 0xDC00> // Action04
{
/* 0xDC00 */ "My station class";
/* 0xDC01 */ "My station name";
}

properties<Stations, 0x0001> // Action00
{
{
station_name_id: 0xDC01; // 1C
class_name_id: 0xDC00; // 1D
}
}
```
2 changes: 1 addition & 1 deletion docs/newgrf/actions_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ flowchart LR
[^nml]: NML 采用不同的代码组织方式,
不涉及 Action。

为了讲解简便,本教程中 Action 代码演示统一使用 YAGL 语言。你也可以访问 <https://www.tt-wiki.net> 以查看 NFO 样例[^examples]
为了讲解简便,本教程中 Action 代码演示统一使用 YAGL 语言。你也可以访问 <https://newgrf-specs.tt-wiki.net/wiki/Main_Page> 以查看 NFO 样例[^examples]

[^examples]: 大部分页面未有样例

Expand Down

0 comments on commit 95c8c62

Please sign in to comment.