1
0
Fork 0
Univerxel/src/core/world/actions.hpp

37 lines
763 B
C++

#pragma once
#include "forward.h"
#include "Voxel.hpp"
#include <variant>
/// Client action on world
namespace world::action {
namespace part {
struct Ping { };
}
struct Fill: part::Ping {
Fill(const area_<voxel_pos> &pos, const Voxel &val): pos(pos), val(val) {}
const area_<voxel_pos> pos;
const Voxel val;
};
struct FillCube: Fill {
FillCube(const area_<voxel_pos> &pos, const Voxel &val, int radius): Fill(pos, val), radius(radius) { }
const int radius;
};
struct Move: part::Ping {
Move(const voxel_pos& pos): pos(pos) { }
const voxel_pos pos;
};
struct Message: part::Ping {
Message(const std::string& text): text(text) { }
const std::string text;
};
using packet = std::variant<Move, Message, Fill, FillCube>;
}