Skip to content

Commit 45247c4

Browse files
committed
added new achievements
1 parent 334e189 commit 45247c4

File tree

11 files changed

+81
-2
lines changed

11 files changed

+81
-2
lines changed

game/quiver/info_changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Quiver Private Alpha 1.1.0:
88
- Overdrive: Kill 6 players in a single life with no armor.
99
- The Ol' Show-And-Tell! - Smash an enemy player's head in with your Ullapool Caber. Literally.
1010
- Assassinating the Assassin - Headshot a Sniper with your Hitman's Executioner.
11-
- Bot names now load from a bot_name.txt file.
11+
- Winstick - Get 2 unscoped headshots with your Railgun in a single life.
12+
- Bot names now load from a bot_names.txt file.
1213
- Fixed animated avatars not playing.
1314
- Updated the logo art.
1415
- The Quick Fix now can heal surrounding teammates with its Ubercharge.
Binary file not shown.
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"UnlitGeneric"
2+
{
3+
"$baseTexture" "vgui/achievements/QUIVER_RAILGUNHEADSHOT"
4+
}
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"UnlitGeneric"
2+
{
3+
"$baseTexture" "vgui/achievements/QUIVER_RAILGUNHEADSHOT_BW"
4+
}
Binary file not shown.
294 Bytes
Binary file not shown.

src/game/shared/quiver/achievements_quiver.cpp

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,72 @@ class CAchievementQuiver_Assassination : public CBaseTFAchievement
134134
};
135135
DECLARE_ACHIEVEMENT(CAchievementQuiver_Assassination, ACHIEVEMENT_QUIVER_KILLINGHITMAN, "QUIVER_KILLINGHITMAN", 5);
136136

137+
class CAchievementQuiver_RailgunHeadshot : public CBaseTFAchievement
138+
{
139+
void Init()
140+
{
141+
SetFlags(ACH_LISTEN_KILL_EVENTS | ACH_SAVE_GLOBAL);
142+
SetGoal(1);
143+
m_iConsecutiveKills = 0;
144+
}
145+
146+
virtual void ListenForEvents()
147+
{
148+
ListenForGameEvent("teamplay_round_active");
149+
ListenForGameEvent("localplayer_respawn");
150+
}
151+
152+
void FireGameEvent_Internal(IGameEvent* event)
153+
{
154+
if (FStrEq(event->GetName(), "teamplay_round_active"))
155+
{
156+
m_iConsecutiveKills = 0;
157+
}
158+
else if (FStrEq(event->GetName(), "localplayer_respawn"))
159+
{
160+
m_iConsecutiveKills = 0;
161+
}
162+
}
163+
164+
virtual void Event_EntityKilled(CBaseEntity* pVictim, CBaseEntity* pAttacker, CBaseEntity* pInflictor, IGameEvent* event)
165+
{
166+
C_BasePlayer* pLocalPlayer = C_BasePlayer::GetLocalPlayer();
167+
if (pLocalPlayer == pVictim)
168+
{
169+
m_iConsecutiveKills = 0;
170+
}
171+
else if (pLocalPlayer == pAttacker && event->GetInt("weaponid") == TF_WEAPON_SNIPERRIFLE_CLASSIC)
172+
{
173+
C_TFPlayer* pTFAttacker = ToTFPlayer(pAttacker);
174+
if (pTFAttacker)
175+
{
176+
if (FStrEq(event->GetString("weapon_logclassname", ""), "railgun"))
177+
{
178+
if (IsHeadshot(event->GetInt("customkill")))
179+
{
180+
// don't increment if we're zoomed in.
181+
if (!pTFAttacker->m_Shared.InCond(TF_COND_ZOOMED))
182+
{
183+
m_iConsecutiveKills++;
184+
if (m_iConsecutiveKills >= GetNumKillsNeeded())
185+
{
186+
IncrementCount();
187+
}
188+
}
189+
}
190+
}
191+
}
192+
}
193+
}
194+
195+
virtual int GetNumKillsNeeded(void)
196+
{
197+
return 2;
198+
}
199+
200+
private:
201+
int m_iConsecutiveKills;
202+
};
203+
DECLARE_ACHIEVEMENT(CAchievementQuiver_RailgunHeadshot, ACHIEVEMENT_QUIVER_RAILGUNHEADSHOT, "QUIVER_RAILGUNHEADSHOT", 5);
204+
137205
#endif // CLIENT_DLL

src/game/shared/quiver/achievements_quiver_list.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ ACHIEVEMENT_LIST(CAchievementQuiver_KillsWith0Armor, ACHIEVEMENT_QUIVER_KILL3WIT
22
ACHIEVEMENT_LIST(CAchievementQuiver_KillsWith0ArmorLarge, ACHIEVEMENT_QUIVER_KILL6WITHARMORAT0, "QUIVER_KILL6WITHARMORAT0", 5)
33
ACHIEVEMENT_LIST(CAchievementQuiver_CaberKill, ACHIEVEMENT_QUIVER_CABERTAUNTKILL, "QUIVER_CABERTAUNTKILL", 5)
44
ACHIEVEMENT_LIST(CAchievementQuiver_Assassination, ACHIEVEMENT_QUIVER_KILLINGHITMAN, "QUIVER_KILLINGHITMAN", 5)
5+
ACHIEVEMENT_LIST(CAchievementQuiver_RailgunHeadshot, ACHIEVEMENT_QUIVER_RAILGUNHEADSHOT, "QUIVER_RAILGUNHEADSHOT", 5)

0 commit comments

Comments
 (0)