Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/system/ComponentManager.h
/* Copyright (C) 2022 Wildfire Games. | /* Copyright (C) 2023 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Send a message, not targeted at any particular entity. The message will be received by any | * Send a message, not targeted at any particular entity. The message will be received by any | ||||
* components that subscribed (either globally or not) to the message type. | * components that subscribed (either globally or not) to the message type. | ||||
*/ | */ | ||||
void BroadcastMessage(const CMessage& msg); | void BroadcastMessage(const CMessage& msg); | ||||
/** | /** | ||||
* Send a MT_ValueModification message, targeted at a particular entity. | |||||
* The message will be received by the specific modified components of all entities, | |||||
* then sent as a general message. | |||||
*/ | |||||
void PostValueModification(entity_id_t ent, const CMessage& msg); | |||||
/** | |||||
* Resets the dynamic simulation state (deletes all entities, resets entity ID counters; | * Resets the dynamic simulation state (deletes all entities, resets entity ID counters; | ||||
* doesn't unload/reload component scripts). | * doesn't unload/reload component scripts). | ||||
*/ | */ | ||||
void ResetState(); | void ResetState(); | ||||
/** | /** | ||||
* Initializes the random number generator with a seed determined by the host. | * Initializes the random number generator with a seed determined by the host. | ||||
*/ | */ | ||||
Show All 19 Lines | private: | ||||
void Script_ReRegisterComponentType(int iid, const std::string& cname, JS::HandleValue ctor); | void Script_ReRegisterComponentType(int iid, const std::string& cname, JS::HandleValue ctor); | ||||
void Script_RegisterInterface(const std::string& name); | void Script_RegisterInterface(const std::string& name); | ||||
void Script_RegisterMessageType(const std::string& name); | void Script_RegisterMessageType(const std::string& name); | ||||
void Script_RegisterGlobal(const std::string& name, JS::HandleValue value); | void Script_RegisterGlobal(const std::string& name, JS::HandleValue value); | ||||
std::vector<int> Script_GetEntitiesWithInterface(int iid); | std::vector<int> Script_GetEntitiesWithInterface(int iid); | ||||
std::vector<IComponent*> Script_GetComponentsWithInterface(int iid); | std::vector<IComponent*> Script_GetComponentsWithInterface(int iid); | ||||
void Script_PostMessage(int ent, int mtid, JS::HandleValue data); | void Script_PostMessage(int ent, int mtid, JS::HandleValue data); | ||||
void Script_BroadcastMessage(int mtid, JS::HandleValue data); | void Script_BroadcastMessage(int mtid, JS::HandleValue data); | ||||
void Script_PostValueModification(int ent, JS::HandleValue data); | |||||
int Script_AddEntity(const std::wstring& templateName); | int Script_AddEntity(const std::wstring& templateName); | ||||
int Script_AddLocalEntity(const std::wstring& templateName); | int Script_AddLocalEntity(const std::wstring& templateName); | ||||
const CParamNode& Script_GetTemplate(const std::string& templateName); | const CParamNode& Script_GetTemplate(const std::string& templateName); | ||||
CMessage* ConstructMessage(int mtid, JS::HandleValue data); | CMessage* ConstructMessage(int mtid, JS::HandleValue data); | ||||
void SendGlobalMessage(entity_id_t ent, const CMessage& msg); | void SendGlobalMessage(entity_id_t ent, const CMessage& msg); | ||||
void FlattenDynamicSubscriptions(); | void FlattenDynamicSubscriptions(); | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator