@ -48,6 +48,9 @@ All rights reserved.
# include "ItemDrop.h"
# include "ItemDrop.h"
# include "SoundEffect.h"
# include "SoundEffect.h"
# include "Unlock.h"
# include "Unlock.h"
# ifndef __EMSCRIPTEN__
# include <isteamuserstats.h>
# endif
INCLUDE_ANIMATION_DATA
INCLUDE_ANIMATION_DATA
INCLUDE_MONSTER_DATA
INCLUDE_MONSTER_DATA
@ -726,6 +729,25 @@ void Monster::OnDeath(){
Unlock : : IncreaseKillCount ( ) ;
Unlock : : IncreaseKillCount ( ) ;
if ( SteamUserStats ( ) ) {
for ( auto & [ key , size ] : DATA . GetProperty ( " Achievement.Kill Unlocks " ) ) {
//Monster-specific achievement unlocks.
datafile & unlock = DATA . GetProperty ( std : : format ( " Achievement.Kill Unlocks.{} " , key ) ) ;
if ( unlock . HasProperty ( " Monster Name " ) ) {
if ( unlock [ " Monster Name " ] . GetString ( ) ! = GetName ( ) ) continue ;
if ( unlock . HasProperty ( " Time Limit " ) & & isBoss ) {
if ( game - > GetEncounterDuration ( ) < = unlock [ " Time Limit " ] . GetReal ( ) ) {
SteamUserStats ( ) - > SetAchievement ( unlock [ " API Name " ] . GetString ( ) . c_str ( ) ) ;
SteamUserStats ( ) - > StoreStats ( ) ;
}
} else {
SteamUserStats ( ) - > SetAchievement ( unlock [ " API Name " ] . GetString ( ) . c_str ( ) ) ;
SteamUserStats ( ) - > StoreStats ( ) ;
}
}
}
}
if ( hasStrategyDeathFunction ) {
if ( hasStrategyDeathFunction ) {
GameEvent : : AddEvent ( std : : make_unique < MonsterStrategyGameEvent > ( strategyDeathFunc , * this , MONSTER_DATA [ name ] . GetAIStrategy ( ) ) ) ;
GameEvent : : AddEvent ( std : : make_unique < MonsterStrategyGameEvent > ( strategyDeathFunc , * this , MONSTER_DATA [ name ] . GetAIStrategy ( ) ) ) ;
}
}