plugins/include/sourcemod.inc
changeset 2841 dde3dd0b4b8b
parent 2675 1502dc625325
child 2901 f5a1cf24f505
     1.1 --- a/plugins/include/sourcemod.inc	Wed Oct 28 00:31:48 2009 -0700
     1.2 +++ b/plugins/include/sourcemod.inc	Wed Oct 28 00:37:34 2009 -0700
     1.3 @@ -411,16 +411,6 @@
     1.4  native AutoExecConfig(bool:autoCreate=true, const String:name[]="", const String:folder[]="sourcemod");
     1.5  
     1.6  /**
     1.7 - * Sets a native as optional, such that if it is unloaded, removed,
     1.8 - * or otherwise non-existent, the plugin will still work.  Calling
     1.9 - * removed natives results in a run-time error.
    1.10 - *
    1.11 - * @param name			Native name.
    1.12 - * @noreturn
    1.13 - */
    1.14 -native MarkNativeAsOptional(const String:name[]);
    1.15 -
    1.16 -/**
    1.17   * Registers a library name for identifying as a dependency to 
    1.18   * other plugins.
    1.19   *
    1.20 @@ -565,6 +555,81 @@
    1.21   */
    1.22  forward OnClientFloodResult(client, bool:blocked);
    1.23  
    1.24 +/**
    1.25 + * Feature types.
    1.26 + */
    1.27 +enum FeatureType
    1.28 +{
    1.29 +	/**
    1.30 +	 * A native function call.
    1.31 +	 */
    1.32 +	FeatureType_Native,
    1.33 +	
    1.34 +	/**
    1.35 +	 * A named capability. This is distinctly different from checking for a
    1.36 +	 * native, because the underlying functionality could be enabled on-demand
    1.37 +	 * to improve loading time. Thus a native may appear to exist, but it might
    1.38 +	 * be part of a set of features that are not compatible with the current game
    1.39 +	 * or version of SourceMod.
    1.40 +	 */
    1.41 +	FeatureType_Capability
    1.42 +};
    1.43 +
    1.44 +/**
    1.45 + * Feature statuses.
    1.46 + */
    1.47 +enum FeatureStatus
    1.48 +{
    1.49 +	/**
    1.50 +	 * Feature is available for use.
    1.51 +	 */
    1.52 +	FeatureStatus_Available,
    1.53 +	
    1.54 +	/**
    1.55 +	 * Feature is not available.
    1.56 +	 */
    1.57 +	FeatureStatus_Unavailable,
    1.58 +	
    1.59 +	/**
    1.60 +	 * Feature is not known at all.
    1.61 +	 */
    1.62 +	FeatureStatus_Unknown
    1.63 +};
    1.64 +
    1.65 +/**
    1.66 + * Returns whether "GetFeatureStatus" will work. Using this native
    1.67 + * or this function will not cause SourceMod to fail loading on older versions,
    1.68 + * however, GetFeatureStatus will only work if this function returns true.
    1.69 + *
    1.70 + * @return              True if GetFeatureStatus will work, false otherwise.
    1.71 + */
    1.72 +stock bool:CanTestFeatures()
    1.73 +{
    1.74 +	return LibraryExists("__CanTestFeatures__");
    1.75 +}
    1.76 +
    1.77 +/**
    1.78 + * Returns whether a feature exists, and if so, whether it is usable.
    1.79 + *
    1.80 + * @param type          Feature type.
    1.81 + * @param name          Feature name.
    1.82 + * @return              Feature status.
    1.83 + */
    1.84 +native FeatureStatus:GetFeatureStatus(FeatureType:type, const String:name[]);
    1.85 +
    1.86 +/**
    1.87 + * Requires that a given feature is available. If it is not, SetFailState()
    1.88 + * is called with the given message.
    1.89 + *
    1.90 + * @param type          Feature type.
    1.91 + * @param name          Feature name.
    1.92 + * @param fmt           Message format string, or empty to use default.
    1.93 + * @param ...           Message format parameters, if any.
    1.94 + * @noreturn
    1.95 + */
    1.96 +native RequireFeature(FeatureType:type, const String:name[],
    1.97 +                      const String:fmt[]="", any:...);
    1.98 +
    1.99  #include <helpers>
   1.100  #include <entity>
   1.101  #include <entity_prop_stocks>