by Sir Robin » Thu Oct 05, 2023 7:15 am
I'm still seeing this behavior. My work around is to keep a list of actors who touched the actor each tic and only let them do it once per tic.
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]);
}
}
I'm still seeing this behavior. My work around is to keep a list of actors who touched the actor each tic and only let them do it once per tic.
[code]
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]);
}
}
[/code]