OnPoweredLightsPointAdd
OxideCarbonStructureCalled when a powered lights point is added.
object OnPoweredLightsPointAdd(StringLights stringLights, BasePlayer local0, Vector3 local1, Vector3 local2)Works — the game method in this build is the one the hook was written for.
Parameters
- stringLights
- StringLights
- local0
- BasePlayer
- local1
- Vector3
- local2
- Vector3
Return value
objectReturn non-null to cancel the game action.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnPoweredLightsPointAdd(StringLights stringLights, BasePlayer local0, Vector3 local1, Vector3 local2)
{
Puts("OnPoweredLightsPointAdd");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return false; // non-null cancels the game action
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void StringLights.SERVER_AddPoint(BaseEntity.RPCMessage)
Passes: StringLights stringLights, BasePlayer local0, Vector3 local1, Vector3 local2
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, l0, l1, l2)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
if (vector.IsNaNOrInfinity() || vector2.IsNaNOrInfinity() || num.IsNaNOrInfinity())
{
return;
}
num = Mathf.Clamp(num, 0f, 2f);
Item item = GetItem();
if (item != null && item.amount >= 1 && CanPlayerUse(player) && !(Vector3.Distance(vector, player.eyes.position) > maxPlaceDistance) && CheckValidPlacement(vector, 0.1f, 1218510849))
{
if (Interface.CallHook("OnPoweredLightsPointAdd", this, player, vector, vector2) != null)
{
return;
}
int num2 = 1;
float num3 = 0f;
Vector3 vector3 = ((points.Count > 0) ? transform.TransformPoint(points[points.Count - 1].point) : wireOrigin.position);
num3 = Vector3.Distance(vector, vector3);
num3 = Mathf.Max(num3, lengthPerAmount);
// …Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.