SourceMod 1.7.0 Release Notes

From AlliedModders Wiki
Revision as of 18:29, 3 February 2015 by BAILOPAN (talk | contribs) (Developer Notes)
Jump to: navigation, search

This page is still a work-in-progress, incomplete and barely edited, as SourceMod 1.7 has not been released yet

Overview

For users, SourceMod 1.7.0 is not much difference from an incremental release. Game compatibility is updated, some bugs are fixed, etc. Additionally, as some games switch to a newer Steam Id format, both the old and new can be used interchangeably in admin configs and commands.


For plugin developers, SourceMod 1.7.0 is a huge first step toward improving the SourcePawn language. A new, backwards-compatible SourcePawn Transitional Syntax has been added. With it come many new API additions and improvements. See the notes below for the full scoop.

Changelog

User Changes

  • Updated game compatibility for TF2, CS:GO, and Dota 2.*
  • Fixed regression in SM 1.6.3 causing load failure on games older than Orangebox. (PR 237)*
  • Rewrote internal Steam auth ID handling (PR 147, PR 153, PR 155, PR 162, PR 204, PR 210, PR 222, PR 246).
    • admins.cfg now supports Steam2, Steam3, and SteamID 64 formats for the Steam auth provider.
    • admins-simple.ini now supports Steam3 auth IDs in addition to Steam2 IDs.
    • Command targeting now supports both Steam3 auth IDs in addition to Steam2 IDs.
  • Added default timeout for MySQL connections to avoid hangs. (PR 248).
  • SDKTools' gamerules gamedata is now far less likely to break on updates (PR 220).
  • Fixed crash with sm_dump_admcache on Windows (PR 163).
  • Fixed SDKHooks causing crash on player join/leave or plugin load/unload if gamedata missing (PR 236).
  • Changed default sm_trigger_show ConVar value to 0 / disabled.

Developer Changes

  • Added new SourcePawn Transitional Syntax!
  • Added Blocked hook type to SDKHooks (PR 119) (VoiDeD).
  • Added OnTakeDamage_Alive hook type to SDKHooks (PR 149).
  • Many more File natives now support Valve FS (PR 120, PR 169, PR 178).
  • Added SetFilePermissions native (PR 43) (hlstriker).
  • Added API for iterating StringMaps (formerly "tries").
  • Added natives for accessing command line parameters (PR 164) (VoiDeD).
  • Exposed engine Message_DetermineMulticastRecipients as GetClientsInRange native. (PR 234).
  • CloseHandle (or delete) on INVALID_HANDLE is now a no-op, instead of an error (PR 74).
  • GetClientAuthString is now deprecated. Use GetClientAuthId instead.
  • Added OnCoreMapEnd to extension interface (PR 127).
  • Fixed IThreader threads leaking if they're not joined. (bug 3460, PR 241)
  • TFHoliday updates no longer require a plugin recompile (PR 217).
  • Fixed FindFlagChar returning false when passing AdminFlag_Custom6 (bug 6248, PR 203).
  • Added support for (entity) CLASSPTR and EDICT Prop_Data fields with GetEntPropEnt and SetEntPropEnt (PR 83).
  • Doubled maximum handle count per plugin to 32,768 (PR 215), (Thordin).
  • Added support for custom default values with GetEvent* natives, rather than using ""/0 for unset fields (PR 157) (VoiDeD).
  • Removed old profiler, and added new, pluggable profiler (with hooks to VProf) (PR 54).
  • Added command to dump profiler output (PR 128) (VoiDeD).
  • Fixed ICommandLine and related features being reported as unavailable on Dark Messiah.*
  • Fixed OnPlayerRunCommand forward in SDKTools being unavailable on Dark Messiah.*
  • SourceMod now uses some C++11 and has newer compiler requirements.
  • Added --disable-auto-versioning option to ambuild configure script.

* These items are still new since SourceMod 1.6.3, but also exist in the unreleased 1.6.4-dev version.

Developer Notes

The biggest change for developers in SourceMod 1.7 is the new SourcePawn Transitional Syntax, which adds some object-oriented capabilities to our API. The documentation on the transitional syntax has a comprehensive specification for all the changes, including examples.

If you want a very brief takeaway, here are the four new features to keep in mind:

  1. Declarations can now be written like in C# or Java. This is the new preferred syntax and will allow us to improve the language faster in the future. In newer declarations, String is renamed to char and Float is renamed to float.
  2. Instead of INVALID_HANDLE, there is a new null keyword.
  3. Instead of explicit tags, there is now a view_as<Tag> expression that is preferred.
  4. Instead of CloseHandle, you can now use the new delete keyword.

We also note here some specific cases where compatibility with older scripts has been broken. These are source-level compatibility changes only - SourceMod will continue to run scripts compiled with SourceMod 1.6 and earlier.

  1. Coercing function types is now a warning. For example, passing a Function-tagged value to any, and then returning it as an int. The ability to coerce function types to plain values is a serious impediment to future improvements to SourcePawn. It is now a warning, and will be an error in a future version of SourcePawn.
  2. decl is deprecated. For new-style declarations, the decl keyword is not (and never will be) available. New-style declarations are always zeroed. For huge arrays in a critical path (such as a player loop in OnGameFrame), users should first estimate the time spent per-frame zeroing such arrays and then decide if they need to be hoisted outside the loop or made to be static.
  3. Multiple tag support has been removed. Previously, it was possible to specify multiple tags on an argument. For example, {Float,bool}:param. This syntax is no longer available.
  4. sizeof can no longer be used on indeterminate arrays. Previously, sizeof on an indeterminate array (an array whose size is not statically known) was a warning. It is now an error.
  5. Reserved keywords. We have taken the opportunity to reserve a number of keywords for future versions of SourcePawn. They don't do anything, and they have no semantics. They are only reserved now to mitigate any potential problems if we do need them in the future. They are: acquire, as, builtin, catch, cast_to, double, explicit, finally, foreach, implicit, import, in, int8, int16, int32, int64, intn, let, namespace, object, package, private, protected, readonly, sealed, throw, try, typeof, uint8, uint16, uint32, uint64, uintn, union, var, variant, volatile, with.
  6. sizeof no longer has magic meaning as a default argument expression. Previously, sizeof as a default argument expression would bind to the variable at its callsite, rather than the argument in parameter scope. This allowed users to create functions that did not seem to require an explicit size parameter alongside an array. This feature was buggy, so it has been removed, alongside similar magic binding for tagof and cellsof in default argument expressions.
  7. String[] and any no longer coerce. Previously, it was possible to coerce a character array to an any array, or vice-versa. This cast was unsafe because the storage widths of each array value are different (one normal array is four bytes per slot, and a character is one byte per slot). This coercion is now illegal.
  8. Using int or void as a tag is now a warning.
  9. Enums cannot be retagged. Previously, enums could be retagged - for example, enum X:Y { .... This is no longer allowed.
  10. The implicit-int tag cannot be used as an enum tag. It is now illegal to use _ as an enum name or label.
  11. Dynamically sized arrays are now indeterminate. Previously, an array could be declared as a mix of fixed-size and dynamic-sized dimensions. Now, all dimensions are considered indeterminate if any one dimension is dynamic-sized. This means sizeof may not work in complex array use.