Skip to content

Commit

Permalink
Fixes and additions
Browse files Browse the repository at this point in the history
  • Loading branch information
rafradek committed Aug 31, 2024
1 parent 910b924 commit e6a6cee
Show file tree
Hide file tree
Showing 55 changed files with 4,136 additions and 465 deletions.
3 changes: 2 additions & 1 deletion PackageScript
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ if not Extension.optimize_mods_only:
# Translation files
CopyFiles('translations', 'addons/sourcemod/translations',
[
'sigsegv.phrases.txt'
'sigsegv.phrases.txt',
'sigsegvattributes.phrases.txt'
]
)

Expand Down
5 changes: 5 additions & 0 deletions gamedata/sigsegv/NextBotManager.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
sym "_ZN14NextBotManager12ShouldUpdateEP8INextBot"
}

"NextBotManager::OnWeaponFired"
{
type "sym"
sym "_ZN14NextBotManager13OnWeaponFiredEP20CBaseCombatCharacterP17CBaseCombatWeapon"
}
}
}
}
Expand Down
13 changes: 11 additions & 2 deletions gamedata/sigsegv/custom_attributes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@
{
"name" "mult max overheal self"
"attribute_class" "mult_max_ovelheal_self"
"description_string" "overheal from heal on kill"
"description_string" "(+-)%p% max overheal on self"
"description_format" "value_is_percentage"
"hidden" "0"
"effect_type" "positive"
Expand Down Expand Up @@ -3728,5 +3728,14 @@
"effect_type" "positive"
"stored_as_integer" "0"
}

"4693"
{
"name" "fire input on hit ally"
"attribute_class" "fire_input_on_hit_ally"
"attribute_type" "string"
"description_string" "%d"
"description_format" "value_is_additive"
"hidden" "1"
"effect_type" "positive"
}
}
39 changes: 39 additions & 0 deletions gamedata/sigsegv/misc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,11 @@
type "sym"
sym "_Z26TE_TFParticleEffectComplexR16IRecipientFilterfPKc6Vector6QAngleP31te_tf_particle_effects_colors_tP38te_tf_particle_effects_control_point_tP11CBaseEntity20ParticleAttachment_tS3_"
}
"TE_TFParticleEffect [No attachment]"
{
type "sym"
sym "_Z19TE_TFParticleEffectR16IRecipientFilterfPKc6VectorS3_6QAngleP11CBaseEntity"
}

"DoTeleporterOverride"
{
Expand Down Expand Up @@ -3116,6 +3121,40 @@
type "sym"
sym "_ZN47CEconItemAttributeIterator_ApplyAttributeString23OnIterateAttributeValueEPK28CEconItemAttributeDefinitionRK17CAttribute_String"
}

"CAttributeIterator_GetTypedAttributeValue::OnIterateAttributeValue"
{
type "sym"
sym "_ZN41CAttributeIterator_GetTypedAttributeValueI17CAttribute_StringS0_E23OnIterateAttributeValueEPK28CEconItemAttributeDefinitionRKS0_"
}

"COM_CompressBuffer_LZSS"
{
lib "engine"
type "sym"
sym "_Z23COM_CompressBuffer_LZSSPKvjPjj"
}

"COM_CompressBuffer_Snappy"
{
lib "engine"
type "sym"
sym "_Z25COM_CompressBuffer_SnappyPKvjPjj"
}

"COM_BufferToBufferDecompress"
{
lib "engine"
type "sym"
sym "_Z28COM_BufferToBufferDecompressPvPjPKvj"
}

"COM_GetUncompressedSize"
{
lib "engine"
type "sym"
sym "_Z23COM_GetUncompressedSizePKvj"
}

}
"addrs_group"
Expand Down
6 changes: 6 additions & 0 deletions gamedata/sigsegv/tfplayer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,11 @@
type "sym"
sym "_ZN9CTFPlayer16OnTauntSucceededEPKcii"
}
"CTFPlayer::StopTaunt"
{
type "sym"
sym "_ZN9CTFPlayer9StopTauntEb"
}

// "GetTFConditionName"
// {
Expand Down Expand Up @@ -1137,6 +1142,7 @@
"CTFPlayerShared::OnRemoveTeleported" "_ZN15CTFPlayerShared18OnRemoveTeleportedEv"
"CTFPlayerShared::RemoveAllCond" "_ZN15CTFPlayerShared13RemoveAllCondEv"
"CTFPlayerShared::RecalculatePlayerBodygroups" "_ZN15CTFPlayerShared27RecalculatePlayerBodygroupsEv"
"CTFPlayerShared::ConditionThink" "_ZN15CTFPlayerShared14ConditionThinkEv"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion hl2sdk-manifests
23 changes: 20 additions & 3 deletions scripts/library.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ function CEntity:GetAllAttributeValues(checkDefinition) end
function CEntity:GetItemName() end

