mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-10-02 18:13:11 -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) {
|
||||
int srcHeight = ModelInfo.CalcEyeHeight(p.Model);
|
||||
int dstHeight = ModelInfo.CalcEyeHeight(bot.Model);
|
||||
int srcHeight = ModelInfo.CalcEyeHeight(p);
|
||||
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;
|
||||
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>
|
||||
public static int CalcEyeHeight(string model) {
|
||||
float scale = GetRawScale(model);
|
||||
model = GetRawModel(model);
|
||||
public static int CalcEyeHeight(Entity entity) {
|
||||
float scale = (entity.ScaleY == 0) ? GetRawScale(entity.Model) : entity.ScaleY;
|
||||
string model = GetRawModel(entity.Model);
|
||||
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.
|
||||
|
||||
|
@ -134,7 +134,7 @@ namespace MCGalaxy {
|
||||
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 (!lvl.VisitAccess.CheckDetailed(p, plRank) || !lvl.BuildAccess.CheckDetailed(p, plRank)) {
|
||||
p.Message("Hence, you cannot {0}.", action); return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user