Added VScript utility functions + loosened VScript EntFire(ByHandle) restrictions

This commit is contained in:
Blixibon
2020-06-13 12:44:40 -05:00
parent 03632df565
commit ea0c830a62
5 changed files with 79 additions and 5 deletions

View File

@@ -10,17 +10,20 @@ function UniqueString( string = "" )
return DoUniqueString( string.tostring() );
}
function EntFire( target, action, value = null, delay = 0.0, activator = null )
function EntFire( target, action, value = null, delay = 0.0, activator = null, caller = null )
{
if ( !value )
{
value = "";
}
local caller = null;
if ( "self" in this )
{
caller = self;
if ( !caller )
{
caller = self;
}
if ( !activator )
{
activator = self;
@@ -30,6 +33,29 @@ function EntFire( target, action, value = null, delay = 0.0, activator = null )
DoEntFire( target.tostring(), action.tostring(), value.tostring(), delay, activator, caller );
}
function EntFireByHandle( target, action, value = null, delay = 0.0, activator = null, caller = null )
{
if ( !value )
{
value = "";
}
if ( "self" in this )
{
if ( !caller )
{
caller = self;
}
if ( !activator )
{
activator = self;
}
}
DoEntFireByInstanceHandle( target, action.tostring(), value.tostring(), delay, activator, caller );
}
function __ReplaceClosures( script, scope )
{
if ( !scope )