Copy paste to banquet for fools
This commit is contained in:
28
Projects/BanquetForFools/BanquetForCyka/CykUtil.cs
Normal file
28
Projects/BanquetForFools/BanquetForCyka/CykUtil.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user