--Returns item name displayed in game
---@param player? Optional player entity for localized item name
---@return string name Item name displayed in game
function CEntity:GetItemNameForDisplay() end
function CEntity:GetItemNameForDisplay(player) end

--Returns a table containing all player items
---@return table items Table containing all items
Expand Down Expand Up @@ -520,14 +521,16 @@ function ents.FindAllByClass(classname) end
--Finds all entities in a box
---@param mins Vector Starting box coordinates
---@param maxs Vector Ending box coordinates
---@param classname ?string Optional classname filter
---@return table entities All entities that matched the criteria
function ents.FindInBox(mins, maxs) end
function ents.FindInBox(mins, maxs, classname) end

--Finds all entities in a sphere
---@param center Vector Sphere center coordinates
---@param radius number Sphere radius
---@param classname ?string Optional classname filter
---@return table entities All entities that matched the criteria
function ents.FindInSphere(center, radius) end
function ents.FindInSphere(center, radius, classname) end

--Returns first entity
---@return Entity first First entity in the list
Expand Down Expand Up @@ -656,6 +659,20 @@ function util.GetAttributeDefinitionNameByIndex(id) end
---@return number|nil id Id of the attribute with specified name or nil if not found
function util.GetAttributeDefinitionIndexByName(name) end

--Returns display string of given item definition name or index
---@param name number|string item definition name or index
---@param player? Entity Optional player entity for localization
---@return string|nil name Display name for an item or nil if definiton name or index is not valid
function util.GetItemNameForDisplay(name, player) end

--Returns formatted attribute string for display, optionally with localization
---@param name number|string Attribute name or index
---@param value number|string Attribute value
---@param player? Entity Optional player entity for localization
---@param short? boolean `= false`. Displays attribute in shorter format (as in upgrade menu), when supported
---@return string|nil str Formatted attribute string for display or nil if attribute name or index is not valid
function util.FormatItemAttributeDisplayString(name, value, player, short) end

--Check if lag compensation is active. Lag compensation allows traces fired from player eyes to be more accurate with what the player can see
---@return boolean
function util.IsLagCompensationActive() end
Expand Down
9 changes: 6 additions & 3 deletions scripts/mvm_bigrock_sigdemo.pop
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ WaveSchedule
}
upgrade
{
Name "+25 max health" // Name of the upgrade displayed on the menu
// Name "+25 max health" // Custom name of the upgrade displayed on the menu. If absent, uses the attribute localized name instead
Attribute "max health additive bonus" // The attribute name
Cap 200 // Maximum amount of the attribute
Increment 25 // Attribute increment value per level
Expand All @@ -530,7 +530,6 @@ WaveSchedule
}
upgrade
{
Name "-25% damage penalty"
Attribute "damage penalty"
Cap 0.5
Increment -0.25
Expand Down Expand Up @@ -1486,6 +1485,7 @@ WaveSchedule
RingOfFire 15 [$SIGSEGV] //Enable Ring of Fire from Huo Long Heater. Value is damage done by the ring
PreferClass Sniper // Prefer those classes over other
PreferClass Spy
PreferTeam Spectator // Prefer targets of those teams: Red, Blue, Spectator, Unassigned or a number
}
}
WaveSpawn
Expand Down Expand Up @@ -3683,4 +3683,7 @@ WaveSchedule
// "flare no crit burning" 1

// Scale for damage being received
// "rage receive scale" 2
// "rage receive scale" 2

// Fire input on hit allied players. May require allow friendly fire to work. The player is the activator. The format is <target>^<input>^<param>. If omitted, default param is damage received. !projectile is the projectile entity
// "fire input on hit ally" "!self^SetHealth^0"
5 changes: 5 additions & 0 deletions src/extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ IClientMode *g_pClientMode = nullptr;

IPhraseCollection *phrases = nullptr;
IPhraseFile *phrasesFile = nullptr;
IPhraseCollection *phrasesAttribs = nullptr;
IPhraseFile *phrasesAttribsFile = nullptr;

bool CExtSigsegv::SDK_OnLoad(char *error, size_t maxlength, bool late)
{
Expand Down Expand Up @@ -123,6 +125,9 @@ bool CExtSigsegv::SDK_OnLoad(char *error, size_t maxlength, bool late)
phrases = translator->CreatePhraseCollection();
phrasesFile = phrases->AddPhraseFile("sigsegv.phrases");

phrasesAttribs = translator->CreatePhraseCollection();
phrasesAttribsFile = phrases->AddPhraseFile("sigsegvattributes.phrases");

identity = sharesys->CreateIdentity(sharesys->CreateIdentType("Sigsegv"), this);
// for (int i = 0; i < 255; ++i) {
// ConColorMsg(Color(0xff, i, 0x00), "%02x%02x%02x\n", 0xff, i, 0x00);
Expand Down
3 changes: 3 additions & 0 deletions src/extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class CExtSigsegv :

extern IPhraseCollection *phrases;
extern IPhraseFile *phrasesFile;
extern IPhraseCollection *phrasesAttribs;
extern IPhraseFile *phrasesAttribsFile;

extern CExtSigsegv g_Ext;


Expand Down
2 changes: 1 addition & 1 deletion src/mem/detour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ void CFuncVProf::TracePost()
}
}

