class ClassSource
Part of Enforce script essentials
Super root of all classes in Enforce script
Methods 10
Returns true when instance is of the type, or inherited one.
type- Class type
Returns: bool true when 'clType' is the same as 'type', or inherited one.
if (inst && inst.IsInherited(Widget))
{
Print("inst is inherited from Widget class!");
}proto native owned external string ClassName()Returns name of class-type
inst- Class
Returns: string class-type
Man player = g_Game.GetPlayer();
string className = player.ClassName();
Print(className);
>> className = 'Man'Show 30 more
, ActionCraftBoltsFeather.OnStartServer(), ActionMountBarbedWire.GetAdminLogMessage(), ActionSortAmmoPile.SortAmmo(), ActionUnmountBarbedWire.GetAdminLogMessage(), ActionUseUndergroundPanel.ActionCondition(), AgentBase.GetName(), CachedEquipmentStorage.LogMessage(), GetDebugName(), Edible_Base.FilterAgents(), Edible_Base.PrintNutritionsData(), Fireplace.OnIgnitedThis(), HudDebugWinHealth.InitEntityEntries(), Icon.CheckIsMagazineEx(), InfectedSoundEventBase.Play(), InfectedSoundEventHandler.PlayRequest(), Magazine.Magazine(), ModifierBase.GetName(), NotifierBase.GetName(), PlayerSoundEventHandler.PlayRequestEx(), PluginAdminLog.TotemFlagChange(), PluginBase.GetModuleName(), PluginRecipesManager.RegisterRecipe(), PluginSceneManager.ExecuteEnforceScript(), PresetSpawnBase.FindAndTakeToHandsFromInventory(), PresetSpawnBase.FindItem(), ReplaceSoundEventHandler.PlayReplaceSound(), ScriptConsoleItemsTab.ListItemRelatedActions(), SymptomBase.GetName(), SymptomManager.SpawnSymptom(), and TFCaller.GetTestEx()string GetDebugName()Show 3 more
, SEffectManager.Cleanup(), SEffectManager.EffectRegister(), and TFCaller.Run()proto native external typename Type()Returns typename of object's class
Returns: typename class-type
Man player = g_Game.GetPlayer();
typename type = player.Type();
Print(type.ToString());
>> 'Man'proto external static typename StaticType()Returns typename of object's reference
Returns: typename class-type
EntityAI e;
Print(e.StaticType());
>> 'EntityAI'Returns typename of class even without a variable or instance
Returns: typename class-type
typename eAITypename = StaticGetType(EntityAI);proto external string ToString()Try to safely down-cast base class to child class.
Returns: down-casted 'from' pointer when cast is successfull (classes are related), or null if casting is invalid
// assume that Man inheites from Object
Object obj = g_Game.GetPlayer();
Man player = Man.Cast(obj);
if (player)
{
// horay!
}Try to safely down-cast base class to child class.
Returns: bool true when 'from' is not null and cast successfull, false when casting is not valid or 'from' is null
// assume that Man inheites from Object
Object obj = g_Game.GetPlayer();
Man player;
if (Class.CastTo(player, obj))
{
// horay!
}