nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
picking.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_PICKING_H_
2#define NANOMMO_CLIENT_PICKING_H_
3
4#include <raylib.h>
5
6#include <cstdint>
7#include <optional>
8#include <string_view>
9#include <vector>
10
11#include "client/animator.h"
12#include "terrain/terrain.h"
13
14namespace nanommo {
15
16/// The nearest NPC along the ray that the player, standing at you, is near
17/// enough to talk to, learn from or take a quest from, such as the one under
18/// the mouse, or nullptr if there's none.
19const Figure* PickNpc(const std::vector<Figure>& figures, const Ray& ray,
20 Vector3 you);
21
22/// Whether the figure is another player in the guild at war with yours, by
23/// its name, or none for no war.
24bool Enemy(const Figure& figure, std::string_view enemy);
25
26/// The nearest living monster along the ray, or in a duel, the opponent, by
27/// their id, or a player in the guild at war with yours, whom the player
28/// picks as they would a monster. Or nullptr, if there's none of them.
29const Figure* PickMonster(const std::vector<Figure>& figures, const Ray& ray,
30 uint32_t opponent = 0, std::string_view enemy = {});
31
32/// The nearest figure along the ray but you, of any kind, alive or not, such
33/// as the one under the mouse, whose name shows while it's there: or nullptr.
34const Figure* PickAnyone(const std::vector<Figure>& figures, const Ray& ray);
35
36/// Whether the figure is the one the player picked: the monster, by its id,
37/// or the player, in a duel or at war, by theirs, as each has ids of their own.
38bool Picked(const Figure& figure, uint32_t target, uint32_t target_player);
39
40/// Where the ray first meets the ground, if it does within the farthest
41/// anyone sees, such as the spot under the mouse.
42std::optional<Vector3> PickGround(const Terrain& terrain, const Ray& ray);
43
44} // namespace nanommo
45
46#endif // NANOMMO_CLIENT_PICKING_H_
Definition chat.cc:9
bool Picked(const Figure &figure, uint32_t target, uint32_t target_player)
Definition picking.cc:86
bool Enemy(const Figure &figure, std::string_view enemy)
Definition picking.cc:68
const Figure * PickMonster(const std::vector< Figure > &figures, const Ray &ray, uint32_t opponent, std::string_view enemy)
Definition picking.cc:73
std::optional< Vector3 > PickGround(const Terrain &terrain, const Ray &ray)
Definition picking.cc:93
const Figure * PickAnyone(const std::vector< Figure > &figures, const Ray &ray)
Definition picking.cc:82
const Figure * PickNpc(const std::vector< Figure > &figures, const Ray &ray, Vector3 you)
Definition picking.cc:57