Hooks called by Prop Protection

Summary

Hooks

Called on the server after an entity has become the property of a player's active character.
Called on the server after an entity has stopped being the property of a character while it still exists: it was given to somebody else, released by a plugin, or kept when the entities of an owner who had left were removed.
Lets plugins overrule the decision of the Prop Protection plugin on whether a player may do something to an entity.
Asks whether an entity may become the property of a player's active character.
Called on the server when a player has come back to their entities before they were removed: they have reconnected, or switched back to the character that owns them.
Asks whether a player should be hurt by an entity that the Prop Protection plugin considers harmless: one that is held with the physics gun, or was spawned or dropped by it within the prop_kill_protection_time config.
Asks whether an entity should be removed now that its owner has been gone, or has been playing another character, for the time of the prop_removal_delay config.

Hooks

EntityOwnershipGiven(entity, actor, key)

server plugins/propprotection/plugin/sv_plugin.lua:103

Called on the server after an entity has become the property of a player's active character.

Parameters

  • entity Entity
  • actor Player the new owner
  • key String ownership key of the new owner, see PropProtection:get_key

Called from

Call sites

EntityOwnershipTaken(entity, key)

server plugins/propprotection/plugin/sv_plugin.lua:129

Called on the server after an entity has stopped being the property of a character while it still exists: it was given to somebody else, released by a plugin, or kept when the entities of an owner who had left were removed. Not called for entities that are removed.

Parameters

  • entity Entity
  • key String ownership key of the previous owner, see PropProtection:get_key

Called from

Call sites

PlayerCanManipulateEntity(actor, entity, action, rule, detail)

shared plugins/propprotection/plugin/sh_plugin.lua:256

Lets plugins overrule the decision of the Prop Protection plugin on whether a player may do something to an entity. Called on the server and, for the local player, on the client, every time the physics gun, a tool, a property or driving is checked against an entity, which for the physics gun is many times a second.

Parameters

  • actor Player the player who acts
  • entity Entity the entity that is acted on
  • action String 'physgun', 'freeze', 'unfreeze', 'tool', 'property' or 'drive'
  • rule String ID of the rule that is about to refuse the action ('players', 'vehicles', 'ragdolls', 'owned', 'map' or 'world'); nil if the plugin allows it
  • detail String the tool ID or the property name, nil for the other actions

Returns

  • Boolean return true to allow the action in spite of the rule, false to refuse it; the decision of the plugin stands when nothing is returned

Called from

Call sites

PlayerCanOwnEntity(actor, entity)

server plugins/propprotection/plugin/sv_plugin.lua:86

Asks whether an entity may become the property of a player's active character. Called on the server before the ownership of an entity changes: for everything a player spawns from the spawn menu or creates with a tool, and when a plugin gives an entity away.

Parameters

  • actor Player the player who is about to own the entity
  • entity Entity

Returns

  • Boolean return false to leave the entity with whoever owns it now, which is nobody for an entity that has just been spawned

Called from

Call sites

PlayerEntitiesReturned(actor, entities)

server plugins/propprotection/plugin/sv_plugin.lua:266

Called on the server when a player has come back to their entities before they were removed: they have reconnected, or switched back to the character that owns them.

Parameters

  • actor Player the owner
  • entities List<Entity> the entities of their active character

Called from

Call sites

PlayerShouldTakePropDamage(target, prop, damage_info)

server plugins/propprotection/plugin/sv_hooks.lua:148

Asks whether a player should be hurt by an entity that the Prop Protection plugin considers harmless: one that is held with the physics gun, or was spawned or dropped by it within the prop_kill_protection_time config. Called on the server, while the prop_kill_protection config is on, before such impact damage is blocked.

Parameters

  • target Player the player who is about to be protected
  • prop Entity the entity that has hit them
  • damage_info CTakeDamageInfo the damage

Returns

  • Boolean return true to let the damage through

Called from

Call sites

ShouldRemoveAbandonedEntity(ent, key)

server plugins/propprotection/plugin/sv_plugin.lua:231

Asks whether an entity should be removed now that its owner has been gone, or has been playing another character, for the time of the prop_removal_delay config. Called on the server for every entity of that owner that is neither permanent nor static.

Parameters

  • entity Entity
  • key String ownership key of the owner, see PropProtection:get_key

Returns

  • Boolean return false to keep the entity, which then belongs to nobody

Called from

Call sites

Defined in