Skip to content

Commit f1e5b63

Browse files
committed
Merge branch 'staging'
2 parents 6686d95 + 09395e7 commit f1e5b63

File tree

17 files changed

+276
-161
lines changed

17 files changed

+276
-161
lines changed

CathodeLib/CathodeLib.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<Authors>Matt Filer</Authors>
1111
<Description>Provides support for parsing and writing common Alien: Isolation formats from the Cathode engine.</Description>
1212
<Copyright>Matt Filer 2025</Copyright>
13-
<Version>0.8.1</Version>
13+
<Version>0.8.2</Version>
1414
<OutputType>Library</OutputType>
15-
<AssemblyVersion>0.7.8.1</AssemblyVersion>
16-
<FileVersion>0.7.8.1</FileVersion>
15+
<AssemblyVersion>0.7.8.2</AssemblyVersion>
16+
<FileVersion>0.7.8.2</FileVersion>
1717
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
1818
<PackageReadmeFile>README.md</PackageReadmeFile>
1919
<PackageTags>alien, modding, alien isolation, mod tool, file utility</PackageTags>
3.78 KB
Binary file not shown.
71 Bytes
Binary file not shown.

CathodeLib/Scripts/CATHODE/CommandsPAK/Components/Composite.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ public VariableEntity AddVariable(string parameter, DataType type)
105105
}
106106

107107
/* Add a new proxy entity */
108-
public ProxyEntity AddProxy(Commands commands, ShortGuid[] hierarchy, bool addDefaultParam = false)
108+
public ProxyEntity AddProxy(Commands commands, ShortGuid[] hierarchy)
109109
{
110110
CommandsUtils.ResolveHierarchy(commands, this, hierarchy, out Composite targetComposite, out string str);
111111
Entity ent = targetComposite.GetEntityByID(hierarchy[hierarchy.Length - 2]);
112112
if (ent.variant != EntityVariant.FUNCTION) return null;
113113

114-
ProxyEntity proxy = new ProxyEntity(hierarchy, ((FunctionEntity)ent).function, addDefaultParam);
114+
ProxyEntity proxy = new ProxyEntity(hierarchy, ((FunctionEntity)ent).function);
115115
proxies.Add(proxy);
116116
return proxy;
117117
}

CathodeLib/Scripts/CATHODE/CommandsPAK/Components/Entity.cs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ public Parameter AddParameter(ShortGuid id, DataType type, ParameterVariant vari
162162
data = new cResource(shortGUID);
163163
break;
164164
default:
165-
Console.WriteLine("WARNING: Tried to add parameter of type which is currently unsupported by CathodeLib (" + type + ")");
165+
data = new cFloat();
166+
Console.WriteLine("WARNING: Tried to add parameter of type which is currently unsupported by CathodeLib (" + type + ") - falling back to FLOAT"); //todo: should we fall to STRING?
166167
return null;
167168
}
168169
return AddParameter(id, data, variant, overwriteIfExists);
@@ -173,6 +174,9 @@ public Parameter AddParameter(string name, ParameterData data, ParameterVariant
173174
}
174175
public Parameter AddParameter(ShortGuid id, ParameterData data, ParameterVariant variant = ParameterVariant.PARAMETER, bool overwriteIfExists = true)
175176
{
177+
if (data == null)
178+
Console.WriteLine("WARNING: Entity " + this.shortGUID + " (" + this.variant + ") has null parameter data for " + id.ToString());
179+
176180
Parameter param = GetParameter(id);
177181
//TODO: we should also take inputs and outputs into account here??
178182
if (param == null)
@@ -189,18 +193,19 @@ public Parameter AddParameter(ShortGuid id, ParameterData data, ParameterVariant
189193
}
190194

191195
/* Remove a parameter from the entity */
192-
public void RemoveParameter(string name)
196+
public bool RemoveParameter(string name)
193197
{
194198
ShortGuid name_id = ShortGuidUtils.Generate(name);
195-
RemoveParameter(name_id);
199+
return RemoveParameter(name_id);
196200
}
197-
public void RemoveParameter(Parameter param)
201+
public bool RemoveParameter(Parameter param)
198202
{
199-
RemoveParameter(param.name);
203+
return RemoveParameter(param.name);
200204
}
201-
public void RemoveParameter(ShortGuid guid)
205+
public bool RemoveParameter(ShortGuid guid)
202206
{
203-
parameters.RemoveAll(o => o.name == guid);
207+
int count = parameters.RemoveAll(o => o.name == guid);
208+
return count != 0;
204209
}
205210

206211
/* Add a link from a parameter on us out to a parameter on another entity */
@@ -454,18 +459,16 @@ public class ProxyEntity : Entity
454459
public ProxyEntity() : base(EntityVariant.PROXY) { }
455460
public ProxyEntity(ShortGuid shortGUID) : base(shortGUID, EntityVariant.PROXY) { }
456461

457-
public ProxyEntity(ShortGuid[] hierarchy = null, ShortGuid targetType = new ShortGuid(), bool autoGenerateParameters = false) : base(EntityVariant.PROXY)
462+
public ProxyEntity(ShortGuid[] hierarchy = null, ShortGuid targetType = new ShortGuid()) : base(EntityVariant.PROXY)
458463
{
459464
this.function = targetType;
460465
if (hierarchy != null) this.proxy.path = hierarchy;
461-
if (autoGenerateParameters) ParameterUtils.AddAllDefaultParameters(this, null);
462466
}
463-
public ProxyEntity(ShortGuid shortGUID, ShortGuid[] hierarchy = null, ShortGuid targetType = new ShortGuid(), bool autoGenerateParameters = false) : base(shortGUID, EntityVariant.PROXY)
467+
public ProxyEntity(ShortGuid shortGUID, ShortGuid[] hierarchy = null, ShortGuid targetType = new ShortGuid()) : base(shortGUID, EntityVariant.PROXY)
464468
{
465469
this.shortGUID = shortGUID;
466470
this.function = targetType;
467471
if (hierarchy != null) this.proxy.path = hierarchy;
468-
if (autoGenerateParameters) ParameterUtils.AddAllDefaultParameters(this, null);
469472
}
470473

471474
public ShortGuid function; //The "function" value on the entity we're proxying
@@ -671,6 +674,16 @@ public EntityPath(ShortGuid[] _path)
671674
EnsureFinalIsEmpty();
672675
}
673676
public ShortGuid[] path = new ShortGuid[0];
677+
public List<uint> pathUint
678+
{
679+
get
680+
{
681+
List<uint> p = new List<uint>();
682+
for (int i = 0; i < path.Length; i++)
683+
p.Add(path[i].ToUInt32());
684+
return p;
685+
}
686+
}
674687

