Skip to content

Commit

Permalink
Rework stun mechanics from upgrades (#31)
Browse files Browse the repository at this point in the history
* Reduce various stunning upgrade effects

* Revert "Fix console warning spam from func_upgradestation"

This reverts commit 66cc8a6.

* Some optimizations

* Don't change initiator

* Fix backstabs against RED players not working

* Bump version
  • Loading branch information
Mikusch authored Mar 27, 2023
1 parent 66cc8a6 commit d913e5e
Show file tree
Hide file tree
Showing 4 changed files with 260 additions and 41 deletions.
80 changes: 80 additions & 0 deletions addons/sourcemod/gamedata/mannvsmann.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@
"linux" "@_ZN16CTFPowerupBottle12AllowedToUseEv"
"windows" "\xA1\x2A\x2A\x2A\x2A\x57\x8B\xF9\x85\xC0\x74\x2A\x8B\x80\x88\x03\x00\x00"
}
"CTFKnife::CanPerformBackstabAgainstTarget"
{
"linux" "@_ZN8CTFKnife31CanPerformBackstabAgainstTargetEP9CTFPlayer"
"windows" "\x55\x8B\xEC\x51\x56\x8B\x75\x08\x57\x8B\xF9\x85\xF6\x75\x2A\x5F"
}
"CTFBaseRocket::CheckForStunOnImpact"
{
"linux" "@_ZN13CTFBaseRocket20CheckForStunOnImpactEP9CTFPlayer"
"windows" "\x55\x8B\xEC\x83\xEC\x30\x53\x56\x8B\xF1\x57\x80\xBE\x01\x05\x00\x00\x00"
}
"CTFSniperRifle::ExplosiveHeadShot"
{
"linux" "@_ZN14CTFSniperRifle17ExplosiveHeadShotEP9CTFPlayerS1_"
"windows" "\x55\x8B\xEC\x81\xEC\xEC\x00\x00\x00\x53\x8B\x5D\x08"
}
"UTIL_RemoveImmediate"
{
"linux" "@_Z20UTIL_RemoveImmediateP11CBaseEntity"
Expand Down Expand Up @@ -172,6 +187,11 @@
"linux" "481"
"windows" "474"
}
"CTFStunBall::ApplyBallImpactEffectOnVictim"
{
"linux" "267"
"windows" "266"
}
"CTFGameRules::SetWinningTeam"
{
"linux" "165"
Expand Down Expand Up @@ -421,6 +441,52 @@
"return" "bool"
"this" "entity"
}
"CTFKnife::CanPerformBackstabAgainstTarget"
{
"signature" "CTFKnife::CanPerformBackstabAgainstTarget"
"callconv" "thiscall"
"return" "bool"
"this" "entity"
"arguments"
{
"pTarget"
{
"type" "cbaseentity"
}
}
}
"CTFBaseRocket::CheckForStunOnImpact"
{
"signature" "CTFBaseRocket::CheckForStunOnImpact"
"callconv" "thiscall"
"return" "void"
"this" "entity"
"arguments"
{
"pTarget"
{
"type" "cbaseentity"
}
}
}
"CTFSniperRifle::ExplosiveHeadShot"
{
"signature" "CTFSniperRifle::ExplosiveHeadShot"
"callconv" "thiscall"
"return" "void"
"this" "entity"
"arguments"
{
"pAttacker"
{
"type" "cbaseentity"
}
"pVictim"
{
"type" "cbaseentity"
}
}
}
"CCurrencyPack::MyTouch"
{
"offset" "CCurrencyPack::MyTouch"
Expand Down Expand Up @@ -478,6 +544,20 @@
}
}
}
"CTFStunBall::ApplyBallImpactEffectOnVictim"
{
"offset" "CTFStunBall::ApplyBallImpactEffectOnVictim"
"hooktype" "entity"
"return" "void"
"this" "entity"
"arguments"
{
"pOther"
{
"type" "cbaseentity"
}
}
}
"CTFGameRules::SetWinningTeam"
{
"offset" "CTFGameRules::SetWinningTeam"
Expand Down
24 changes: 4 additions & 20 deletions addons/sourcemod/scripting/mannvsmann.sp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.13.0"
#define PLUGIN_VERSION "1.14.0"

#define DEFAULT_UPGRADES_FILE "scripts/items/mvm_upgrades.txt"

Expand Down Expand Up @@ -150,19 +150,6 @@ enum
NUM_OBSERVER_MODES,
};

