52 class World final :
public QThread {
59 World(QString world_name,
bool * error);
71 int SunLight (
int x,
int y,
int z)
const;
72 int FireLight (
int x,
int y,
int z)
const;
73 int LightMap (
int x,
int y,
int z)
const;
83 void Shine(
int x,
int y,
int z,
int level);
98 void UpShine(
int x,
int y,
int z_bottom);
105 bool Focus(
int x,
int y,
int z,
106 int * x_targ,
int * y_targ,
int * z_targ,
dirs dir)
const;
124 int x_to,
int y_to,
int z_to)
const;
126 bool Visible(
int x_from,
int y_from,
int z_from,
127 int x_to,
int y_to,
int z_to)
const;
131 bool Move(
int x,
int y,
int z,
dirs dir);
132 void Jump(
int x,
int y,
int z,
dirs dir);
136 int x_to,
int y_to,
int z_to,
dirs dir);
138 int x_to,
int y_to,
int z_to,
dirs dir);
152 int Damage(
int x,
int y,
int z,
int level,
int dmg_kind);
156 bool Build(
Block * thing,
int x,
int y,
int z,
158 Block * who =
nullptr,
159 bool anyway =
false);
166 int src,
int dest,
int num);
169 bool Drop(
Block * from,
int x_to,
int y_to,
int z_to,
170 int src,
int dest,
int num);
171 bool Get(
Block * to,
int x_from,
int y_from,
int z_from,
172 int src,
int dest,
int num);
177 bool InBounds(
int x,
int y,
int z)
const;
182 QString
GetNote(
int note_id)
const;
186 int new_x,
int new_y,
int new_z);
207 void Notify(QString)
const;
bool Move(int x, int y, int z, dirs dir)
Check and move.
int TimeOfDay() const
This returns seconds from start of current day.
const int MAX_DURABILITY
10 bits to store durability in file, signed.
static dirs TurnRight(dirs dir)
void SunShineHorizontal(int x, int y, int z)
static bool InVertBounds(int z)
Shred * GetNearShred(Shred *, dirs dir) const
int numShreds
size of loaded zone
void SetShredData(QByteArray *, long longi, long lati)
void GetString(QString &) const
Shred ** FindShred(int x, int y) const
bool Drop(Block *from, int x_to, int y_to, int z_to, int src, int dest, int num)
Returns true on success.
World provides global physics and shred connection.
void ReloadAllShreds(long lati, long longi, int new_x, int new_y, int new_z)
void UpdatedAround(int x, int y, int z, int range)
void Updated(int, int, int)
static dirs Anti(dirs dir)
bool Inscribe(int x, int y, int z)
Returns true on success. Gets a string and inscribes block.
Shred * GetShredByPos(int x, int y) const
void UpShineInit(int x, int y, int z_bottom)
int SetNote(QString note)
const int MOON_LIGHT_FACTOR
void AddFireLight(int x, int y, int z, int level)
QString GetNote(int note_id) const
bool Visible(int x_from, int y_from, int z_from, int x_to, int y_to, int z_to) const
At least one side of block is visible.
volatile dirs toResetDir
UP for no reset, DOWN for full reset, NSEW for side shift.
bool Exchange(Block *block_from, Block *block_to, int src, int dest, int num)
Returns true if block_from can be put into block_to.
int LightMap(int x, int y, int z) const
Use Enlightened instead, which is smart wrapper of this.
const int MAX_LIGHT_RADIUS
void Jump(int x, int y, int z, dirs dir)
ulong Time() const
Returns time in seconds since world creation.
void Shine(int x, int y, int z, int level)
If init is false, light will not spread from non-invisible blocks.
can_move_results CanMove(int x, int y, int z, int x_to, int y_to, int z_to, dirs dir)
This CAN move blocks, but not xyz block.
void Notify(QString) const
void NeedPlayer(int, int, int)
const int SUN_LIGHT_FACTOR
void ReEnlightenMove(dirs)
Called from ReloadShreds(int), enlightens only needed shreds.
Block * GetBlock(int x, int y, int z) const
int SunLight(int x, int y, int z) const
bool Get(Block *to, int x_from, int y_from, int z_from, int src, int dest, int num)
World(QString world_name, bool *error)
void NoCheckMove(int x, int y, int z, int x_to, int y_to, int z_to, dirs dir)
bool GetEvernight() const
void UpdatesEnded()
This is emitted when a pack of updates is complete.
const WorldMap * GetMap() const
World & operator=(const World &)=delete
QString TimeOfDayStr() const
void ReEnlighten(int x, int y, int z)
Called when block is moved.
times_of_day PartOfDay() const
bool ShredInCentralZone(long longi, long lati) const
ShredStorage * shredStorage
int MiniTime() const
Returns number of physics steps since second start.
void RemoveSunLight(int x, int y, int z)
void DestroyAndReplace(int x, int y, int z)
Does not check target block durability.
void SetReloadShreds(int direction)
int numActiveShreds
size of active zone
Shred * GetShred(int i, int j) const
void DeleteAllShreds()
Also saves all shreds.
bool DirectlyVisible(int x_from, int y_from, int z_from, int x_to, int y_to, int z_to) const
bool InBounds(int x, int y) const
bool Build(Block *thing, int x, int y, int z, int dir=UP, Block *who=nullptr, bool anyway=false)
Returns true on successfull build, otherwise false.
int Damage(int x, int y, int z, int level, int dmg_kind)
Returns damaged block result durability.
const int TIME_STEPS_IN_SEC
void Moved(int)
Emitted when world active zone moved to int direction.
const int MAX_NOTE_LENGTH
bool SetFireLightMap(int level, int x, int y, int z)
void RemoveFireLight(int x, int y, int z)
bool Focus(int x, int y, int z, int *x_targ, int *y_targ, int *z_targ, dirs dir) const
False on error, true if focus is received to _targ successfully.
int ShredPos(int x, int y) const
void CrossUpShine(int x, int y, int z_bottom)
int ChangeNote(QString note, int note_id)
void SunShineVertical(int x, int y, int z=HEIGHT-2, int level=MAX_LIGHT_RADIUS)
Block without special physics and attributes.
void UpShine(int x, int y, int z_bottom)
int FireLight(int x, int y, int z) const
static dirs TurnLeft(dirs dir)
QString WorldName() const
QByteArray * GetShredData(long longi, long lati) const
void SetNumActiveShreds(int num)
int Enlightened(int x, int y, int z) const