Skip to content

Overriding Actions Should Stack with Multiple Mods

Mario uses A_MonitorPop to hijack what item is spawned in from a monitor when you are playing as him. The original super function is called after the item has been modified, then it is returned to normal.

srb20402

Milne also uses A_MonitorPop in order to respawn monitors after Milne throws them. The original super function is called and the new code being added has no bearings on the item code.

Theoretically, both these replacements are compatible with another. They both always call super, and never change anything the other does. And yet, they aren't compatible.

srb20403

Well, why is this? It's because whenever an action gets replaced it completely ignores any mod that had replaced it prior. The super function continues to be exactly the same way it was before any mods were added. Mario's code is completely discarded in favor of Milne's code, even though they have nothing to do with each other.

What should occur here instead is whenever the super function is called, it calls the previous mod's iteration of the action, and that continues until either super is not called or the original SRB2 version of the action is called. So when Mario and Milne are both added, A_MonitorPop should call Milne's A_MonitorPop, who then calls super, which calls Mario's A_MonitorPop, who then calls super, which calls SRB2's vanilla A_MonitorPop.

SRB2 already has a system for this sort of thing in place with hooks, and I really think this would be beneficial for mods in the long run. I've already even ran into a similar problem just with SRB2 Kart's own Self-Propelled Bomb that would've been solved instantly had a system like this been in place.

Edited by SMS Alfredo