mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-17 18:38:13 +00:00
exclude unused GameMode implementations, format Platform/Common/Tutorial
This commit is contained in:
@@ -5,48 +5,47 @@
|
||||
#include "AreaConstraint.h"
|
||||
#include "../../Minecraft.World/Util/AABB.h"
|
||||
|
||||
AreaConstraint::AreaConstraint( int descriptionId, double x0, double y0, double z0, double x1, double y1, double z1, bool contains /*= true*/, bool restrictsMovement /*=true*/ )
|
||||
: TutorialConstraint( descriptionId )
|
||||
{
|
||||
messageArea = AABB::newPermanent(x0+2, y0+2, z0+2, x1-2, y1-2, z1-2);
|
||||
movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
|
||||
AreaConstraint::AreaConstraint(int descriptionId, double x0, double y0,
|
||||
double z0, double x1, double y1, double z1,
|
||||
bool contains /*= true*/,
|
||||
bool restrictsMovement /*=true*/)
|
||||
: TutorialConstraint(descriptionId) {
|
||||
messageArea =
|
||||
AABB::newPermanent(x0 + 2, y0 + 2, z0 + 2, x1 - 2, y1 - 2, z1 - 2);
|
||||
movementArea = AABB::newPermanent(x0, y0, z0, x1, y1, z1);
|
||||
|
||||
this->contains = contains;
|
||||
m_restrictsMovement = restrictsMovement;
|
||||
this->contains = contains;
|
||||
m_restrictsMovement = restrictsMovement;
|
||||
}
|
||||
|
||||
AreaConstraint::~AreaConstraint()
|
||||
{
|
||||
delete messageArea;
|
||||
delete movementArea;
|
||||
AreaConstraint::~AreaConstraint() {
|
||||
delete messageArea;
|
||||
delete movementArea;
|
||||
}
|
||||
|
||||
bool AreaConstraint::isConstraintSatisfied(int iPad)
|
||||
{
|
||||
Minecraft *minecraft = Minecraft::GetInstance();
|
||||
return messageArea->contains( minecraft->localplayers[iPad]->getPos(1) ) == contains;
|
||||
bool AreaConstraint::isConstraintSatisfied(int iPad) {
|
||||
Minecraft* minecraft = Minecraft::GetInstance();
|
||||
return messageArea->contains(minecraft->localplayers[iPad]->getPos(1)) ==
|
||||
contains;
|
||||
}
|
||||
|
||||
bool AreaConstraint::isConstraintRestrictive(int iPad)
|
||||
{
|
||||
return m_restrictsMovement;
|
||||
bool AreaConstraint::isConstraintRestrictive(int iPad) {
|
||||
return m_restrictsMovement;
|
||||
}
|
||||
|
||||
bool AreaConstraint::canMoveToPosition(double xo, double yo, double zo,
|
||||
double xt, double yt, double zt) {
|
||||
if (!m_restrictsMovement) return true;
|
||||
|
||||
bool AreaConstraint::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt)
|
||||
{
|
||||
if(!m_restrictsMovement) return true;
|
||||
Vec3* targetPos = Vec3::newTemp(xt, yt, zt);
|
||||
Minecraft* minecraft = Minecraft::GetInstance();
|
||||
|
||||
Vec3 *targetPos = Vec3::newTemp(xt, yt, zt);
|
||||
Minecraft *minecraft = Minecraft::GetInstance();
|
||||
|
||||
if(movementArea->contains( targetPos ) == contains)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Vec3 *origPos = Vec3::newTemp(xo, yo, zo);
|
||||
if (movementArea->contains(targetPos) == contains) {
|
||||
return true;
|
||||
}
|
||||
Vec3* origPos = Vec3::newTemp(xo, yo, zo);
|
||||
|
||||
double currDist = origPos->distanceTo(movementArea);
|
||||
double targetDist = targetPos->distanceTo(movementArea);
|
||||
return targetDist < currDist;
|
||||
double currDist = origPos->distanceTo(movementArea);
|
||||
double targetDist = targetPos->distanceTo(movementArea);
|
||||
return targetDist < currDist;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user