Skip to content

Commit

Permalink
Differentiate between walls made from bars, blocks, and wood.
Browse files Browse the repository at this point in the history
  • Loading branch information
Japa committed Jun 21, 2015
1 parent 3396d64 commit 124b6ef
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
Binary file modified Assets/Main Map Shape Normal.psd
Binary file not shown.
Binary file modified Assets/Main Map Shape.psd
Binary file not shown.
3 changes: 3 additions & 0 deletions Assets/MapGen/ContentChosers/ContentConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public static ContentConfiguration<T> GetFromRootElement(XElement elemRoot, XNam
case "ramp":
output = new RampConfiguration<T>();
break;
case "item":
output = new ItemConfiguration<T>();
break;
default:
Debug.LogError("Found unknown matching method \"" + elemRoot.Element(name).Elements().First().Name.LocalName + "\", assuming material.");
output = new MaterialConfiguration<T>();
Expand Down
27 changes: 24 additions & 3 deletions Assets/MapGen/ContentChosers/ItemConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
using System.Xml.Linq;

public class ItemContent<T> : ContentConfiguration<T> where T : IContent, new()
public class ItemConfiguration<T> : ContentConfiguration<T> where T : IContent, new()
{
ItemMatcher<Content> itemMatcher = new ItemMatcher<Content>();

public override bool GetValue(MapDataStore.Tile tile, MeshLayer layer, out T value)
{
throw new System.NotImplementedException();
Content cont;
if (itemMatcher.Get(tile.construction_item, out cont))
{
value = cont.GetValue(tile, layer);
return true;
}
value = default(T);
return false;
}

protected override void ParseElementConditions(XElement elemtype, ContentConfiguration<T>.Content content)
{
throw new System.NotImplementedException();
var elemItems = elemtype.Elements("item");
foreach (XElement elemItem in elemItems)
{
XAttribute elemToken = elemItem.Attribute("token");
if (elemToken != null)
{
if (elemToken.Value == "NONE")
defaultItem = content;
else
itemMatcher[elemToken.Value] = content;
continue;
}
}
}
}
1 change: 1 addition & 0 deletions Assets/MapGen/DFConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ void InitStatics()
{
MaterialTokenList.matTokenList = _netMaterialList.material_list;
TiletypeTokenList.tiletypeTokenList = _netTiletypeList.tiletype_list;
ItemTokenList.itemTokenList = _netItemList.material_list;
MapDataStore.tiletypeTokenList = _netTiletypeList.tiletype_list;
MapDataStore.InitMainMap(_netMapInfo.block_size_x * 16, _netMapInfo.block_size_y * 16, _netMapInfo.block_size_z);
Debug.Log("Materials fetched: " + _netMaterialList.material_list.Count);
Expand Down
5 changes: 4 additions & 1 deletion Assets/StreamingAssets/TileTextures/TileTextures.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
</tileTexture>
<tileTexture index = "5">
<tiletype token="WALL:*:CONSTRUCTION:*:*" />
<subObject index="6">
<item token = "BAR"/>
</subObject>
<subObject index="4">
<material token ="*:*:WOOD"/>
<item token ="WOOD"/>
</subObject>
</tileTexture>
<tileTexture index = "3">
Expand Down

0 comments on commit 124b6ef

Please sign in to comment.