Merge GetObjectPath implementations
This commit is contained in:
parent
0d7ff677de
commit
e313ca58a7
|
@ -162,27 +162,28 @@ public class ResourcePathManager
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetObjectPath(string objectName)
|
|
||||||
{
|
|
||||||
if (!_initialised) return null;
|
|
||||||
|
|
||||||
objectName = objectName.ToLower();
|
|
||||||
if (_omResources.objectPathMap.TryGetValue(objectName, out var path))
|
|
||||||
{
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetObjectPath(string campaignName, string objectName)
|
public string GetObjectPath(string campaignName, string objectName)
|
||||||
{
|
{
|
||||||
if (!_initialised) return null;
|
if (!_initialised) return null;
|
||||||
|
|
||||||
objectName = objectName.ToLower();
|
objectName = objectName.ToLower();
|
||||||
if (_fmResources.TryGetValue(campaignName, out var campaign) &&
|
if (campaignName == null || campaignName == "")
|
||||||
campaign.objectPathMap.TryGetValue(objectName, out var path))
|
|
||||||
{
|
{
|
||||||
return path;
|
if (_omResources.objectPathMap.TryGetValue(objectName, out var omPath))
|
||||||
|
{
|
||||||
|
return omPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_fmResources.TryGetValue(campaignName, out var campaign))
|
||||||
|
{
|
||||||
|
if (campaign.objectPathMap.TryGetValue(objectName, out var fmPath))
|
||||||
|
{
|
||||||
|
return fmPath;
|
||||||
|
}
|
||||||
|
else if (_omResources.objectPathMap.TryGetValue(objectName, out var omPath))
|
||||||
|
{
|
||||||
|
return omPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,9 +164,7 @@ public partial class Mission : Node3D
|
||||||
|
|
||||||
// Let's try and place an object :)
|
// Let's try and place an object :)
|
||||||
var modelName = modelNameProp.modelName + ".bin";
|
var modelName = modelNameProp.modelName + ".bin";
|
||||||
var fmName = FileName.GetBaseDir().GetFile(); // TODO: Doesn't work for OMs
|
var objPath = _installPaths.GetObjectPath(_campaignName, modelName);
|
||||||
var objPath = _installPaths.GetObjectPath(fmName, modelName);
|
|
||||||
objPath ??= _installPaths.GetObjectPath(modelName);
|
|
||||||
|
|
||||||
var pos = brush.position.ToGodotVec3();
|
var pos = brush.position.ToGodotVec3();
|
||||||
var rawRot = brush.angle;
|
var rawRot = brush.angle;
|
||||||
|
|
Loading…
Reference in New Issue