ID:2403072
Oct 4 2018, 11:29 am
|
|||||||
Redundant
| |||||||
New procs, called to the atom on Cross(atom/A) and Bump(atom/A), respectively.
|
On the subject of new hooks, I'd really prefer built-in reciprocals to Cross(), Uncross(), Crossed() and Uncrossed(), because proper encapsulation of code is important and DM makes this relationship rather one-sided.
A crosses B, A is notified, but B never knows unless you set up your own hooks. Unfortunately, overriding A.cross later on means that your own hook will never be called, so you can effectively break this behavior and it's unreliable. The only way to get around this is to declare this behavior at the end of the root project's DMB file so that it's the last thing to compile, which can't be done from a library unless you force the library to be compiled at the end of the root project's DMB file, which is a brittle implementation in the first place. Even then, it won't work for subclasses, because your library would have to be aware of the entire hierarchy ahead of time to automatically account for overrides. |
In response to Pokemonred200
|
|
Nope, it isn't. Cross() is called at the src when an atom is trying to overlap it. Crossed() is called at the src when an atom succesfully overlapped it.
What I want is for Cross and Bump to call new procs at the atom that crossed/bumped src (HasCrossed and HasBumped but it can be any other name, lol). |
Here it is, as simple as it can be. These will work as long as you call ..() in overrides (if any) of Crossed, Uncrossed, and Bump (which was always best practice anyways).
atom |
In response to Kaiochao
|
|
Thank you!
|
I would appreciate a built-in Bumped(), but IIRC this is something that can be done in softcode.