675688
public static bool operator ==(EntityPath x, EntityPath y)
676689
{

CathodeLib/Scripts/CATHODE/CommandsPAK/Components/ParameterData.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@ public cTransform(Vector3 position, Vector3 rotation)
167167
if (y == null) return x;
168168

169169

170-
170+
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
171+
return new cTransform(x.position + y.position, x.rotation + y.rotation);
172+
#else
171173
return new cTransform(x.position + y.position, x.rotation.AddEulerAngles(y.rotation));
174+
#endif
172175
}
173176

174177
public override string ToString()

CathodeLib/Scripts/CATHODE/CommandsPAK/Components/TypeEnums.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,33 +1072,34 @@ public enum EnumType : uint
10721072
/* Enum strings available within Cathode (these are cString type, but can be looked up using DATA) */
10731073
public enum EnumStringType : uint
10741074
{
1075-
//TODO: need to update the enum webpage with these
1076-
10771075
ACHIEVEMENT_ID = 3485949151,
10781076
ACHIEVEMENT_STAT_ID = 1970461931,
1079-
ANIM_SET = 796973007,
1080-
ANIM_TREE_SET = 398817255,
1077+
ANIMATION = 2509115680,
1078+
ANIMATION_SET = 1321730391,
1079+
ANIMATION_TREE_SET = 2152953390,
10811080
ATTRIBUTE_SET = 2268397301,
10821081
BLUEPRINT_TYPE = 3218638249,
1083-
CHR_SKELETON_SET = 3537648953,
1082+
DISPLAY_MODEL = 3965147331,
10841083
GAME_VARIABLE = 3806196912,
10851084
GAMEPLAY_TIP_STRING_ID = 3550943910,
10861085
IDTAG_ID = 3358979085,
10871086
MAP_KEYFRAME_ID = 1494642745,
1087+
MATERIAL = 2784799731,
10881088
NOSTROMO_LOG_ID = 1157640041,
10891089
OBJECTIVE_ENTRY_ID = 3067794301,
10901090
PRESENCE_ID = 2589585909,
10911091
SEVASTOPOL_LOG_ID = 3163607120,
1092-
SOUND_ARGUMENT = 4000624401,
1092+
SKELETON_SET = 2160375077,
1093+
SOUND_BANK = 379358807,
10931094
SOUND_EVENT = 3122669037,
10941095
SOUND_FOOTWEAR_GROUP = 911429336,
10951096
SOUND_LEG_GROUP = 1285801591,
1096-
SOUND_PARAMETER = 743631359,
10971097
SOUND_REVERB = 1053063402,
1098-
SOUND_RTPC = 3430842214,
1099-
SOUND_STATE = 3294208177,
1100-
SOUND_SWITCH = 1905083384,
11011098
SOUND_TORSO_GROUP = 1112933567,
1099+
STRING_OBJECTIVES = 2171201992,
1100+
STRING_TERMINAL = 193010591,
1101+
STRING_UI = 1125400399,
1102+
TEXTURE = 4073304977,
11021103
TUTORIAL_ENTRY_ID = 2135177174,
11031104
}
11041105

CathodeLib/Scripts/CATHODE/CommandsPAK/Helpers/CommandsUtils.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Linq;
6-
using System.Numerics;
76
using System.Text;
87
using System.Threading.Tasks;
8+
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
9+
using UnityEngine;
10+
#else
11+
using System.Numerics;
12+
#endif
913

1014
namespace CATHODE.Scripting
1115
{
@@ -343,7 +347,11 @@ public static (Vector3, Quaternion) CalculateInstancedPosition(EntityPath hierar
343347
if (comp == null)
344348
break;
345349
}
350+
#if UNITY_EDITOR || UNITY_STANDALONE_WIN
351+
return (globalTransform.position, Quaternion.Euler(globalTransform.rotation.x, globalTransform.rotation.y, globalTransform.rotation.z));
352+
#else
346353
return (globalTransform.position, Quaternion.CreateFromYawPitchRoll(globalTransform.rotation.Y * (float)Math.PI / 180.0f, globalTransform.rotation.X * (float)Math.PI / 180.0f, globalTransform.rotation.Z * (float)Math.PI / 180.0f));
354+
#endif
347355
}
348356

349357
/* CA's CAGE doesn't properly tidy up hierarchies pointing to deleted entities - so we can do that to save confusion */
@@ -460,6 +468,6 @@ public static bool PurgeDeadLinks(Commands commands, Composite composite, bool f
460468
"\n - " + (originalLinkCount - newLinkCount) + " entity links (of " + originalLinkCount + ")");
461469
return true;
462470
}
463-
#endregion
471+
#endregion
464472
}
465473
}

0 commit comments

Comments
 (0)