mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-04 02:52:21 -04:00
Make CalcEyeHeight take Y scale int account
Make LevelInfo.Check public, so it can be used in plugins
This commit is contained in:
parent
d8b8fce737
commit
a420071749
@ -155,8 +155,8 @@ namespace MCGalaxy.Bots {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void FaceTowards(PlayerBot bot, Player p) {
|
static void FaceTowards(PlayerBot bot, Player p) {
|
||||||
int srcHeight = ModelInfo.CalcEyeHeight(p.Model);
|
int srcHeight = ModelInfo.CalcEyeHeight(p);
|
||||||
int dstHeight = ModelInfo.CalcEyeHeight(bot.Model);
|
int dstHeight = ModelInfo.CalcEyeHeight(bot);
|
||||||
|
|
||||||
int dx = p.Pos.X - bot.Pos.X, dy = (p.Pos.Y + srcHeight) - (bot.Pos.Y + dstHeight), dz = p.Pos.Z - bot.Pos.Z;
|
int dx = p.Pos.X - bot.Pos.X, dy = (p.Pos.Y + srcHeight) - (bot.Pos.Y + dstHeight), dz = p.Pos.Z - bot.Pos.Z;
|
||||||
Vec3F32 dir = new Vec3F32(dx, dy, dz);
|
Vec3F32 dir = new Vec3F32(dx, dy, dz);
|
||||||
|
@ -121,9 +121,9 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Gives distance (in half-pixel world units) from feet to camera height </summary>
|
/// <summary> Gives distance (in half-pixel world units) from feet to camera height </summary>
|
||||||
public static int CalcEyeHeight(string model) {
|
public static int CalcEyeHeight(Entity entity) {
|
||||||
float scale = GetRawScale(model);
|
float scale = (entity.ScaleY == 0) ? GetRawScale(entity.Model) : entity.ScaleY;
|
||||||
model = GetRawModel(model);
|
string model = GetRawModel(entity.Model);
|
||||||
BlockID raw;
|
BlockID raw;
|
||||||
if (BlockID.TryParse(model, out raw) && raw <= Block.MaxRaw) return 16; //lazily return middle of full block if it thinks it's a block ID.
|
if (BlockID.TryParse(model, out raw) && raw <= Block.MaxRaw) return 16; //lazily return middle of full block if it thinks it's a block ID.
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ namespace MCGalaxy {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool Check(Player p, LevelPermission plRank, Level lvl, string action) {
|
public static bool Check(Player p, LevelPermission plRank, Level lvl, string action) {
|
||||||
if (p.IsConsole) return true;
|
if (p.IsConsole) return true;
|
||||||
if (!lvl.VisitAccess.CheckDetailed(p, plRank) || !lvl.BuildAccess.CheckDetailed(p, plRank)) {
|
if (!lvl.VisitAccess.CheckDetailed(p, plRank) || !lvl.BuildAccess.CheckDetailed(p, plRank)) {
|
||||||
p.Message("Hence, you cannot {0}.", action); return false;
|
p.Message("Hence, you cannot {0}.", action); return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user