载入中...
搜索中...
未找到
eve::economy::GatherNode类 参考
地图上的资源节点:储量、再生、采集槽位。 更多...
#include <GatherNode.h>
Public 成员函数 | |
| GatherNode (std::string type, int capacity, int workerSlots=1, int regenPerTick=0) | |
| Gather node. | |
| std::string | resourceType () const |
| 资源类型 id。 | |
| int | amount () const |
| 当前储量。 | |
| int | capacity () const |
| 总储量。 | |
| bool | depleted () const |
| 是否已采空。 | |
| int | extract (int amount) |
| 尝试取出 amount;返回实际取出量(不超过当前储量)。 | |
| bool | tryOccupySlot () |
| 占用一个采集槽位;无空位返回 false。 | |
| void | releaseSlot () |
| 释放一个采集槽位。 | |
| int | freeSlots () const |
| 剩余空槽数。 | |
| void | regenTick () |
| 每 tick 再生(Growing/Renewable 模型)。 | |
| void | destroy () |
| 脚本生命周期入口。 | |
详细描述
地图上的资源节点:储量、再生、采集槽位。
在文件 GatherNode.h 第 12 行定义.
构造及析构函数说明
◆ GatherNode()
| eve::economy::GatherNode::GatherNode | ( | std::string | type, |
| int | capacity, | ||
| int | workerSlots = 1, |
||
| int | regenPerTick = 0 |
||
| ) |
Gather node.
- 参数
-
type 资源类型 id(须已在注册表中)。 capacity 总储量。 workerSlots 同时采集槽位上限(>0)。 regenPerTick 每 tick 再生量(0=不再生)。
在文件 GatherNode.cpp 第 10 行定义.
引用了 capacity() , 以及 EV_PARAM_CHECK.
成员函数说明
◆ amount()
| int eve::economy::GatherNode::amount | ( | ) | const |
◆ capacity()
| int eve::economy::GatherNode::capacity | ( | ) | const |
◆ depleted()
| bool eve::economy::GatherNode::depleted | ( | ) | const |
◆ destroy()
| void eve::economy::GatherNode::destroy | ( | ) |
脚本生命周期入口。
在文件 GatherNode.cpp 第 54 行定义.
◆ extract()
| int eve::economy::GatherNode::extract | ( | int | amount | ) |
尝试取出 amount;返回实际取出量(不超过当前储量)。
在文件 GatherNode.cpp 第 29 行定义.
引用了 amount().
被这些函数引用 eve::economy::Collector::tick().
◆ freeSlots()
| int eve::economy::GatherNode::freeSlots | ( | ) | const |
剩余空槽数。
在文件 GatherNode.cpp 第 47 行定义.
◆ regenTick()
| void eve::economy::GatherNode::regenTick | ( | ) |
每 tick 再生(Growing/Renewable 模型)。
在文件 GatherNode.cpp 第 49 行定义.
◆ releaseSlot()
| void eve::economy::GatherNode::releaseSlot | ( | ) |
释放一个采集槽位。
在文件 GatherNode.cpp 第 42 行定义.
引用了 EV_ASSERT.
被这些函数引用 eve::economy::Collector::assign() , 以及 eve::economy::Collector::clearAssignment().
◆ resourceType()
| std::string eve::economy::GatherNode::resourceType | ( | ) | const |
资源类型 id。
在文件 GatherNode.cpp 第 21 行定义.
◆ tryOccupySlot()
| bool eve::economy::GatherNode::tryOccupySlot | ( | ) |
占用一个采集槽位;无空位返回 false。
在文件 GatherNode.cpp 第 36 行定义.
该类的文档由以下文件生成:
- src/modules/economy/GatherNode.h
- src/modules/economy/GatherNode.cpp