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