I am trying to develop a new kind of trait for counters. I read the tutorial, and tried to apply it (right now, my trait is a dumbed-down version of SendToLocation).
I compiled it with the latest trunk (svn rev. 4132). When trying to open it (with rev. 4132) (open a module, go to some piece, import EUROPA.Teleport), I get (instead of the SimplePieceEditor I expect) “Not a Configurable”. Did I miss something again?
Code sample:
public class Teleport extends Decorator implements TranslatablePiece {...}
This happens also when trying to add MyCounterFactory to the module:
In fact, I get an error when trying to open Zapwars.mod :
Java.lang.AbstractMethodError
at VASSAL.build.AbstractConfigurable.add(AbstractConfigurable.java:140)
at VASSAL.build.Builder.build(Builder.java:76)
at VASSAL.build.AbstractBuildable.build(AbstractBuildable.java:68)
at VASSAL.launch.BasicModule.build(BasicModule.java:136)
at VASSAL.launch.BasicModule.build(BasicModule.java:101)
at VASSAL.build.GameModule.init(GameModule.java:765)
at VASSAL.launch.EditModuleAction.loadModule(EditModuleAction.java:49)
at VASSAL.launch.Editor.launch(Editor.java:89)
at VASSAL.launch.Launcher$1.run(Launcher.java:131)
...
So I guess the bug is elsewhere (in svn trunk).
No, the ZapWars module hasn’t been updated to work with 3.1 yet.
The problem you’re having is that MyCounterFactory is not a Configurable.
The reason for this is that you don’t implement Configurable or any
subinterface of Configurable, nor does MyCounterFactory’s parent class.
In order to make this work, you should either (1) implement Configurable
directly, (2) make AbstractConfigurable the parent class of MyCounterFactory,
or possibly, (3) make a subclass of AbstractConfigurable which has a
MyCounterFactory as a member.
After browsing the source a bit more, MyCounterFactory should not need to be a Configurable (I do not want to introduce anything below it, I just want to insert it). Maybe I misunderstood how to build a custom trait, but if I just change the BasicCommandEncoder to MyCounterFactory in the buildFile and I add the classes (as EUROPA/MyCounterFactory.class and EUROPA/Teleport*.class) to the zip file, the custom trait does not appear in the list.
However, if I put a Teleport string in one of the counters, the Teleport trait appears correctly. For me, this fixes the thing (I build the buildFile manually anyway, so I just need to have one test piece). Thank you for your help.
Custom Command Encoders do not need to be Configurable, but in that case, cannot be added to the module using Import. They can only be added by manually editing them into the buildFile.