Skip to content

Commit

Permalink
Lua: Allow string & java.awt.Color in entity outfit color definition …
Browse files Browse the repository at this point in the history
…table
  • Loading branch information
AntumDeluge committed Sep 27, 2023
1 parent d4e1eb4 commit 190e02e
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,17 @@ private void setNPCTraits(final PassiveNPC npc, final LuaTable lt) {
l_outfitColors.checktable();

for (final LuaValue l_key: ((LuaTable) l_outfitColors).keys()) {
npc.setOutfitColor(l_key.checkjstring(), l_outfitColors.get(l_key).checkint());
l_key.checkjstring();
final LuaValue l_color = l_outfitColors.get(l_key);
if (l_color.isuserdata()) {
}
if (l_color.isint()) {
npc.setOutfitColor(l_key.tojstring(), l_color.toint());
} else if (l_color.isstring()) {
npc.setOutfitColor(l_key.tojstring(), l_color.tojstring());
} else {
npc.setOutfitColor(l_key.tojstring(), (java.awt.Color) l_color.checkuserdata(java.awt.Color.class));
}
}
}
}
Expand Down

0 comments on commit 190e02e

Please sign in to comment.