API Changes SC 5.11

GeckoN edited this page Apr 4, 2017 · 6 revisions

To fix some crash issues related to invalid pointers, we had to change how entities are stored in the game. This might affect some scripts that access the pointers (handles) we've updated. Please see the list below for what exactly changed in the API. If your script accesses the old pointer types, it won't work anymore and needs to be updated.

We'll gladly help you, should you have trouble with the changes. You can reach us on Discord (#scripting channel) or the forums.

Changed Class Members

Type and/or name of the following class members was changed:

API in SC 5.10 and earlier SC 5.11 API
CBaseMonster@ CItemInventory.m_pHolder EHandle CItemInventory.m_hHolder
CBaseEntity@ CItemInventory.m_pEntity EHandle CBaseMonster.m_hEntity
CCineMonster@ CBaseMonster.m_pCine EHandle CBaseMonster.m_hCine
CBaseEntity@ CBaseMonster.m_pCineBlocker EHandle CBaseMonster.m_hCineBlocker
EHandle CBaseMonster.m_pGuardEnt EHandle CBaseMonster.m_hGuardEnt
CPathTrack CPathTrack.m_pnext EHandle CPathTrack.m_hNext
CPathTrack CPathTrack.m_pprevious EHandle CPathTrack.m_hPrevious
CPathTrack CPathTrack.m_paltpath EHandle CPathTrack.m_hAltpath
EHandle CBasePlayer.m_pTank EHandle CBasePlayer.m_hTank
CBasePlayer@ CBasePlayerItem.m_pPlayer EHandle CBasePlayerItem.m_hPlayer
CBasePlayerItem@ CBasePlayerItem.m_pNext EHandle CBasePlayerItem.m_hNextItem
edict_t@ CSound.pOwner EHandle CSound.hOwner
CItemInventory@ inventory_t.pItem EHandle inventory_t.hItem

You can use EHandle.GetEntity() method to get the Entity referenced by the given handle. It will return null if the entity is invalid, that way you can safely do a null check to avoid crashes and other potential problems. More information about the EHandle class can be found here.

Changed Methods and Functions

Following methods and functions were changed or removed:

API in SC 5.10 and earlier SC 5.11 API
void Observer.SetObserverTarget(CBaseEntity@ pEntity) void Observer.SetObserverTarget(CBasePlayer@ pPlayer)
bool FNullEnt(CBaseEntity@ pEnt) Removed. Use pEnt is null instead.

Other Changes

Other notable changes:

  • It's possible to register and create custom entities in server plugins (this includes custom weapons/items). (issue #46)
  • Survival Mode implementation was extended and moved to native code. Access to Survival Mode functionality is provided via AS API. The original Survival.as script was updated to serve as a simple compatibility layer for 3rd party survival maps.
  • Issues related to use of temporary strings were fixed. (issue #27, issue #31)
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.