void Step(PlayerBot bot) { bot.TargetPos = bot.Pos; bot.movement = true; Vec3F32 dir = DirUtils.GetDirVector(bot.Rot.RotY, 0); bot.TargetPos.X = bot.Pos.X + (int)(dir.X * bot.movementSpeed); bot.TargetPos.Z = bot.Pos.Z + (int)(dir.Z * bot.movementSpeed); }
void OnPlayerMove(Player p, Position next, byte yaw, byte pitch) { string data = playerEffects.FindData(p.name); if (data == null) { return; } if (rnd.NextDouble() > 0.125f && !data.StartsWith("puff")) { return; } float x = p.Pos.X * 0.03125f; float y = (p.Pos.Y + ModelInfo.CalcEyeHeight(p) - Entities.CharacterHeight) * 0.03125f; float z = p.Pos.Z * 0.03125f; float originX = x; float originY = y; float originZ = z; Player notShownTo = null; //ugly hack if (data.StartsWith("leaf")) { if (rnd.NextDouble() > 0.5f) { return; } originX += 32; originZ += 8; } else if (data.StartsWith("puff")) { Random playerRandom = new Random(p.name.GetHashCode()); const int cycle = 4000; const int breatheOut = 1000; int offset = playerRandom.Next(0, cycle + 1); TimeSpan delta = DateTime.UtcNow - (startTime.AddMilliseconds(offset)); int ms = (int)delta.TotalMilliseconds; bool phase1 = (ms % cycle) < breatheOut; if (!phase1) { return; } Vec3F32 dir = DirUtils.GetDirVector(yaw, pitch); dir.X *= 0.3f; dir.Y *= 0.3f; dir.Z *= 0.3f; originY = y; x += dir.X; y += dir.Y; z += dir.Z; y -= 0.15f; originY -= 0.15f; notShownTo = p; } SpawnEffectAt(p.level, data, x, y, z, originX, originY, originZ); }