Skip to content

Commit

Permalink
update popext
Browse files Browse the repository at this point in the history
  • Loading branch information
Brain-dawg committed Nov 16, 2024
1 parent 739f383 commit 8eb1c46
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions scripts/vscripts/popextensions/util.nut
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@
SetPropInt(player, "m_afButtonForced", GetPropInt(player, "m_afButtonForced") & ~button); SetPropInt(player, "m_nButtons", GetPropInt(player, "m_nButtons") & ~button)
}

//LEGACY: use IsPointInTrigger instead
function IsPointInRespawnRoom(point)
{
local triggers = []
Expand Down Expand Up @@ -772,6 +773,36 @@
return trace.hit && trace.enthit.GetClassname() == "func_respawnroom"
}

function IsPointInTrigger(point, classname = "func_respawnroom")
{
local triggers = []
for (local trigger; trigger = FindByClassname(trigger, classname);)
{
if (classname == "func_respawnroom")
trigger.SetCollisionGroup(COLLISION_GROUP_NONE)

trigger.RemoveSolidFlags(4) // FSOLID_NOT_SOLID
triggers.append(trigger)
}

local trace =
{
start = point,
end = point,
mask = 0
}
TraceLineEx(trace)

foreach (trigger in triggers)
{
if (classname == "func_respawnroom")
trigger.SetCollisionGroup(COLLISION_GROUP_RESPAWNROOMS)

trigger.AddSolidFlags(FSOLID_NOT_SOLID) // FSOLID_NOT_SOLID
}

return trace.hit && trace.enthit.GetClassname() == classname
}

//assumes user is using the SLOT_ constants
function SwitchWeaponSlot(player, slot) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/vscripts/popextensions_main.nut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
::popExtensionsVersion <- "09.30.2024.1"
::popExtensionsVersion <- "11.16.2024.1"
local _root = getroottable()

local o = Entities.FindByClassname(null, "tf_objective_resource")
Expand Down

0 comments on commit 8eb1c46

Please sign in to comment.