mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-08 00:47:14 +00:00
30 lines
591 B
C++
30 lines
591 B
C++
#pragma once
|
|
|
|
#include <optional>
|
|
|
|
class VillageSiege {
|
|
private:
|
|
Level* level;
|
|
bool hasSetupSiege;
|
|
int siegeState;
|
|
int siegeCount;
|
|
int nextSpawnTime;
|
|
std::weak_ptr<Village> village;
|
|
int spawnX, spawnY, spawnZ;
|
|
|
|
static const int SIEGE_NOT_INITED = -1;
|
|
static const int SIEGE_CAN_ACTIVATE = 0;
|
|
static const int SIEGE_TONIGHT = 1;
|
|
static const int SIEGE_DONE = 2;
|
|
|
|
public:
|
|
VillageSiege(Level* level);
|
|
|
|
void tick();
|
|
|
|
private:
|
|
bool tryToSetupSiege();
|
|
bool trySpawn();
|
|
std::optional<Vec3> findRandomSpawnPos(int x, int y, int z);
|
|
};
|