Code: Select all
Class TouchTest : Actor
{
override void Touch (Actor toucher)
{
console.printf('Touched '..level.MapTime);
}
Default
{
Height 64;
Radius 32;
+SOLID
+SPECIAL
}
States{
Spawn:
PLAY A -1;
Stop;
}
}
Moderator: GZDoom Developers
Code: Select all
Class TouchTest : Actor
{
override void Touch (Actor toucher)
{
console.printf('Touched '..level.MapTime);
}
Default
{
Height 64;
Radius 32;
+SOLID
+SPECIAL
}
States{
Spawn:
PLAY A -1;
Stop;
}
}
Code: Select all
class Trigger_BumpOrUse : Actor
{
array<actor> touchers;
default
{
height 64;
radius 32;
+Solid
+NOGRAVITY;
+Special;
}
override void tick()
{
super.tick();
touchers.clear();
}
override void Touch(Actor toucher)
{
//Don't let an actor touch more than once per tic
if (touchers.find(toucher) != touchers.size()) return;
//record this toucher for this tic
touchers.push(toucher);
console.printf(GetCharacterName().."@"..level.time..": Touched by "..(toucher? toucher.GetCharacterName() : "[NULL]"));//DEBUG
Trigger(toucher);
}
override bool Used(Actor user)
{
console.printf(GetCharacterName().."@"..level.time..": Used by "..(user ? user.GetCharacterName() : "[NULL]"));//DEBUG
Trigger(user);
return true;
}
virtual void Trigger(actor tripper)
{
console.printf(GetCharacterName().."@"..level.time..": Triggered by "..(tripper ? tripper.GetCharacterName() : "[NULL]"));//DEBUG
tripper.A_CallSpecial(special, args[0], args[1], args[2], args[3], args[4]);
}
}