Skip to content

Commit

Permalink
Revision 17/07/2024
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzuerio committed Jul 17, 2024
1 parent 8385dc5 commit 28285cb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
9 changes: 9 additions & 0 deletions CHANGES.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Note: **Prop Hunt X2Z will SOON change it's versioning from "X2Z" to "24XZ" with unique formatted revision versioning.**
Example: `VERSION = "24XZ" REVISION = "XZ24.0105A"` where: `XZ24`: X2Z/YY, `0105`: DD/MM, `A`: Quick revisions if occured within same day.

## Revision 17.07.2024
- Re-enabled back a function where you can use accurate prop's hull rather than rounding them.
- Added ConVar "ph_tmp_accurate_hull" (Enabled by Default) for Accurate Hull - Turn this off if you have a problem such as getting stuck too often
- Changed restriction that you cannot change into a Prop if Prop's max hull X and Y is less than 0.5 units (before: 1.0 units)

### Known Issues
- If you're trying to use a very thin or tiniest prop (by disabling the restriction in the code) you'll likely have some collission problem from Player's Hull with other objects.
So far, I found that Valve Games are nearly never made a very thin/tiniest prop so this should be safe for 0.5 units restriction. (this probably due to VPhysics Collision rule that the must be 0.5 units thick.)

## Revision 22.05.2024
- Renamed `fretta` base gamemode to `base_phx` to avoid conflicts with other gamemodes.
If you really wanted to include PHX's fretta base into your multi-fretta-gamemode, simply rename the base_phx and base_phx.txt, and `DeriveGamemode('base_phx')` => `DeriveGamemode('fretta')`@`prop_hunt/gamemode/sh_init.lua`. However, I highly recommend to avoid this to prevent any undesired effects. Use at your own risk!
Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**"Prop Hunt: X/X2Z" Was Originally given and created by Wolvindra-Vinzuerio and Only Available Exclusively for Garry's Mod.**

### Versioning
Version: X2Z, Revision: 22/05/2024 (dd/mm/yyyy)
Version: X2Z, Revision: 17/07/2024 (dd/mm/yyyy)

### Public Servers
- Server #1 [U.S]: **74.91.120.8:27015** (Public Stable Server)
Expand Down
21 changes: 14 additions & 7 deletions gamemodes/prop_hunt/gamemode/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ function GM:PlayerExchangeProp(pl, ent)
pl:PHXChatInfo("ERROR", "PHX_PROP_IS_BANNED")
elseif IsValid(ent:GetPhysicsObject()) && (pl.ph_prop:GetModel() != ent:GetModel() || pl.ph_prop:GetSkin() != ent:GetSkin()) then

-- Disallow props that has maximum bounding box's less than 1 units.
if math.Max(ent:OBBMaxs().x, ent:OBBMaxs().y) <= 1 then
-- Disallow props that has maximum bounding box's less than 0.5 units (originally 1 but because we have "ph_tmp_accurate_hull" convar )
if math.Max(ent:OBBMaxs().x, ent:OBBMaxs().y) <= 0.5 then
pl:PHXChatInfo("ERROR", "PHX_PROP_TOO_THIN")
return
end
Expand Down Expand Up @@ -647,6 +647,7 @@ function GM:PlayerExchangeProp(pl, ent)
pl:EnablePropPitchRot( true )

local OffsetMult = PHX:GetCVar( "ph_prop_viewoffset_mult" )
local UseFullHull = PHX:GetCVar( "ph_tmp_accurate_hull" )

if PHX:GetCVar( "ph_sv_enable_obb_modifier" ) && ent:GetNWBool("hasCustomHull",false) then
local hmin = ent.m_Hull[1]
Expand All @@ -662,21 +663,27 @@ function GM:PlayerExchangeProp(pl, ent)

