progs-dump-dev / progs_dump

29 stars 9 forks source link

activator unassigned before call to SUB_UseTargets #13

Open 4LT opened 6 months ago

4LT commented 6 months ago

https://github.com/progs-dump-dev/progs_dump/blob/55960e8f79468ef866b41e4bfd4c674f9c854d1e/qc/triggers.qc#L1249-L1250

SUB_UseTargets is called from a touch context, meaning "other" is guaranteed to be assigned, but there's no guarantee about the "activator" global.

Also, it's not clear to me why multi_trigger is assigned to self.use before SUB_UseTargets is called when multi_trigger calls SUB_UseTargets itself. Seems like a bug, but you're doing something I just don't understand.

dumptruckDS commented 5 months ago

This is frankly over my head. This is found in trigger_look (written by nullpoint_paladin). I am not sure what the impact of this bug is?

4LT commented 5 months ago

I had to dig through some Discord responses to recall what happened

Sometimes, a message from a trigger appears in the top left corner started with (centerprint), instead of in the center. What gives? (tested in ironwail and remaster)

Seems sometimes a non-player entity is found as the "activator" of trigger_look causing the centerprint text to be logged as a broadcast (bprint) message

I also wanted to highlight that the code identified is unusual b/c the function multi_trigger calls SUB_UseTargets

A possible fix is to replace

self.use = multi_trigger; 
SUB_UseTargets(); 

with

self.enemy = other;
multi_trigger();

multi_trigger sets activator to self.enemy, so the "touch-er" other needs to be assigned to self.enemy

=====

In short:

When trigger_look is set to print a message (or trigger an entity that prints a message?), it doesn't know which player to apply the centerprint on

dumptruckDS commented 5 months ago

Thanks for the info - very helpful. This will be fixed for the next release. (Soon.)