Error while compiling Guardian: 'BasePlayer' does not contain a definition for 'ClientRPCPlayer' and no accessible extension method 'ClientRPCPlayer' accepting a first argument of type 'BasePlayer' could be found (are you missing a using directive or an assembly reference?) | Line: 9698, Pos: 26
Error while compiling Guardian: 'BasePlayer'
changes needed: around line 390
if(!deflection)
{
// Facepunch removed Pool.GetList<T>() / Pool.FreeList (CS0117).
// Current Facepunch.Pool API: Get<List<T>>() rents a pooled list,
// FreeUnmanaged<T>(ref list) returns it. Same Vis.Entities usage.
var deflectors = Pool.Get<List<BaseEntity>>();
Vis.Entities(position, aim_distance, deflectors);
var d_squared = distance * distance;
foreach(var deflector in deflectors)
{
if(deflector.SqrDistance(weapon.Position) < d_squared)
{
deflection = true;
break;
}
}
Pool.FreeUnmanaged<BaseEntity>(ref deflectors);
}around line 817:
bool flying = true;
// Facepunch removed Pool.GetList<T>() (CS0117). Use Pool.Get<List<T>>() instead.
var entities = Pool.Get<List<BaseEntity>>();
Vis.Entities(position, sensitivity_hi, entities);around line 849:
default:
// Facepunch removed BaseHelicopterVehicle (CS0246). Replacement is
// PlayerHelicopter (minicopter / scrap heli / attack heli). That type
// now inherits BaseVehicle, so it MUST be tested first: the old
// BaseHelicopterVehicle branch skipped the distance gate. If we left
// it after `is BaseVehicle`, player helis would take the tighter
// sensitivity_lo check and false-flag gravity near a heli.
if((entity is PlayerHelicopter) || (entity is SupplyDrop) || (entity is TreeEntity))
{
flying = false;
}
else if((entity is BaseVehicle) || (entity is BaseVehicleSeat))
{
if(player.Distance(entity.bounds.ClosestPoint(position)) <= sensitivity_lo)
{
flying = false;
}
}
else if(entity.ShortPrefabName == "ladder.wooden.wall")
{
if(player.Distance(entity.bounds.ClosestPoint(position)) <= sensitivity_md)
{
flying = false;
}
}
else
{
var top = entity.bounds.max.y;
if((position.y >= top) && ((position.y - top) <= sensitivity_lo))
{
var bot = new Vector3(position.x, position.y - sensitivity_lo, position.z);
if(Physics.CheckCapsule(position, bot, 0.25f))
{
flying = false;
}
}
}
break;
}
if(!flying)
{
break;
}
}
if(flying && (entities.Count == 0) && Vis.AnyColliders(position, sensitivity_lo))
{
flying = false;
}
// Pair of Get<List<T>> above. FreeList is gone; FreeUnmanaged<T> is the current return path.
Pool.FreeUnmanaged<BaseEntity>(ref entities);
return flying;
}(the above pool.freeunmanage change ends before: "public static void Scan()")
around like 6199:
public static bool IsNearby(Vector3 position, bool check_privilege = true)
{
// Facepunch removed Pool.GetList<T>() (CS0117). Use Pool.Get<List<T>>() instead.
var blocks = Pool.Get<List<BuildingBlock>>();
Vis.Entities(position, 16.0f, blocks, Layers.Mask.Construction, QueryTriggerInteraction.Ignore);
bool nearby = false;
foreach(var block in blocks)
{
if(check_privilege)
{
if(HasPrivilege(block))
{
nearby = true; break;
}
}
else
{
nearby = true; break;
}
}
Pool.FreeUnmanaged<BuildingBlock>(ref blocks);
return nearby;
}
}around line 6298:
public class Entities
{
public static bool InRange(Vector3 position, float radius = 3.0f)
{
// Facepunch removed Pool.GetList<T>() / Pool.FreeList (CS0117).
var entities = Pool.Get<List<DecayEntity>>();
Vis.Entities(position, radius, entities);
bool nearby = entities.Count > 0;
Pool.FreeUnmanaged<DecayEntity>(ref entities);
return nearby;
}
}around line 9709:
attacker.MovePosition(position);
// Facepunch removed BasePlayer.ClientRPCPlayer (CS1061). Current RPC path is
// ClientRPC(RpcTarget.Player(rpcName, connectionPlayer), args...). Matches
// vanilla VehicleSpawner.NudgePlayersInRadius ForcePositionTo usage.
// Old: attacker.ClientRPCPlayer(null, attacker, "ForcePositionTo", position);
attacker.ClientRPC(RpcTarget.Player("ForcePositionTo", attacker), position);
attacker.SendNetworkUpdateImmediate();
Chat.Admin(Key.UserBanTeleported, new Dictionary<string, string>
{
{ "playerid", user.userid.ToString() },
{ "playername", Text.Sanitize(user.name) },
{ "victim", Text.Sanitize(victim.name) }
});Full plugin / Pastebin - Part 1: https://pastebin.com/uxWGDwV2
Full plugin / Pastebin - Part 2: https://pastebin.com/whEYdxt0