Skip to content

Commit af1b206

Browse files
committed
fix: unstringify null m_Seed ref on random
1 parent dd48d4d commit af1b206

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quickentity-script",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "An easier way of writing QN patches with code",
55
"main": "dist/src/lib.js",
66
"types": "./dist/src/index.d.ts",

src/patches/entity/random.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ PatchEntity.prototype.randomAction = function(actions, options = {}) {
5959
properties: {
6060
m_Seed: {
6161
type: 'SEntityTemplateReference',
62-
value: "null"
62+
value: null
6363
},
6464
m_Choices: {
6565
type: 'TArray<SEntityTemplateReference>',

src/utils/entities.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const generateRandomEntityID = () => ENTITY_ID_PREFIX + generateRandomHex
1313
export const generateRandomEntityName = () => "Generated by QNS_" + generateRandomHex(16)
1414

1515
export function ensureID(entity: TRef | IRefWithConstantValue): TRef | IRefWithConstantValue {
16+
if(entity === null) return null
1617
if(entity instanceof PatchEntity) return entity.id
1718
if(entity instanceof Entity) return entity.id
1819
if(entity.hasOwnProperty('value')) {
@@ -36,6 +37,7 @@ export function ensureID(entity: TRef | IRefWithConstantValue): TRef | IRefWithC
3637
}
3738

3839
export function deepEnsureID<T extends { id: any }>(obj: T): T {
40+
if(obj === null) return null
3941
const result: { [key: string]: any } = {}
4042
if(obj instanceof String) return obj
4143
if(obj instanceof PatchEntity) return obj.id as T

0 commit comments

Comments
 (0)