29 lines
845 B
C#
29 lines
845 B
C#
using System;
|
|
|
|
namespace BanquetForCyka {
|
|
public class CykUtil {
|
|
public static bool IsPlayerTank(Module module) {
|
|
if (module == null)
|
|
return false;
|
|
TankBlock block = module.block;
|
|
if (block == null)
|
|
return false;
|
|
Tank tank = block.tank;
|
|
if (tank == null)
|
|
return false;
|
|
return tank.ControllableByLocalPlayer;
|
|
}
|
|
|
|
public static Func<object, bool> isObjectPlayerTank = obj => {
|
|
if (obj == null)
|
|
return false;
|
|
try {
|
|
return IsPlayerTank(obj as Module);
|
|
} catch (Exception e) {
|
|
Console.WriteLine("Failed to check if object is a player tank: " + e.Message);
|
|
return false;
|
|
}
|
|
};
|
|
}
|
|
}
|