// edict->solid values
enum SolidType_t
{
SOLID_NONE = 0, // no solid model
SOLID_BSP = 1, // a BSP tree
SOLID_BBOX = 2, // an AABB
SOLID_OBB = 3, // an OBB (not implemented yet)
SOLID_OBB_YAW = 4, // an OBB, constrained so that it can only yaw
SOLID_CUSTOM = 5, // Always call into the entity for tests
SOLID_VPHYSICS = 6, // solid vphysics object, get vcollide from the model and collide with that
SOLID_LAST,
};

enum
{
RESET_MODE_TEAM_SWITCH = 0,
Expand Down Expand Up @@ -202,6 +189,7 @@ ConVar sm_mvm_upgrades_reset_mode;
ConVar sm_mvm_showhealth;
ConVar sm_mvm_spawn_protection;
ConVar sm_mvm_music_enabled;
ConVar sm_mvm_players_are_minibosses;
ConVar sm_mvm_gas_explode_damage_modifier;
ConVar sm_mvm_explosive_sniper_shot_damage_modifier;
ConVar sm_mvm_medigun_shield_damage_modifier;
Expand Down Expand Up @@ -588,13 +576,9 @@ void SetupOnMapStart()
MvMTeam(team).Reset();
}

// Some upgrades require a valid populator
// Create a populator and an upgrade station, which enable some MvM features
CreateEntityByName("info_populator");

// Set solid type to SOLID_NONE to suppress warnings
int upgradestation = CreateEntityByName("func_upgradestation");
SetEntProp(upgradestation, Prop_Send, "m_nSolidType", SOLID_NONE);
DispatchSpawn(upgradestation);
DispatchSpawn(CreateEntityByName("func_upgradestation"));
}

void TogglePlugin(bool enable)
Expand Down
1 change: 1 addition & 0 deletions addons/sourcemod/scripting/mannvsmann/convars.sp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ void ConVars_Init()
sm_mvm_showhealth = CreateConVar("sm_mvm_showhealth", "0", "When set to 1, shows a floating health icon over enemy players.");
sm_mvm_spawn_protection = CreateConVar("sm_mvm_spawn_protection", "1", "When set to 1, players are granted ubercharge while they leave their spawn.");
sm_mvm_music_enabled = CreateConVar("sm_mvm_music_enabled", "1", "When set to 1, Mann vs. Machine music will play at the start and end of a round.");
sm_mvm_players_are_minibosses = CreateConVar("sm_mvm_players_are_minibosses", "1", "When set to 1, all upgrades will function as if players are MvM giants.");
sm_mvm_gas_explode_damage_modifier = CreateConVar("sm_mvm_gas_explode_damage_modifier", "0.5", "Multiplier to damage of the explosion created by the 'Explode On Ignite' upgrade.");
sm_mvm_explosive_sniper_shot_damage_modifier = CreateConVar("sm_mvm_explosive_sniper_shot_damage_modifier", "1.0", "Multiplier to damage of the explosion created by the 'Explosive Headshot' upgrade.");
sm_mvm_medigun_shield_damage_modifier = CreateConVar("sm_mvm_medigun_shield_damage_modifier", "0", "Multiplier to damage of the shield created by the Medi Gun's 'Projectile Shield' upgrade.");
Expand Down
Loading

0 comments on commit d913e5e

Please sign in to comment.