Skip to content

Commit

Permalink
-Fixed bug with multiblock subtype matching
Browse files Browse the repository at this point in the history
-Added sector object manager refresh to entity constructors
-Fixed bug with getting turret target entity
-Fixed bugs with getting block owner and share mode
-Changed entities tab of server extender tool to sort by name
  • Loading branch information
chessmaster42 committed Sep 3, 2014
1 parent 3fea145 commit db71cba
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 15 deletions.
4 changes: 3 additions & 1 deletion SEModAPIExtensions/API/MultiblockStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,9 @@ public bool IsDefinitionMatch(CubeBlockEntity cubeToCheck, int recurseDepth = 0)
//Compare the block subtype, if enabled
if (entry.useSubTypeName)
{
if (!entry.subTypeName.Equals(posCubeBlock.Id.SubtypeName))
string cleanEntrySubType = entry.subTypeName.ToLower();
string cleanBlockSubType = posCubeBlock.Id.SubtypeName.ToLower();
if (cleanEntrySubType != cleanBlockSubType)
{
isMatch = false;
break;
Expand Down
4 changes: 2 additions & 2 deletions SEModAPIExtensions/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.1.6.5")]
[assembly: AssemblyFileVersion("0.1.6.5")]
[assembly: AssemblyVersion("0.1.6.6")]
[assembly: AssemblyFileVersion("0.1.6.6")]
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public CharacterEntity(MyObjectBuilder_Character definition, Object backingObjec
newEvent.entity = this;
newEvent.priority = 1;
EntityEventManager.Instance.AddEvent(newEvent);

SectorObjectManager.Instance.Refresh();
}

#endregion
Expand Down
2 changes: 2 additions & 0 deletions SEModAPIInternal/API/Entity/Sector/SectorObject/CubeGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public CubeGridEntity(MyObjectBuilder_CubeGrid definition, Object backingObject)
m_lastNameRefresh = DateTime.Now;
m_lastBaseCubeBlockRefresh = DateTime.Now;
m_name = "Cube Grid";

SectorObjectManager.Instance.Refresh();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,7 @@ public BaseObject Target
if (m_target == null)
{
long entityId = BaseEntity.GetEntityId(target);
MyObjectBuilder_EntityBase objectBuilder = BaseEntity.GetObjectBuilder(target);
if (objectBuilder != null && EntityRegistry.Instance.ContainsGameType(objectBuilder.GetType()))
{
m_target = SectorObjectManager.Instance.GetEntry(entityId);
}
if (BlockRegistry.Instance.ContainsGameType(target.GetType()))
{
//TODO - Match this up with the existing block
}
m_target = GameEntityManager.GetEntity(entityId);
}

return m_target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class CubeBlockEntity : BaseObject
public static string ActualCubeBlockGetFactionsObjectMethod = "3E8AC70E5FAAA9C8C4992B71E12CDE28";
public static string ActualCubeBlockSetFactionsDataMethod = "7161368A8164DF15904DC82476F7EBBA";
public static string ActualCubeBlockGetMatrixMethod = "FD50436D896ACC794550210055349FE0";
public static string ActualCubeBlockGetOwnerMethod = "5CE075E5E73578252A4A030502881491";

/////////////////////////////////////////////////////

Expand Down Expand Up @@ -528,6 +529,7 @@ public override void Export(FileInfo fileInfo)
result &= HasMethod(type, ActualCubeBlockGetFactionsObjectMethod);
result &= HasMethod(type, ActualCubeBlockSetFactionsDataMethod);
result &= HasMethod(type, ActualCubeBlockGetMatrixMethod);
result &= HasMethod(type, ActualCubeBlockGetOwnerMethod);

type = SandboxGameAssemblyWrapper.Instance.GetAssemblyType(FactionsDataNamespace, FactionsDataClass);
if (type == null)
Expand Down Expand Up @@ -632,7 +634,7 @@ protected Object GetConstructionManager()

protected long GetBlockOwner()
{
Object rawResult = GetEntityFieldValue(GetFactionData(), FactionsDataOwnerField);
Object rawResult = InvokeEntityMethod(ActualObject, ActualCubeBlockGetOwnerMethod);
if (rawResult == null)
return 0;
long result = (long)rawResult;
Expand All @@ -641,9 +643,13 @@ protected long GetBlockOwner()

protected MyOwnershipShareModeEnum GetBlockShareMode()
{
Object rawResult = GetEntityFieldValue(GetFactionData(), FactionsDataShareModeField);
Object factionData = GetFactionData();
if (factionData == null)
return MyOwnershipShareModeEnum.None;

Object rawResult = GetEntityFieldValue(factionData, FactionsDataShareModeField);
if (rawResult == null)
return 0;
return MyOwnershipShareModeEnum.None;
MyOwnershipShareModeEnum result = (MyOwnershipShareModeEnum)rawResult;
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public FloatingObject(MyObjectBuilder_FloatingObject definition, Object backingO
: base(definition, backingObject)
{
m_item = new InventoryItemEntity(definition.Item);

SectorObjectManager.Instance.Refresh();
}

#endregion
Expand Down
2 changes: 2 additions & 0 deletions SEModAPIInternal/API/Entity/Sector/SectorObject/Meteor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public Meteor(MyObjectBuilder_Meteor definition, Object backingObject)
: base(definition, backingObject)
{
m_item = new InventoryItemEntity(definition.Item);

SectorObjectManager.Instance.Refresh();
}

#endregion
Expand Down
2 changes: 2 additions & 0 deletions SEModAPIInternal/API/Entity/Sector/SectorObject/VoxelMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public VoxelMap(MyObjectBuilder_VoxelMap definition, Object backingObject)
: base(definition, backingObject)
{
m_materialManager = new VoxelMapMaterialManager(this, GetMaterialManager());

SectorObjectManager.Instance.Refresh();
}

#endregion
Expand Down
9 changes: 9 additions & 0 deletions SEServerExtender/SEServerExtender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,15 @@ private void RenderCubeGridNodes(TreeNode rootNode)
//Get cube grids
List<CubeGridEntity> list = m_cubeGridEntities;

//Sort the list of cube grids
list.Sort(delegate(CubeGridEntity x, CubeGridEntity y)
{
if (x.Name == null && y.Name == null) return 0;
else if (x.Name == null) return -1;
else if (y.Name == null) return 1;
else return x.Name.CompareTo(y.Name);
});

//Cleanup and update the existing nodes
foreach (TreeNode node in rootNode.Nodes)
{
Expand Down

0 comments on commit db71cba

Please sign in to comment.