pl:SetHull(hmin,hmax)
pl:SetHullDuck(hmin,hmax)
local xymax = math.Round(math.Max(hmax.x,hmax.y))
local vMax = math.Max(hmax.x,hmax.y)
local xymax = UseFullHull and vMax or math.Round(vMax)
pl:PHSendHullInfo( xymax*-1, xymax, hmax.z, new_health )
else
local hullxymax = math.Round(math.Max(ent:OBBMaxs().x, ent:OBBMaxs().y))
local vMax = math.Max(ent:OBBMaxs().x, ent:OBBMaxs().y)
local vMaxZ = ent:OBBMaxs().z-ent:OBBMins().z

local hullxymax = UseFullHull and vMax or math.Round(vMax)
local hullxymin = hullxymax * -1
local hullz = math.Round(ent:OBBMaxs().z-ent:OBBMins().z) * OffsetMult
local hullz = (UseFullHull and vMaxZ or math.Round(vMaxZ)) * OffsetMult

if ent:GetClass() == "prop_ragdoll" then -- Optional (but Better): Add 'PHX:GetCVar( "ph_usable_prop_type" ) >= 3' for extra checks.
-- We'll use GetModelBounds() instead of using CollisionBounds or OBBMins/Maxs.
-- Reason because is that ragdoll's Coll/OBBs bounds values are always changing when they move.
local mins,maxs = ent:GetModelBounds()

hullxymax = math.Round( math.Max( maxs.x, maxs.y) )
local vRagMax = math.Max( maxs.x, maxs.y)
local vRagMaxZ = maxs.z-mins.z
hullxymax = UseFullHull and vRagMax or math.Round( vRagMax )
hullxymin = hullxymax * -1
hullz = math.Round(maxs.z-mins.z) * OffsetMult
hullz = (UseFullHull and vRagMaxZ or math.Round(vRagMaxZ)) * OffsetMult

-- Override health back to 100 and set their solid back to BBOX.
pl.ph_prop:SetSolid(SOLID_BBOX)
Expand Down
1 change: 1 addition & 0 deletions gamemodes/prop_hunt/gamemode/sh_convar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ CreateConVar( "ph_kick_non_admin_access", "0", {FCVAR_SERVER_CAN_EXECUTE,FCVAR_A

local CVAR = {}
CVAR["ph_show_splash_screen"] = { CTYPE_BOOL, "1", CVAR_SERVER_ONLY, "Show Splash Screen upon joining." }
CVAR["ph_tmp_accurate_hull"] = { CTYPE_BOOL, "1", CVAR_SERVER_ONLY, "(Experimental) Enable accurate hull size instead of rounding them.\nNote: You may able to stick on walls but it may cause some problems, use with caution." }

CVAR["ph_include_default_taunt"] = { CTYPE_BOOL, "1", CVAR_SERVER_ONLY, "Should we Include default stock PH:X taunt from the gamemode?" }
CVAR["ph_taunt_soundlevel"] = { CTYPE_NUMBER, "6", CVAR_SERVER_ONLY, "Taunt SoundLevel to use, value must from 1 to 6.\n1=75dB\n2=80dB\n3=85dB\n4=90dB\n5=95dB\n6=100dB - this is default.", { min = 1, max = 6 } }
Expand Down
2 changes: 1 addition & 1 deletion gamemodes/prop_hunt/gamemode/sh_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ IS_PHX = true -- an easy check if PHX is installed.

PHX.ConfigPath = "phx_data"
PHX.VERSION = "X2Z"
PHX.REVISION = "22.05.24" --Format: dd/mm/yy.
PHX.REVISION = "17.07.24" --Format: dd/mm/yy.

--Include Languages
PHX.LANGUAGES = {}
Expand Down
4 changes: 2 additions & 2 deletions updates/update.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version":"X2Z",
"revision":"22.05.24",
"revision":"17.07.24",
"url":"https:\/\/gmodgameservers.com\/prophuntx\/changelogs",
"notice":"May 2024 Taunt Behaviour Updates and other fixes\nFor more info: https:\/\/gmodgameservers.com\/prophuntx\/changelogs"
"notice":"July 17: Re-added back for accurate hull function and minor tweaks.\nFor more info: https:\/\/gmodgameservers.com\/prophuntx\/changelogs"
}

0 comments on commit 28285cb

Please sign in to comment.