Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cccf174

Browse files
committedSep 28, 2021
Split up and updated the information
1 parent 1b9ef5a commit cccf174

File tree

12 files changed

+488
-463
lines changed

12 files changed

+488
-463
lines changed
 

‎src/Data/MolangData.ts

Lines changed: 0 additions & 460 deletions
This file was deleted.

‎src/Molang/Molang/Variables.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { RegularExpression } from "../RegExp";
33
/**The namespace that governs molang variables*/
44
export namespace Variables {
55
/**The pattern used to find the defintions of variables*/
6-
export const getDefinedPatt: RegExp = /(?:^|;[ \t]*|"[ \t]*)\b(?:v|variable)\.([a-z0-9_]*)[ \t]*\=/gim;
6+
export const getDefinedPatt: RegExp = /(?:^|;[ \t]*|"[ \t]*)\b(?:v|variable)\.([a-z0-9_\.]*)[ \t]*\=/gim;
77

88
/**The pattern used to find the variables*/
9-
export const getUsedPatt: RegExp = /\b(?:v|variable)\.([a-z0-9_]+)\b(?![ \t]+=)/gim;
9+
export const getUsedPatt: RegExp = /\b(?:v|variable)\.([a-z0-9_\.]+)\b(?![ \t]+=)/gim;
1010

1111
/**Spits through all the provided strings searching for all instances of defining variables.
1212
* @param data The string(s)/container to look through

‎src/MolangData/Blocks.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Data } from './Data';
2+
3+
/** */
4+
export namespace Blocks {
5+
/** */
6+
export const Variables: Data[] = [];
7+
/** */
8+
export const Contents: Data[] = [];
9+
/** */
10+
export const Temps: Data[] = [];
11+
}

‎src/MolangData/Data.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Types } from 'bc-minecraft-bedrock-types';
2+
3+
export type Data = Types.Identifiable & Types.Documentated;

‎src/MolangData/Entities.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Data } from './Data';
2+
3+
export namespace Entities {
4+
/** */
5+
export const Variables: Data[] = [{ id: "attack_time" }];
6+
/** */
7+
export const Contents: Data[] = [
8+
{ id: "is_first_person" },
9+
{ id: "item_slot" }
10+
];
11+
/** */
12+
export const Temps: Data[] = [];
13+
}

‎src/MolangData/FeaturesRules.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Data } from './Data';
2+
3+
/** */
4+
export namespace FeaturesRules {
5+
/** */
6+
export const Variables: Data[] = [{ id: "originx" }, { id: "originy" }, { id: "originz" }, { id: "worldx" }, { id: "worldy" }, { id: "worldz" }];
7+
/** */
8+
export const Contents: Data[] = [];
9+
/** */
10+
export const Temps: Data[] = [];
11+
}

‎src/MolangData/General.ts

Lines changed: 392 additions & 0 deletions
Large diffs are not rendered by default.

‎src/MolangData/Items.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Data } from './Data';
2+
3+
/** */
4+
export namespace Items {
5+
/** */
6+
export const Variables: Data[] = [];
7+
/** */
8+
export const Contents: Data[] = [];
9+
/** */
10+
export const Temps: Data[] = [];
11+
}

‎src/MolangData/Particles.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Data } from './Data';
2+
3+
/** */
4+
export namespace Particle {
5+
/** */
6+
export const Variables: Data[] = [
7+
{ documentation: "The total lifetime of the emitter in seconds", id: "emitter_lifetime" },
8+
{ documentation: "The age of the emitter in seconds", id: "emitter_age" },
9+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the emitter", id: "emitter_random_1" },
10+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the emitter", id: "emitter_random_2" },
11+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the emitter", id: "emitter_random_3" },
12+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the emitter", id: "emitter_random_4" },
13+
{ documentation: "The total lifetime of the particle in seconds", id: "particle_lifetime" },
14+
{ documentation: "The age of the particle in seconds", id: "particle_age" },
15+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the particle", id: "particle_random_1" },
16+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the particle", id: "particle_random_2" },
17+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the particle", id: "particle_random_3" },
18+
{ documentation: "A random value between 0 - 1 that gets sets at spawn of the particle", id: "particle_random_4" },
19+
{ documentation: "The scale of the entity that is using the particle", id: "entity_scale" },
20+
];
21+
/** */
22+
export const Contents: Data[] = [];
23+
/** */
24+
export const Temps: Data[] = [];
25+
}

‎src/MolangData/include.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
export * from './Data';
3+
export * from './Entities';
4+
export * from './FeaturesRules';
5+
export * from './General';
6+
export * from './Items';
7+
export * from './Particles';

‎src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export * from "./Data/MolangData";
1+
export * as MolangData from "./MolangData/include";
22
export * from "./Types/Defined Using/include";
33
export * from "./Molang/include";

‎test/molang/Variables.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ describe("molang", () => {
2828
expect(receiver).to.contain.members(VanillaPlayer.Variables.defined);
2929
});
3030

31+
it("defined special",()=>{
32+
const data = `"initialize": [
33+
"variable.armor_stand.pose_index = 0;",
34+
"variable.armor_stand.hurt_time = 0;"
35+
]`;
36+
37+
let receiver : string[] = [];
38+
Molang.Variables.getDefined(data, receiver);
39+
40+
expect(receiver).to.contains.members(["armor_stand.pose_index", "armor_stand.hurt_time"])
41+
})
42+
3143
it("duplicate check", () => {
3244
let receiver: string[] = [];
3345

0 commit comments

Comments
 (0)
Please sign in to comment.