Why is my custom trait being listed as a "Marker" trait?

Hi,

After I’ve imported my trait into my piece its correctly listed as a “Research Action Button” trait in the piece’s list of current traits but then when I save my module, close & then reopen the module editor this trait is listed as a “Marker” trait in the piece’s list of traits. And when I modify the simplest code I could give this trait (to test this problem) to actually make it do something in game it fails to work.

I’ve tried used the example Magnifier trait from the programming tutorial’s ZapWars zip and it has the same problem.

My trait:

public class ResearchActionButton extends Decorator implements EditablePiece
{
	public final static String ID = "RESEARCHED_ACTION_BUTTON";

	public ResearchActionButton(String type, GamePiece inner)
	{
		mySetType(type);
		setInner(inner);
	}

	public ResearchActionButton()
	{
		this(ID, null);
	}

	public String myGetType()
	{
		return ID;
	}

	public String getDescription()
	{
		return "Research Action Button";
	}

	public void draw(Graphics g, int x, int y, Component obs, double zoom)
	{
		piece.draw(g, x, y, obs, zoom);
	}

	public Rectangle boundingBox()
	{
		return piece.boundingBox();
	}

	public Shape getShape()
	{
		return piece.getShape();
	}

	public String getName()
	{
		return piece.getName();
	}

	@Override
	public void mySetState(String newState)
	{

	}

	@Override
	public String myGetState()
	{
		return "";
	}

	@Override
	protected KeyCommand[] myGetKeyCommands()
	{
		return new KeyCommand[0];
	}

	@Override
	public Command myKeyEvent(KeyStroke stroke)
	{
		return null;
	}

	public void mySetType(String type)
	{

	}

	public HelpFile getHelpFile()
	{
		return null;
	}

	public PieceEditor getEditor()
	{
		return new SimplePieceEditor(this);
	}
}

My counter factory:

[code]public class MyCounterFactory extends BasicCommandEncoder
{
public Decorator createDecorator(String type, GamePiece inner)
{
Decorator piece = null;

	if (type.startsWith(ResearchActionButton.ID))
	{
		piece = new ResearchActionButton(type, inner);
	}

	else
	{
		piece = super.createDecorator(type, inner);
	}

	return piece;
}

}[/code]

I’ve tried using the Zap Wars Magnifier trait with the Zap Wars counter factory and this example code has the same problem

I can see the Zapwars Magnifier trait works when its used in the Zap Wars module in Vassal 3.2.16 so I will find out why its not working in my module.

My mistake was simply not replacing <VASSAL.build.module.BasicCommandEncoder/> with <zap.MyCounterFactory/> in my module’s build file because its been a long time since I’ve read the programming tutorial from start to finish and I’ve been assuming Vassal was searching for and finding my custom counter factory class because the Magnifier trait was importable so I thought the Vassal module editor would therefore update the build file to include my counter factory.