API Changes SC 5.26 - baso88/SC_AngelScript GitHub Wiki

Changelog

  • Angelscript API updated to version 2.36.1. (See changes here: www.angelcode.com/angelscript/changes.php)
  • Added colour definitions for a wider range of colour palettes: X11/web standard, Windows 20, and Sven Co-op brand.
  • Added CVAR "angelscript_compiler_treat_warnings_as_errors" for configurable compiler warning behaviour:
    • 0: Warnings are printed to console. (New default.)
    • 1: Warnings will be treated as errors, printed to console, and halt script compilation. (Recommended for production releases.)
  • Added hook "PlayerRevived", fired when a player is resurrected by another player or NPC.
  • ASPlayerEntity: Corrected signature of function RemoveAllItems(). The two bool parameters are implicitly false if unspecified.
  • CASPlayerFuncs: Abort ClientPrint() if pPlayer is null.
  • Corrected documentation for BestVisibleEnemy().
  • Corrected documentation for CSprite::Frames(): Returns an int, not a float.
  • Corrected exposed type of CItemInventory::m_szDisplayName to match the actual class member type. (string_t)
  • DateTime objects:
    • Added support for leap second. (Max value is 60 instead of 59.)
    • Added support for daylight savings time flag. (int GetIsDst() and SetIsDst(int)).
    • Corrected range for SetDayOfMonth(int), this should be 1-31 instead of 0-30.
    • Added clamp for SetMonth(int) at 1-12.
    • Corrected documentation for some of these set/get functions, particularly expected value ranges, and alignment with the AngelScript base.
  • Expose CBaseWeapon::Reload(). Only called when Reload() is called.
  • Expose CBaseEntity::OnSetOriginByMap(). This allows you to reset the default position of say a door or "item_inventory" after moving it with your script.
  • Expose CItemInventory::TryCollect(). This is the ideal way to make a potential item holder pick up an "item_inventory" remotely.
  • Expose COLLECT_TYPE enumerator.
  • Expose DROP_TYPE enumerator.
  • Expose EFLAG enumerator and helper functions that can be used by entities to not collide with friendly or to ignore "trigger_gravity".
  • Expose HIDEHUD enumerator.
  • Expose m_dropType so DROP_TYPE enum has something to be used with.
  • Expose missing constants EF_SPRITE_CUSTOM_VP, EF_FULLBRIGHT, and EF_NOSHADOW for the EFFECTS enumeration.
  • Expose MonsterKilled() and MonsterTakeDamage() hooks. (These are equivalent as the player hook counterparts.)
  • Expose the map name that the server is changing to:
    • Hook "MapChange" now receives a string to reveal which map the server is about to change to, or empty if the server is shutting down.
    • ALL scripts listening for this "MapChange" event will need an update. Just add a parameter for a string to receive the new map.
  • Expose VP_TYPE enumerator, with its map counterpart MAP_VP_TYPE.
  • Fixed a crash when attempting to remove an "item_inventory" from a holder, either via Drop(), Return() or Destroy() functions on the item entity.
  • Fixed a crash with Item Mapping arrays if there's a trailing comma at end of the list.
  • Fixed a lot of missing variables from the "item_inventory" documentation. (Mostly for self-activation enabled items.)
  • Fixed a potential crash whereby a script removes a scheduled function from the scheduler but then erases the variable it was stored in (by = null) before the next frame.
  • Fixed model interpolation logic (physics issues):
    • Fixes an issue where the collision logic sometimes thinks an NPC is a player.
    • Fixes players getting gibed if they were standing in corpses near doors or rotating objects.
  • Function CBasePlayer::RemoveAllItems() now takes a second boolean to remove long jump.
    • ALL scripts calling CBasePlayer::RemoveAllItems() will need an update. Just add a boolean true to remove long jump or false to let the player keep it.
  • Player functions: The HUD text parameters channel now matches the behaviour of "game_text" whereby map scripts will be remapped from 1-4 to 5-8 implicitly, so that server plug-ins can remain using channels 1-4 relatively conflict free of map produced messages. (All scripts should continue to use text channels 1-4 as they already do.)
  • Re-think of how server plug-ins are included/excluded on a per-map basis to correct a few quirks across map changes.
    • CVAR "plugin_list_file_persistent" is no longer required and has been removed.
  • RGBA structure:
    • Added constructors to take in a vector with optional alpha channel. (255/opaque assumed if unspecified.)
    • Added function opEquals(): For comparing two RGBA instances.
    • Added function ToString(): To output an RGBA object as "r g b" string, or with optional alpha channel to output "r g b a" string.
    • Added utility function StringToRGBA(): Converts a string to an RGBA structure. String must be formatted in RGB as "%d %d %d" or "%f %f %f", or in RGBA as "%d %d %d %d" or "%f %f %f %f". (If RGB is provided the alpha channel will be assumed as 255.0f/opaque.)
  • Scheduler: Fixed incorrect assertion fail when an infinitely repeating schedule is used.
  • Server plug-ins: Implemented "maps_excluded" properly to work across map changes.
  • Server plug-ins not loaded due to "maps_included" or "maps_excluded" rules will now print a regular message instead of an error in the console.
  • trigger_relay:
    • Added support for SET and KILL use types.
    • Added "triggervalue" key for a numeric value to relay, usually for the SET use type.
  • trigger_script: Added flexibility on what is exposed as the activator to the script:
    • In trigger mode new spawn flags 2 and 4 allow passing the entity itself as activator and/or caller instead of the original activator/caller. (Opposite to the "Keep activator" spawn flag in other entities like "trigger_relay".)
    • In think mode new spawn flag 64 will remember the original activator as EHANDLE m_hActivator so that !activator can be kept. The script entity itself is still passed as an argument to the script function, but the script can read the entity's m_hActivator to obtain the original activator. (If the flag is off the script entity will be the activator.)
    • Entity class "trigger_script" is now exposed to scripts so that it can be cast from CBaseEntity@ into CTriggerScript@, which is necessary to read the EHANDLE m_hActivator in looped think mode.
  • When a plug-in is not compiled because it already exists in the list (e.g. after a map change) simply skip it, don't report it as a failed compile.