瓦解核心:非原子单位 | Brea:Nonatomic
概述
Nonatomic Lib(非原子库)允许玩家在游戏中部署操作员(Operator)。操作员对应于操作员实体,玩家可以部署它们来执行各种任务。
该库为整个操作员系统提供了一系列常用功能:
- 操作员自定义:允许对多种类型的操作员进行自定义,每种操作员都具有独特的属性和行为。
- 操作员信息存储:除了可自定义的属性外,操作员还具备存储可变且持久化信息的能力。
- 实体与信息通信:操作员实体与其信息引用相互关联,并通过适当的清理和刷新机制确保同步与状态正常。
- 玩家行为处理:特殊的玩家行为会影响实体状态,以确保功能正常运行,包括登录、登出、传送等。
- 事件监听:模组会监听游戏事件,例如玩家登录、登出以及操作员的部署与回收,以增强灵活性。
代码框架
理想情况下,我们可以直接将数据绑定到维度以实现统一管理——这能确保玩家在离线时操作员数据的引用得以保留,并避免因玩家数据过多而导致的崩溃。
数据结构大致如下,从宏观到微观排列:
- 世界数据存储。我们不提供此层级的标准规范,但提供了
GroupProvider 接口(见文末),以便方便地处理玩家和实体相关事件。
- 玩家操作员数据 (
OpeHandler)
存储玩家拥有的操作员数据及已部署的操作员列表。由于一个玩家在不同模组实现下可能拥有多个操作员数据,你需要配置合适的 ContainerId,以确保实体在加载时能正确捕获对应的数据。有关数据捕获,请参考 FindOperatorEvent。
如果实现了第一步中提到的 GroupProvider 并进行注册,相关事件将自动处理。
- 操作员 (
Operator)
是能够被操作员实体直接捕获和引用的单元,负责存储操作员信息。其中包括与部署、撤回、合法性检查等基本操作员行为相关的方法,以及操作员类型、状态、上次记录位置等基本信息的获取。只要实体存在且已加载,被引用的操作员实体就不会为空。
- 操作员数据 (
OperatorInfo)
负责存储关于操作员的附加信息。如有需要,操作员实体可以存储类似类型的信息,并在适当时机请求合并,以实现临时信息功能。
你可以参考 TestObjects 类查看我们的测试代码。
在主类的 TestObjects#initTest 方法将被激活——请记得在使用后将其移除。
你也可以查看 EventHooks 中提供的事件。
每个事件类都包含关于其用法的 Javadoc 文档。
此外,你还可以参考我们的 TEST_LIST,以查看和验证在正确配置下可以自动实现的功能。
贡献
我们欢迎对 Nonatomic 模组的贡献。你可以通过提交 Issue 来报告问题,或 Fork 本项目以提交你的改进。
开发者
瓦解核心:非原子单位 | Brea:Nonatomic
Overview
The Nonatomic Lib allows players to deploy Operators in the game. Operators correspond to Operator entities, and players
can deploy them to perform various tasks.
This library provides a range of commonly used features for the entire Operator system:
- Operator Customization: Allows the customization of various types of Operators, each with unique attributes and
behaviors.
- Operator Information Storage: In addition to customizable attributes, Operators have the capability to store
mutable and persistent information.
- Entity and Information Communication: Operator entities and their information reference each other, with
appropriate clearing and refreshing to ensure synchronization and proper status.
- Player Behavior Handling: Special player behaviors affect entity states to ensure proper functionality, including
login, logout, teleportation, etc.
- Event Listening: The mod listens to game events, such as player login, logout, and the deployment and retrieval of
Operators, to enhance flexibility.
Code Framework
Ideally, we can directly bind data to dimensions for unified management—this ensures that Operator data references are
maintained when players are offline and avoids crashes due to excessive player data.
The data structure is roughly as follows, from broadest to most specific:
- World Data Storage. We do not provide a standard for this level,
but we offer
the
GroupProvider interface (see at the bottom)
for convenient handling of player and entity events.
- Player Operator Data (
OpeHandler)
Stores data on Operators owned by a player and a list of deployed Operators. Since a player might have multiple
Operator data under different mod implementations, you need to configure the appropriate ContainerId
to ensure the entity correctly captures the corresponding data upon loading. For data capturing, refer
to FindOperatorEvent.
If the GroupProvider mentioned in the first step is implemented and registered, related events can be automatically
handled.
- Operator (
Operator)
Is the unit that can be directly captured and referenced by the Operator entity and is responsible for storing
Operator information. This includes methods related to basic Operator behaviors such as deployment, withdrawal,
legality checks, as well as basic information such as Operator type, status, last recorded position, etc. The
referenced Operator entities will not be null as long as the entity exists and is loaded.
- Operator Data (
OperatorInfo)
Responsible for storing additional information about Operators. If needed, Operator entities can store similar types
of information and request merging at appropriate times to implement temporary information functionality.
You can refer to the TestObjects class to see our
test code.
Calling the TestObjects#initTest method in the mod's main class will activate it—don't forget to remove it afterward.
You can also view the provided events in EventHooks.
Each event class contains javadoc content about its usage.
Additionally, you can refer to our TEST_LIST to see and verify the features that can be
automatically implemented under correct configurations.
Contributing
We welcome contributions to the Nonatomic mod. You can submit Issues to report problems or Fork this project to submit
your improvements.
Developer
- Mon-landis: Provides technical support and development.
评论 0
登录后参与评分
还没有评论,来抢沙发吧