nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
npcs.h
Go to the documentation of this file.
1#ifndef NANOMMO_CONTENT_NPCS_H_
2#define NANOMMO_CONTENT_NPCS_H_
3
4#include <cstdint>
5#include <map>
6#include <string_view>
7#include <vector>
8
9#include "absl/status/statusor.h"
10#include "content/npcs.pb.h"
11
12namespace nanommo {
13
14/// In metres, from the middle of an NPC, as you'd talk to someone: how near a
15/// player has to be to talk to one, learn from it or take its quests. The
16/// server holds them to it, and the client lets them click only that near.
17constexpr float kTalkReach = 4.0f;
18
19/// The kinds of NPC, by id, and where each NPC stands.
20struct NpcTable {
21 std::map<uint32_t, npcs::Kind> kinds;
22 std::vector<npcs::Spawn> spawns;
23};
24
25/// The NPCs in text format, or what's wrong with them: a field npcs.proto
26/// doesn't have, a kind with no id or with another's, or a spawn of a kind or
27/// in a land that isn't there.
28absl::StatusOr<NpcTable> ParseNpcs(std::string_view text);
29
30} // namespace nanommo
31
32#endif // NANOMMO_CONTENT_NPCS_H_
Definition chat.cc:9
absl::StatusOr< NpcTable > ParseNpcs(std::string_view text)
Definition npcs.cc:15
constexpr float kTalkReach
Definition npcs.h:17
The kinds of NPC, by id, and where each NPC stands.
Definition npcs.h:20
std::vector< npcs::Spawn > spawns
Definition npcs.h:22
std::map< uint32_t, npcs::Kind > kinds
Definition npcs.h:21