Applies to: Custom inventory objects and weapons, and any other object types capable of having their states executed by another actor.
Implementation: Put the keyword "OWNER" in the state definition, along with such keywords as "BRIGHT", modifying the state to always use the owner as caller.
Feature 2: Create a custom relation between the caller of a state and the owner of that state
Applies to: Custom inventory objects and weapons, and any other object types capable of having their states executed by another actor.
Applied to: Inventory-class with subclasses.
Implementation: A_OwnerCallerLink(int saveCallerTo, int saveOwnerTo = AAPTR_DEFAULT, int flags = PTROP_NOSAFEGUARDS);
saveCallerTo: Save caller (monster, player, thing) to a pointer in owner (target, master, tracer).
saveOwnerTo: Save owner (inventory) to a pointer in caller (target, master, tracer).
* AAPTR_DEFAULT: Do not save
* AAPTR_MASTER|AAPTR_TARGET|AAPTR_TRACER: Save as Master, Target or Tracer.
flags: I thought they were on the wiki, but it seems not to be true. (I first said: See [wiki]A_RearrangePointers[/wiki])
* Default: PTROP_NOSAFEGUARDS; it is unlikely that a use of this function will ever require that sort of protection.
This function has no effect if owner and caller are the same, and it is only defined for the inventory-class.
Using this function with the "owner" keyword has no effect ("owner" keyword forces caller to the same as "owner").
This function has effect when it is triggered by a CustomInventory state-chain or an active weapon.
Demo: The feature I wanted to demonstrate also requires at least the parameterless version of ClassID() from the String/Name features of http://forum.zdoom.org/viewtopic.php?f=34&t=31493
The demo replaces HealthBonuses with 3 pickups that have 3 effects. The pickups have generic names, and 3 distinct appearances, but it is not predetermined which pickup will have which effect. The first time a pickup is activated, its effect is resolved. The resolution applies only within the map scope, so when a new map is loaded, the effects are randomised again. ClassID() causes the system to be highly reliable and easily extended. Just make sure ACS defines at least as many effects as there are different decorate classes inheriting from "RandomEffectBase" or one of its subclasses.
Contents of decorateOwner.zip:
decorateOwner.zdoom.diff: Patch for the above features.
pkupfx.zdoom.diff: Patch for the demo to work.
pkupfx_dev.pk3: Demo.
Non-demonstrated benefits:
Spoiler:This submission is fully functional but I have not delved deeply into its destructive potential yet. Most of all I (or the devs) need to verify that performing custom operations on a state-owner during state-chains/weapon activity does not have ill effects. The first question: What happens if the state-owner is removed (Thing_Remove(0)) during execution? The second question: Could that be achieved before? (I think it may have been doable, but less available, and less general.)
Heh. I suddenly remembered: http://forum.zdoom.org/viewtopic.php?f= ... 0&p=523532&


