baso88 / sc_angelscript Goto Github PK
View Code? Open in Web Editor NEWSven Co-op AngelScript documentation, tutorials, sample code and tools
Sven Co-op AngelScript documentation, tutorials, sample code and tools
Script types: All.
Allow handling upon falling to the ground. Either to remove all kind of fall damage or reduce momentum (to disable bhopping)
File::ReadLine reads until the given delimiter is reached, which is '\n' by default. On Windows, the OS will read CRLF as LF ('\n'), on Linux this is read as CRLF ("\r\n"), causing problems when lines are read in one at a time. Special handling is required when the delimiter is '\n' to ignore any '\r' preceding it.
Add an implicit conversion between char
and uint32
.
unsigned int Char_ToUint32( const char& c )
{
return static_cast<unsigned int>( c );
}
pDocumentation->RegisterObjectMethod( "Implicitly converts this character to an unsigned 32 bit integer",
pszObjectName, "uint32 opImplConv() const",
asFUNCTION( Char_ToUint32 ), asCALL_CDECL_OBJFIRST );
Script types: All.
This function is called by the engine whenever the client userinfo string changes. This includes name and player model changes. Consider making this available and allowing scripts to veto changes. Map scripts may be too dangerous for this, discuss.
Note: changes are already made by the time they reach this function. Vetoing must be done by reverting changes.
Needs to be override-able in custom monster entities as well.
Script types: All
Getting target type, damage dealt, damage type, etc.
CSoundEngine::PrecacheSound
does not support sound replacement. Sound replacement works by checking the current entity's sound replacement file, which it cannot do without the entity instance. Add an overload that takes a CBaseEntity@
so custom entities can pass in "self
".
CEngineFuncs::Voice_GetClientListening
has the wrong return type. It should be bool
, not void
.
Needs to be override-able in custom monster entities as well.
5.0.7's changelog says this:
"Server plug-ins are now allowed to register custom entities."
While the access mask for those methods was changed, you forgot pretty much everything else.
Custom entities require headers to be included so script classes can inherit from them properly. You also didn't set the access mask for custom weapon functions so you can't register custom weapons.
You also didn't update the code to use the calling module to check for the class name that was passed in, so it always tries to find classes in the map module.
CEngineFuncs::LightStyle
passes a temporary string to the engine, which expects a string that lasts as long as the map does. ALLOC_STRING
the value.
Script types: All.
Getting target type, damage dealt, damage type, etc.
Note: Same as #3, but intended to work with Brush entities instead of Monsters/Players.
The Cvar class methods are non-const, preventing them from being called if you have a const handle to an instance. Cvar is the native cvar class, not the Angelscript version.
See AngelScript CVarGetPointer bug?
Also consider adding helper methods to set the value for cvars directly by passing them through to enginefuncs_t::pfnCvar_DirectSet
. Providing a helper method to convert to float would be nice.
Reported by Duko.
Exhaustible weapons (ItemInfo.iFlags
& ITEM_FLAG_EXHAUSTIBLE
) refer to a temporary string for the classname. This causes problems when you try to pick up dropped instances of these weapons. To fix this, go to CASItemRegistry::RegisterItem
and change the following line:
UTIL_PrecacheOtherWeapon( szName.CStr() );
To:
UTIL_PrecacheOtherWeapon( ALLOC_STRING( szName.CStr() ) );
This will ensure it uses a string that is valid for the duration of the map.
Add functions to set these to any file, provide a means to create replacement maps in Angelscript.
This means:
(sentence replacement can only work if done in MapInit
due to sound system limitations)
Script types: All.
Called when a new entity is created (e.g. a monster or weapon projectile). The newly created CBaseEntity
would be passed as a parameter.
Script types: All.
Allow handling upon activating the "checkpoints" in most maps, this would allow implementing survival mode in a much easier way on unsupported maps.
Potentially allow spawn blocking.
Note: info_player_start is treated by game code as though it inherits from the same base class as info_player_deathmatch
and other info_player_*
entities. Consider fixing this before adding the hook and exposing the base class for use here.
The CEngineFuncs::ChangeLevel
function will immediately change the level. This could cause scripts to be invalidated while they are running. Advise changing its implementation to delay changelevel to the end of the frame to avoid this.
Allow scripts to use the virtual filesystem to make persistent changes to files.
Script types: Map scripts only (consider adding for plugins as well)
Allow map scripts to prevent players from suiciding, or potentially handle it themselves.
Add missing CBaseEntity
variables.
Some of the missing variables include:
m_pGoalEnt
m_pLink
m_pLinkAll
m_pMyMedic
The CEntityFuncs
methodsMonstersInSphere
, EntitiesInBox
, TargetsInBox
, BrushEntsInBox
don't release the reference to the array that is passed in if the array type is invalid.
Instead of ""
, the default value is just nothing.
Add monster navigation code to the API. This includes methods like FTriangulate
, InsertWaypoint
, BuildNearestRoute
, etc. Virtual methods should be evaluated for inclusion as overrideable methods.
CEngine
has only a const global instance, but has configuration variables used to instruct the engine to perform certain tasks. It should be made non-const, with non-configuration variables made const.
Script types: All.
Currently available only to map scripts. Making it available to plugins would prove helpful.
The CEngine
class is missing the force_retouch
variable. This is used to force the engine to run touch functions for non-moving entities.
When attempting to set m_flRespawnDelayTime at hook's PlayerKilled or PlayerSpawned, the game does not change their respawn delay. From what it seems, you have to set it the moment the on-display timer starts counting.
Test code: https://github.com/MrOats/AngelScript_SC_Plugins/blob/master/AdjustSpawntime.as
CEngineFuncs::AnimationAutomove
does nothing. Remove it.
Reference Code: https://github.com/MrOats/AngelScript_SC_Plugins/releases/tag/SM_v4.0
In my plugin listed above, I left notes and ability to test trying to stay in Observer mode through setting &bCanRespawn for specific players. From what I found is that with bCanRespawn set to false, instead of when the timer counts to 0 on your screen and changes to "You can respawn now!", you are forcefully respawned with your gun not showing but able to shoot. With it set to true, it shows "You can respawn now!" and awaits for input like it should.
The documentation for BaseMonster::ISoundMask
states the following:
Calls the base class implementation of RunAI
This should be:
Calls the base class implementation of ISoundMask
Scripts types: Both
Called when weapon is picked up. The weapon itself and the player picking it up should be passed in.
The weapon id can be retrieved using CBasePlayerWeapon.m_iId
, so it should not be passed in separately.
Script types: All.
Allow handling upon long jumping.
Note: long jumping is handled by the player physics code, which is written in C. Consider converting to C++ to allow direct access to the hook.
CPlayerFuncs::AdminLevel
returns the admin level of the given player. Unfortunately, it takes a CBasePlayer@
(like the underlying AdminLevel
function it forwards to) so you can't use it in the ClientConnected
and CanPlayerUseReservedSlot
hooks.
Users may want to verify the player's admin level in those hooks to check if they should be allowed to join, which is impossible because it requires a CBasePlayer
.
Add an overload that takes an edict_t@
so this can be done. (I'm aware that CBasePlayer
's members are accessed when checking for an admin level, just refactor the function into 2 parts so the edict
only part at the end can be called at any time)
ItemInfo is missing the opAssign method.
There is no way to find and/or execute custom commands defined in scripts. There should be a ServerCommand
equivalent for custom commands that does not have to pass through the engine.
Script types: All.
Currently available only to map scripts. Making it available to plugins would prove helpful.
Add support for SQL. MySQL for plugins, SQLite for plugins and map scripts.
Add the ability to iterate over directories and files in another directory through the virtual filesystem.
This would prove useful to precache entire directories at once, for example to precache all vox sounds for use in a plugin.
There should be a way to get the material type of a texture. This would include an enum containing types and a method to retrieve the type of any texture.
Would be nice to have a separate procedure for when as_reloadplugin(s) is called for the plugin instead of having to take care of it when it first loads. Such as defining a Scheduler object twice on first load, and having to redefine it on as_reloadplugin(s).
Script types: All
Allow scripts to handle the event when a player is Spawned via a Revive (Medkit, or NPC revive).
Script types: Map scripts only.
Add a hook to override IRelationship
's lookup so the map script can decide which relationships exist between which monster classes.
See title.
There is no way to send chat messages that come from the server itself. Make null senders be interpreted as the server.
Requested by CubeMath.
Script types: All.
Well, you know what AddToFullPack
is used for - per-player entity states. No idea what would it be useful for right now, but I am sure people would come up with something good eventually. There were numerous AMXX plugins using it.
Could be used for per-player effects not visible to other players.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.