载入中...
搜索中...
未找到
Warship.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
11#include "common/Module.h"
12#include "common/Result.h"
14
15#include <string>
16
17namespace eve::warship {
18
21public:
23 Warship() = default;
24 ~Warship() override = default;
25
27 [[nodiscard]] Result<int> registerHullsFromJson(const std::string& json);
29 [[nodiscard]] Result<int> registerFunctionsFromJson(const std::string& json);
30 void clearHullDefinitions();
31 void clearFunctionDefinitions();
32 [[nodiscard]] bool hasHullDefinition(const std::string& id) const;
33 [[nodiscard]] bool hasFunctionDefinition(const std::string& id) const;
34 [[nodiscard]] int getHullDefinitionCount() const;
35 [[nodiscard]] int getFunctionDefinitionCount() const;
36 [[nodiscard]] std::string getHullDefinitionCategory(const std::string& id) const;
37 [[nodiscard]] std::string getHullDefinitionMobility(const std::string& id) const;
38
40 static void registerMobility(IWarshipMobility* mobility);
41 [[nodiscard]] static int getMobilityCount();
42
50 [[nodiscard]] Result<WarshipEntity*> newWarship(const std::string& defId, float x, float y, float heading = 0.f,
51 const std::string& faction = "");
52
53 [[nodiscard]] Result<void> placeCompartment(WarshipEntity* ship, int deck, int row, int col,
54 const std::string& functionId);
55 [[nodiscard]] Result<void> clearCompartment(WarshipEntity* ship, int deck, int row, int col);
56 [[nodiscard]] Result<void> swapCompartments(WarshipEntity* ship, int deckA, int rowA, int colA, int deckB, int rowB,
57 int colB);
58 [[nodiscard]] Result<void> rearrangeFromJson(WarshipEntity* ship, const std::string& json);
59
60 [[nodiscard]] int getCompartmentCount(WarshipEntity* ship) const;
61 [[nodiscard]] int getGridCols(WarshipEntity* ship) const;
62 [[nodiscard]] int getGridRows(WarshipEntity* ship) const;
63 [[nodiscard]] int getGridDecks(WarshipEntity* ship) const;
64 [[nodiscard]] std::string getCompartmentFunction(WarshipEntity* ship, int deck, int row, int col) const;
65 [[nodiscard]] float getPowerNet(WarshipEntity* ship) const;
66 [[nodiscard]] float getThrustMul(WarshipEntity* ship) const;
67 [[nodiscard]] int getHangarCapacity(WarshipEntity* ship) const;
68 [[nodiscard]] int getWeaponBayCount(WarshipEntity* ship) const;
69 [[nodiscard]] int getCrewCapacity(WarshipEntity* ship) const;
70 [[nodiscard]] float getSailPower(WarshipEntity* ship) const;
71 [[nodiscard]] bool isUnderpowered(WarshipEntity* ship) const;
72
73 void moveTo(WarshipEntity* ship, float x, float y);
74 void stop(WarshipEntity* ship);
75 void setInput(WarshipEntity* ship, float throttle, float steer);
76 void update(float dt);
77
78 [[nodiscard]] float getX(WarshipEntity* ship) const;
79 [[nodiscard]] float getY(WarshipEntity* ship) const;
80 [[nodiscard]] float getHeading(WarshipEntity* ship) const;
81 [[nodiscard]] float getSpeed(WarshipEntity* ship) const;
82 [[nodiscard]] float getLength(WarshipEntity* ship) const;
83 [[nodiscard]] float getBeam(WarshipEntity* ship) const;
84 [[nodiscard]] std::string getId(WarshipEntity* ship) const;
85 [[nodiscard]] std::string getDefId(WarshipEntity* ship) const;
86 [[nodiscard]] std::string getCategory(WarshipEntity* ship) const;
87 [[nodiscard]] std::string getFaction(WarshipEntity* ship) const;
88 [[nodiscard]] float getHealth(WarshipEntity* ship) const;
89 [[nodiscard]] float getMaxHealth(WarshipEntity* ship) const;
90 [[nodiscard]] bool isArrived(WarshipEntity* ship) const;
91 [[nodiscard]] bool isDestroyed(WarshipEntity* ship) const;
92 void applyDamage(WarshipEntity* ship, float amount);
93
94 void clearEvents();
95 [[nodiscard]] int getEventCount() const;
96 [[nodiscard]] std::string getEventType(int index) const;
97 [[nodiscard]] std::string getEventWarshipId(int index) const;
98 [[nodiscard]] std::string getEventDefId(int index) const;
99 [[nodiscard]] std::string getEventDetail(int index) const;
100};
101
102} // namespace eve::warship
double y
double x
#define EVENGINE_API_DOMAINS
Definition Export.h:110
double dt
Move-only, checked operation results for the common layer.
V3 heading
Definition TreeMesh.cpp:429
uint32_t index
EVENGINE_API_FOUNDATION public API.
Definition Module.h:48
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Pluggable hull mobility (surface / sail / carrier / space / custom).
Warship short-root entity: huge hull + rearrangeable compartments.
Warship module (eve.Warship).
Definition Warship.h:20
~Warship() override=default
Warship module entry (eve.Warship): hull/function catalogues, spawn, compartment remodel,...
Definition Warship.cpp:17