constexpr bool s_bGameHasOptimizedVirtuals = false;// = SOURCE_ENGINE == SE_TF2;
constexpr bool s_bGameHasOptimizedVirtuals = SOURCE_ENGINE == SE_TF2;

CDetouredFunc::CDetouredFunc(void *func_ptr) :
m_pFunc(reinterpret_cast<uint8_t *>(func_ptr))
Expand Down
2 changes: 1 addition & 1 deletion src/mod/ai/npc_nextbot/npc_nextbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ namespace Mod::AI::NPC_Nextbot
}

this->m_pEntity->SetModel(model);
if (this->m_bUsePlayerBounds = this->m_pEntity->GetCustomVariableBool<"useplayercollisionbounds">()) {
if (this->m_bUsePlayerBounds = this->m_pEntity->GetCustomVariableBool<"useplayercollisionbounds">(modelOverride == nullptr)) {
UTIL_SetSize(this->m_pEntity, &VEC_HULL_MIN, &VEC_HULL_MAX);
}
this->SetEyeOffset();
Expand Down
2 changes: 1 addition & 1 deletion src/mod/ai/npc_nextbot/npc_nextbot_body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ namespace Mod::AI::NPC_Nextbot
{
auto mod = GetNextbotModuleBody(reinterpret_cast<CBotNPCBody *>(this));
auto prop = mod->m_pEntity->CollisionProp();
return prop->OBBMaxs().x - prop->OBBMins().x;
return Max(prop->OBBMaxs().x - prop->OBBMins().x, prop->OBBMaxs().y - prop->OBBMins().y);
}

VHOOK_DECL(float, MyNextbotBody_GetHullHeight)
Expand Down
30 changes: 21 additions & 9 deletions src/mod/ai/npc_nextbot/npc_nextbot_unlag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,35 @@ namespace Mod::AI::NPC_Nextbot
Vector delta = entity->GetAbsOrigin() - vWantedPos;
//Msg("Lag comp restore pos %f %f %f\n", delta.x, delta.y, delta.z);
CTraceFilterSimple filter(entity, entity->GetCollisionGroup());
Vector mins = entity->CollisionProp()->OBBMins();
Vector maxs = entity->CollisionProp()->OBBMaxs();
mins.z = Min(mins.z + 6.0f, maxs.z);
Vector mins;
Vector maxs;

auto bot = entity->MyNextBotPointer();
if (bot != nullptr) {
auto body = bot->GetBodyInterface();
auto loco = bot->GetLocomotionInterface();
mins = body->GetHullMins();
maxs = body->GetHullMaxs();
if (loco->IsOnGround()) {
mins += loco->GetStepHeight();
}
mins.z = Min(maxs.z - 2.0f, mins.z);
}
else {
Vector mins = entity->CollisionProp()->OBBMins();
Vector maxs = entity->CollisionProp()->OBBMaxs();
}

UTIL_TraceHull(vWantedPos, vWantedPos, mins, maxs, solidMask, &filter, &tr);
//Msg("ToGroundDiff %f\n", vWantedPos.z - tr.endpos.z);
//UTIL_TraceEntity( entity, vWantedPos+ Vector(0,0,1.0f), vWantedPos+ Vector(0,0,1.0f), solidMask, entity, entity->GetCollisionGroup(), &tr );
if ( tr.startsolid || tr.allsolid )
{
if (tr.m_pEnt != nullptr) {
Msg("Lag comp restore fail %s\n", tr.m_pEnt->GetClassname());
}
UTIL_TraceEntity( entity, entity->GetLocalOrigin(), vWantedPos, solidMask, entity, entity->GetCollisionGroup(), &tr );
if ( tr.startsolid || tr.allsolid )
{

// The entity was always stuck. Assume it was intentionally like this
entity->SetLocalOrigin(vWantedPos);
}
else
{
Expand All @@ -84,7 +98,6 @@ namespace Mod::AI::NPC_Nextbot
{
// Cool, the player can go back to whence he came.
entity->SetLocalOrigin(tr.endpos);
Msg("Lag comp restore success %f %f %f\n", delta.x, delta.y, delta.z);
}
}

Expand Down Expand Up @@ -345,7 +358,6 @@ namespace Mod::AI::NPC_Nextbot
for (LagCompensatedEntity *lagcompent : AutoList<LagCompensatedEntity>::List()) {
auto entity = lagcompent->entity;

Msg("Lag comp restore %d\n", lagcompent->restore);
if (!lagcompent->restore) continue;

LagRecord *restore = &lagcompent->restoreData;
Expand Down
Loading

0 comments on commit e6a6cee

Please sign in to comment.