Skip to content

Commit

Permalink
E2 Pickup events (#3229)
Browse files Browse the repository at this point in the history
  • Loading branch information
Astralcircle authored Dec 27, 2024
1 parent 9ef330c commit 525512e
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions lua/entities/gmod_wire_expression2/core/entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,63 @@ E2Lib.registerEvent("playerEnteredVehicle", {

--[[******************************************************************************]]

hook.Add("PhysgunPickup", "Exp2RunOnPhysgunPickup", function(ply, entity)
E2Lib.triggerEvent("playerPhysgunPickup", { ply, entity })
end)

hook.Add("PhysgunDrop", "Exp2RunOnPhysgunDrop", function(ply, entity)
E2Lib.triggerEvent("playerPhysgunDrop", { ply, entity })
end)

E2Lib.registerEvent("playerPhysgunPickup", {
{ "Player", "e" },
{ "Entity", "e" },
})

E2Lib.registerEvent("playerPhysgunDrop", {
{ "Player", "e" },
{ "Entity", "e" },
})

hook.Add("GravGunOnPickedUp", "Exp2RunOnGravGunPickup", function(ply, entity)
E2Lib.triggerEvent("playerGravGunPickup", { ply, entity })
end)

hook.Add("GravGunOnDropped", "Exp2RunOnGravGunDrop", function(ply, entity)
E2Lib.triggerEvent("playerGravGunDrop", { ply, entity })
end)

E2Lib.registerEvent("playerGravGunPickup", {
{ "Player", "e" },
{ "Entity", "e" },
})

E2Lib.registerEvent("playerGravGunDrop", {
{ "Player", "e" },
{ "Entity", "e" },
})

hook.Add("OnPlayerPhysicsPickup", "Exp2RunOnPhysicsPickup", function(ply, entity)
E2Lib.triggerEvent("playerPhysicsPickup", { ply, entity })
end)

hook.Add("OnPlayerPhysicsDrop", "Exp2RunPhysicsDrop", function(ply, entity, thrown)
E2Lib.triggerEvent("playerPhysicsDrop", { ply, entity, thrown == true and 1 or 0 })
end)

E2Lib.registerEvent("playerPhysicsPickup", {
{ "Player", "e" },
{ "Entity", "e" },
})

E2Lib.registerEvent("playerPhysicsDrop", {
{ "Player", "e" },
{ "Entity", "e" },
{ "Thrown", "n" }
})

--[[******************************************************************************]]

local function composedata(startSize, endSize, length, material, color, alpha)
if string.find(material, '"', 1, true) then return nil end

Expand Down

0 comments on commit 525512e

Please sign in to comment.