Cogito, ergo sum

Difference between revisions of "Unreal Wiki:Sandbox"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
Line 21: Line 21:
  
 
}
 
}
 +
 +
 +
/**
 +
* For tracehit weapons with no prefire delay, handles firing the weapon.
 +
*/
 +
simulated function InstantFire()
 +
{
 +
//`log(`location);
 +
CustomFire();
 +
PerformInstantFire();
 +
}
 +
 +
/**
 +
* For weapons using projectiles, which have no prefire delay - fires the weapon.
 +
*/
 +
simulated function Projectile ProjectileFire()
 +
{
 +
//`log(`location);
 +
CustomFire();
 +
return Super.ProjectileFire();
 +
 +
}
 +
 +
simulated function Delayed_CustomFire( byte FireModeNum );
 +
 +
/**
 +
* Called on a timer (set in BeginFire()), this is called only for weapons which have a prefire delay.
 +
*/
 +
simulated function DelayedFire()
 +
{
 +
DelayedWeaponFire(0);
 +
}
 +
 +
/**
 +
* Called on a timer (set in BeginFire()), this is called only for weapons which have a prefire delay.
 +
*/
 +
simulated function DelayedAltFire()
 +
{
 +
DelayedWeaponFire(1);
 +
}
 +
 +
simulated function DelayedWeaponFire( byte FireModeNum )
 +
{
 +
//`log(`location);
 +
// restore our WeaponFireType, since we switched it to EWFT_Custom in BeginFire()
 +
WeaponFireTypes[FireModeNum] = default.WeaponFireTypes[FireModeNum];
 +
if ( WeaponFireTypes[FireModeNum] == EWFT_InstantHit )
 +
{
 +
// our own version of InstantFire() is only called for weapons that do not have a prefire
 +
// delay, so go directly to our parent class/state version
 +
PerformInstantFire();
 +
}
 +
else if ( WeaponFireTypes[FireModeNum] == EWFT_Projectile )
 +
{
 +
// our own version of ProjectileFire() is only called for weapons that do not have a prefire
 +
// delay, so go directly to our parent class/state version
 +
Super.ProjectileFire();
 +
}
 +
else if ( WeaponFireTypes[FireModeNum] == EWFT_Custom )
 +
{
 +
Delayed_CustomFire(FireModeNum);
 +
}
 +
 +
PrefireCachedStartTrace = vect(0,0,0);
 +
}
 +
 
</uscript>
 
</uscript>
  

Revision as of 16:21, 18 February 2012

Do not edit the area above the separator line, please.


Legacy:Actor Actor UE3:Actor (UT3) Project:Sandbox

/** Override BeginFire so that it will enter the firing state right away. */
simulated function BeginFire(byte FireModeNum)
{
 
	// verify that our owning pawn isn't busy before calling Super.BeginFire(), which is where PendingFire is set
	if ( !IsFiringAllowed(FireModeNum) )
	{
		return;
	}
//`log(`location @ `showvar(IsTimerActive(nameof(DelayedFire)),DelayedFire Active));
 
	Super.BeginFire(FireModeNum);
 
}
 
 
/**
 * For tracehit weapons with no prefire delay, handles firing the weapon.
 */
simulated function InstantFire()
{
//`log(`location);
	CustomFire();
	PerformInstantFire();
}
 
/**
 * For weapons using projectiles, which have no prefire delay - fires the weapon.
 */
simulated function Projectile ProjectileFire()
{
//`log(`location);
	CustomFire();
	return Super.ProjectileFire();
 
}
 
simulated function Delayed_CustomFire( byte FireModeNum );
 
/**
 * Called on a timer (set in BeginFire()), this is called only for weapons which have a prefire delay.
 */
simulated function DelayedFire()
{
	DelayedWeaponFire(0);
}
 
/**
 * Called on a timer (set in BeginFire()), this is called only for weapons which have a prefire delay.
 */
simulated function DelayedAltFire()
{
	DelayedWeaponFire(1);
}
 
simulated function DelayedWeaponFire( byte FireModeNum )
{
//`log(`location);
	// restore our WeaponFireType, since we switched it to EWFT_Custom in BeginFire()
	WeaponFireTypes[FireModeNum] = default.WeaponFireTypes[FireModeNum];
	if ( WeaponFireTypes[FireModeNum] == EWFT_InstantHit )
	{
		// our own version of InstantFire() is only called for weapons that do not have a prefire
		// delay, so go directly to our parent class/state version
		PerformInstantFire();
	}
	else if ( WeaponFireTypes[FireModeNum] == EWFT_Projectile )
	{
		// our own version of ProjectileFire() is only called for weapons that do not have a prefire
		// delay, so go directly to our parent class/state version
		Super.ProjectileFire();
	}
	else if ( WeaponFireTypes[FireModeNum] == EWFT_Custom )
	{
		Delayed_CustomFire(FireModeNum);
	}
 
	PrefireCachedStartTrace = vect(0,0,0);
}

Testing UScript highlighter...

class X extends Y within Z
    implements(I)
    nottransient;
 
`include(SomeFile.uci)
 
 
var(Group) interp struct Type {
  var() bool bCorrect;
  var array<class<Actor> > ActorClasses;
} VarName;
 
reliable client function CheckType(optional class<Actor> ActorClass)
{
  local int i;
 
  for (i = 0; i < VarName.ActorClasses.Length; ++i) {
    if (ActorClass == None || ClassIsChildOf(VarName.ActorClasses[i], ActorClass)) {
      VarName.ActorClasses[i].static.StaticSaveConfig();
      continue;
    }
    VarName.ActorClasses.Remove(i--, 1);
  }
  VarName.bCorrect = True;
}
 
static function byte GetHash(int Value)
{
  switch (Value) {
    case -1:
      return 0;
    case 0xCAFE:
      return 1
    default:
      return (Value >= 0 && Value < 10) ? class'Hasher'.default.Hash[Value] : (Value & 0xff);
  }
}
 
defaultproperties
{
  VarName.Empty
  VarName[0] = {(
    bCorrect = True,
    ActorClasses.Add(class'ReplicationInfo')
  )}
}