Hi,
I think there is some confusion as to how cmdset merging works here.
With this setup you are not actually adding BCmdSet on top of your ACmdSet. You are adding CharacterCmdSet (which happens to contain the commands from BCmdSet) on top of ACmdSet. But CharacterCmdSet has
no mergetype. It cannot have. If it had the mergetype "Remove" then no commands from the CharacterCmdset would be available (Remove doesn't add any cmds of its own, only filters others). When you add BCmdSet to CharacterCmdSet in
at_cmdset_creation(), all it does is to copy the commands of BCmdSet into CharacterCmdset, you are not actually merging two cmdsets together (this would be done via
merged_set = BCmdSet + CharacterCmdSet or more commonly via the character's cmdsethandler:
character.cmdset.add(BCmdSet).)
Manipulating the player cmdset with the character cmdset like this is a rather tricky proposition overall, since you want to keep most of CharacterCmdset and only filter out a few things from PlayerCmdset. There are two ways I can think of to do this (apart from the non-cmdset solution of changing the relevant commands to check if their caller is ic or ooc):
- Make the entire CharacterCmdset use merge_type "Replace" and put two dummy commands in there to overload the Player-level versions.
- Once the puppeting is done (in the character.at_post_puppet() hook), call character.cmdset.add(BCmdSet), where BCmdSet.mergetype="Remove" and its priority was bigger than that of CharacterCmdSet. If we wanted to to use key_mergetype, we would need to set key_mergetype={"CharacterCmdSet":"Remove"} here, since at the point we want to merge in BCmdSet, CharacterCmdSet is already a merger of PlayerCmdSet (lowest prio at -10) and CharacterCmdSet (prio 0).
Hope that is understandable. The confusion here, I think, is that cmdsets are merged together one by one in order of priority and gradually builds up a conglomerate of sets. The name of this merged set is inherited from the highest-prio set that was last merged in. This is what the next set in the merge-queue have to work with - its mergetype (and the key_mergetype) can only be compared to the currently merged set's name. This is why merge order (priorities) are so important when wanting to filter commands with other sets and why so many different possibilities can be achieved with a limited number of sets.
.
Griatch