@silkweaver/build 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.js +7 -4
- package/dist/object_format.d.ts +7 -6
- package/dist/object_format.js +11 -10
- package/package.json +1 -1
- package/templates/empty/.engine/engine.mjs +17557 -0
- package/templates/empty/.engine/version.json +4 -0
- package/templates/empty/project.json +2 -2
- package/templates/physics_ball/.engine/engine.mjs +277 -200
- package/templates/physics_ball/.engine/version.json +2 -2
- package/templates/physics_ball/objects/obj_ball.ts +5 -5
- package/templates/physics_ball/objects/obj_paddle.ts +8 -7
- package/templates/physics_ball/objects/obj_tracker.ts +1 -1
- package/templates/physics_ball/project.json +1 -1
- package/templates/platformer/.engine/engine.mjs +17557 -0
- package/templates/platformer/.engine/version.json +4 -0
- package/templates/platformer/objects/obj_platform.ts +0 -2
- package/templates/platformer/objects/obj_player.ts +33 -23
- package/templates/platformer/project.json +2 -2
- package/templates/topdown/.engine/engine.mjs +17557 -0
- package/templates/topdown/.engine/version.json +4 -0
- package/templates/topdown/objects/obj_player.ts +35 -37
- package/templates/topdown/project.json +2 -2
|
@@ -4948,6 +4948,40 @@ var game_event = class {
|
|
|
4948
4948
|
}
|
|
4949
4949
|
};
|
|
4950
4950
|
|
|
4951
|
+
// packages/engine/dist/core/active_instance.js
|
|
4952
|
+
var _active = null;
|
|
4953
|
+
function run_as(target, fn) {
|
|
4954
|
+
const prev = _active;
|
|
4955
|
+
_active = target;
|
|
4956
|
+
try {
|
|
4957
|
+
fn();
|
|
4958
|
+
} finally {
|
|
4959
|
+
_active = prev;
|
|
4960
|
+
}
|
|
4961
|
+
}
|
|
4962
|
+
__name(run_as, "run_as");
|
|
4963
|
+
function _no_active() {
|
|
4964
|
+
throw new Error("`sw`/`inst` was used with no current instance. They refer to the instance whose event is running, so they are only valid inside object events (on_create, on_step, on_draw, \u2026).");
|
|
4965
|
+
}
|
|
4966
|
+
__name(_no_active, "_no_active");
|
|
4967
|
+
var _proxy = new Proxy({}, {
|
|
4968
|
+
get(_t, prop) {
|
|
4969
|
+
const a = _active ?? _no_active();
|
|
4970
|
+
const v = a[prop];
|
|
4971
|
+
return typeof v === "function" ? v.bind(a) : v;
|
|
4972
|
+
},
|
|
4973
|
+
set(_t, prop, value) {
|
|
4974
|
+
const a = _active ?? _no_active();
|
|
4975
|
+
a[prop] = value;
|
|
4976
|
+
return true;
|
|
4977
|
+
},
|
|
4978
|
+
has(_t, prop) {
|
|
4979
|
+
return prop in (_active ?? _no_active());
|
|
4980
|
+
}
|
|
4981
|
+
});
|
|
4982
|
+
var sw = _proxy;
|
|
4983
|
+
var inst = _proxy;
|
|
4984
|
+
|
|
4951
4985
|
// packages/engine/dist/core/resource.js
|
|
4952
4986
|
var resource = class _resource {
|
|
4953
4987
|
static {
|
|
@@ -5182,8 +5216,8 @@ var room = class _room2 extends resource {
|
|
|
5182
5216
|
* Adds an instance to this room at runtime.
|
|
5183
5217
|
* @param inst - The instance to add
|
|
5184
5218
|
*/
|
|
5185
|
-
instance_add(
|
|
5186
|
-
this.all.set(
|
|
5219
|
+
instance_add(inst2) {
|
|
5220
|
+
this.all.set(inst2.id, inst2);
|
|
5187
5221
|
}
|
|
5188
5222
|
/**
|
|
5189
5223
|
* Removes an instance from this room by ID.
|
|
@@ -5226,9 +5260,9 @@ var room = class _room2 extends resource {
|
|
|
5226
5260
|
* Called when entering a room to set up event handlers.
|
|
5227
5261
|
*/
|
|
5228
5262
|
register_all_instances() {
|
|
5229
|
-
for (const
|
|
5230
|
-
|
|
5231
|
-
game_loop.register(EVENT_TYPE.create,
|
|
5263
|
+
for (const inst2 of this.all.values()) {
|
|
5264
|
+
inst2.register_events();
|
|
5265
|
+
game_loop.register(EVENT_TYPE.create, () => run_as(inst2, () => inst2.on_create()));
|
|
5232
5266
|
}
|
|
5233
5267
|
}
|
|
5234
5268
|
/**
|
|
@@ -5236,9 +5270,9 @@ var room = class _room2 extends resource {
|
|
|
5236
5270
|
* builder can repopulate it cleanly. Destroyed silently — no Destroy events fire.
|
|
5237
5271
|
*/
|
|
5238
5272
|
reset_contents() {
|
|
5239
|
-
for (const
|
|
5240
|
-
|
|
5241
|
-
resource.removeByID(
|
|
5273
|
+
for (const inst2 of this.all.values()) {
|
|
5274
|
+
inst2.dispose_for_rebuild();
|
|
5275
|
+
resource.removeByID(inst2.id);
|
|
5242
5276
|
}
|
|
5243
5277
|
this.all.clear();
|
|
5244
5278
|
this.tiles = [];
|
|
@@ -5253,8 +5287,8 @@ var room = class _room2 extends resource {
|
|
|
5253
5287
|
*/
|
|
5254
5288
|
build_for_entry() {
|
|
5255
5289
|
if (this.room_persistent && this.built) {
|
|
5256
|
-
for (const
|
|
5257
|
-
|
|
5290
|
+
for (const inst2 of this.all.values())
|
|
5291
|
+
inst2.register_events();
|
|
5258
5292
|
return;
|
|
5259
5293
|
}
|
|
5260
5294
|
this.reset_contents();
|
|
@@ -6859,12 +6893,12 @@ var game_loop = class {
|
|
|
6859
6893
|
if (!physics_world_get_engine() || !this.room)
|
|
6860
6894
|
return;
|
|
6861
6895
|
const instances = this.room.instance_get_all();
|
|
6862
|
-
for (const
|
|
6863
|
-
|
|
6896
|
+
for (const inst2 of instances)
|
|
6897
|
+
inst2.phy_ensure_body();
|
|
6864
6898
|
physics_world_step();
|
|
6865
|
-
for (const
|
|
6866
|
-
if (
|
|
6867
|
-
|
|
6899
|
+
for (const inst2 of instances)
|
|
6900
|
+
if (inst2.active)
|
|
6901
|
+
inst2.phy_sync_from_body();
|
|
6868
6902
|
}
|
|
6869
6903
|
/**
|
|
6870
6904
|
* Runs all draw events in GMS order.
|
|
@@ -6958,9 +6992,9 @@ var game_loop = class {
|
|
|
6958
6992
|
static _dispatch_lifecycle(method) {
|
|
6959
6993
|
if (!this.room)
|
|
6960
6994
|
return;
|
|
6961
|
-
for (const
|
|
6962
|
-
if (
|
|
6963
|
-
|
|
6995
|
+
for (const inst2 of this.room.instance_get_all()) {
|
|
6996
|
+
if (inst2.active)
|
|
6997
|
+
run_as(inst2, () => inst2[method]());
|
|
6964
6998
|
}
|
|
6965
6999
|
}
|
|
6966
7000
|
};
|
|
@@ -7215,27 +7249,27 @@ __name(date_time_string, "date_time_string");
|
|
|
7215
7249
|
var MASK_RECT = 0;
|
|
7216
7250
|
var MASK_CIRCLE = 1;
|
|
7217
7251
|
var MASK_ELLIPSE = 2;
|
|
7218
|
-
function get_bbox(
|
|
7219
|
-
const px = x ??
|
|
7220
|
-
const py = y ??
|
|
7221
|
-
if (
|
|
7222
|
-
const sx2 =
|
|
7223
|
-
const sy2 =
|
|
7224
|
-
const
|
|
7225
|
-
const
|
|
7252
|
+
function get_bbox(inst2, x, y) {
|
|
7253
|
+
const px = x ?? inst2.x;
|
|
7254
|
+
const py = y ?? inst2.y;
|
|
7255
|
+
if (inst2.mask_manual) {
|
|
7256
|
+
const sx2 = inst2.image_xscale;
|
|
7257
|
+
const sy2 = inst2.image_yscale;
|
|
7258
|
+
const x12 = px + inst2.mask_off_left * sx2, x22 = px + inst2.mask_off_right * sx2;
|
|
7259
|
+
const y12 = py + inst2.mask_off_top * sy2, y22 = py + inst2.mask_off_bottom * sy2;
|
|
7226
7260
|
return {
|
|
7227
|
-
left: Math.min(
|
|
7228
|
-
top: Math.min(
|
|
7229
|
-
right: Math.max(
|
|
7230
|
-
bottom: Math.max(
|
|
7261
|
+
left: Math.min(x12, x22),
|
|
7262
|
+
top: Math.min(y12, y22),
|
|
7263
|
+
right: Math.max(x12, x22),
|
|
7264
|
+
bottom: Math.max(y12, y22)
|
|
7231
7265
|
};
|
|
7232
7266
|
}
|
|
7233
|
-
const sprite2 = get_sprite_for_instance(
|
|
7267
|
+
const sprite2 = get_sprite_for_instance(inst2);
|
|
7234
7268
|
if (!sprite2) {
|
|
7235
7269
|
return { left: px, top: py, right: px + 1, bottom: py + 1 };
|
|
7236
7270
|
}
|
|
7237
|
-
const sx =
|
|
7238
|
-
const sy =
|
|
7271
|
+
const sx = inst2.image_xscale;
|
|
7272
|
+
const sy = inst2.image_yscale;
|
|
7239
7273
|
const ox = sprite2.xoffset * sx;
|
|
7240
7274
|
const oy = sprite2.yoffset * sy;
|
|
7241
7275
|
const has_mask = sprite2.mask_left >= 0;
|
|
@@ -7243,24 +7277,26 @@ function get_bbox(inst, x, y) {
|
|
|
7243
7277
|
const mt = has_mask ? sprite2.mask_top : 0;
|
|
7244
7278
|
const mr = has_mask ? sprite2.mask_right : sprite2.width;
|
|
7245
7279
|
const mb = has_mask ? sprite2.mask_bottom : sprite2.height;
|
|
7280
|
+
const x1 = px - ox + ml * sx, x2 = px - ox + mr * sx;
|
|
7281
|
+
const y1 = py - oy + mt * sy, y2 = py - oy + mb * sy;
|
|
7246
7282
|
return {
|
|
7247
|
-
left:
|
|
7248
|
-
top:
|
|
7249
|
-
right:
|
|
7250
|
-
bottom:
|
|
7283
|
+
left: Math.min(x1, x2),
|
|
7284
|
+
top: Math.min(y1, y2),
|
|
7285
|
+
right: Math.max(x1, x2),
|
|
7286
|
+
bottom: Math.max(y1, y2)
|
|
7251
7287
|
};
|
|
7252
7288
|
}
|
|
7253
7289
|
__name(get_bbox, "get_bbox");
|
|
7254
|
-
function update_bbox(
|
|
7255
|
-
const bbox = get_bbox(
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7290
|
+
function update_bbox(inst2) {
|
|
7291
|
+
const bbox = get_bbox(inst2);
|
|
7292
|
+
inst2.bbox_left = bbox.left;
|
|
7293
|
+
inst2.bbox_top = bbox.top;
|
|
7294
|
+
inst2.bbox_right = bbox.right;
|
|
7295
|
+
inst2.bbox_bottom = bbox.bottom;
|
|
7260
7296
|
}
|
|
7261
7297
|
__name(update_bbox, "update_bbox");
|
|
7262
|
-
function get_sprite_for_instance(
|
|
7263
|
-
const idx =
|
|
7298
|
+
function get_sprite_for_instance(inst2) {
|
|
7299
|
+
const idx = inst2.mask_index >= 0 ? inst2.mask_index : inst2.sprite_index;
|
|
7264
7300
|
if (idx < 0)
|
|
7265
7301
|
return null;
|
|
7266
7302
|
const res = resource.findByID(idx);
|
|
@@ -7618,10 +7654,10 @@ function mp_grid_add_instances(grid_id, obj, _prec = false) {
|
|
|
7618
7654
|
const room2 = game_loop.room;
|
|
7619
7655
|
if (!g || !room2)
|
|
7620
7656
|
return;
|
|
7621
|
-
for (const
|
|
7622
|
-
if (!object_match(
|
|
7657
|
+
for (const inst2 of room2.instance_get_all()) {
|
|
7658
|
+
if (!object_match(inst2, obj) || !inst2.active)
|
|
7623
7659
|
continue;
|
|
7624
|
-
_rect_cells(g,
|
|
7660
|
+
_rect_cells(g, inst2.bbox_left, inst2.bbox_top, inst2.bbox_right, inst2.bbox_bottom, 1);
|
|
7625
7661
|
}
|
|
7626
7662
|
}
|
|
7627
7663
|
__name(mp_grid_add_instances, "mp_grid_add_instances");
|
|
@@ -8015,9 +8051,9 @@ function set_draw_sprite_ext(fn) {
|
|
|
8015
8051
|
_renderer_draw_sprite_ext = fn;
|
|
8016
8052
|
}
|
|
8017
8053
|
__name(set_draw_sprite_ext, "set_draw_sprite_ext");
|
|
8018
|
-
function object_match(
|
|
8019
|
-
const ctor =
|
|
8020
|
-
if (
|
|
8054
|
+
function object_match(inst2, obj) {
|
|
8055
|
+
const ctor = inst2.constructor;
|
|
8056
|
+
if (inst2 instanceof obj)
|
|
8021
8057
|
return true;
|
|
8022
8058
|
const is_ancestor_of = obj.is_ancestor_of;
|
|
8023
8059
|
return typeof is_ancestor_of === "function" && is_ancestor_of.call(obj, ctor);
|
|
@@ -8099,10 +8135,10 @@ var instance = class _instance extends resource {
|
|
|
8099
8135
|
this._bound_draw_gui = () => {
|
|
8100
8136
|
};
|
|
8101
8137
|
this.room = room2;
|
|
8102
|
-
this._bound_step_begin = this.on_step_begin
|
|
8103
|
-
this._bound_step = this.internal_step
|
|
8104
|
-
this._bound_step_end = this.on_step_end
|
|
8105
|
-
this._bound_draw_gui = this.on_draw_gui
|
|
8138
|
+
this._bound_step_begin = () => run_as(this, () => this.on_step_begin());
|
|
8139
|
+
this._bound_step = () => run_as(this, () => this.internal_step());
|
|
8140
|
+
this._bound_step_end = () => run_as(this, () => this.on_step_end());
|
|
8141
|
+
this._bound_draw_gui = () => run_as(this, () => this.on_draw_gui());
|
|
8106
8142
|
}
|
|
8107
8143
|
// =========================================================================
|
|
8108
8144
|
// Lifecycle
|
|
@@ -8116,17 +8152,17 @@ var instance = class _instance extends resource {
|
|
|
8116
8152
|
*/
|
|
8117
8153
|
static instance_create(x, y, obj) {
|
|
8118
8154
|
const currentRoom = game_loop.room;
|
|
8119
|
-
const
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
currentRoom.instance_add(
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
return
|
|
8155
|
+
const inst2 = new obj(currentRoom);
|
|
8156
|
+
inst2.x = x;
|
|
8157
|
+
inst2.y = y;
|
|
8158
|
+
inst2.xstart = x;
|
|
8159
|
+
inst2.ystart = y;
|
|
8160
|
+
inst2.xprevious = x;
|
|
8161
|
+
inst2.yprevious = y;
|
|
8162
|
+
currentRoom.instance_add(inst2);
|
|
8163
|
+
inst2.register_events();
|
|
8164
|
+
instance_queue_create(inst2);
|
|
8165
|
+
return inst2;
|
|
8130
8166
|
}
|
|
8131
8167
|
/**
|
|
8132
8168
|
* Creates a new instance at the specified position with an explicit depth.
|
|
@@ -8137,9 +8173,9 @@ var instance = class _instance extends resource {
|
|
|
8137
8173
|
* @returns The newly created instance
|
|
8138
8174
|
*/
|
|
8139
8175
|
static instance_create_depth(x, y, depth, obj) {
|
|
8140
|
-
const
|
|
8141
|
-
|
|
8142
|
-
return
|
|
8176
|
+
const inst2 = _instance.instance_create(x, y, obj);
|
|
8177
|
+
inst2.depth = depth;
|
|
8178
|
+
return inst2;
|
|
8143
8179
|
}
|
|
8144
8180
|
/**
|
|
8145
8181
|
* Releases this instance's external resources (physics body) without firing a Destroy
|
|
@@ -8163,7 +8199,7 @@ var instance = class _instance extends resource {
|
|
|
8163
8199
|
physics_body_destroy(this.phy_body_id);
|
|
8164
8200
|
this.phy_body_id = -1;
|
|
8165
8201
|
}
|
|
8166
|
-
game_loop.register(EVENT_TYPE.destroy, this.on_destroy
|
|
8202
|
+
game_loop.register(EVENT_TYPE.destroy, () => run_as(this, () => this.on_destroy()));
|
|
8167
8203
|
this.unregister_events();
|
|
8168
8204
|
this.room.instance_remove(this.id);
|
|
8169
8205
|
resource.removeByID(this.id);
|
|
@@ -8173,9 +8209,9 @@ var instance = class _instance extends resource {
|
|
|
8173
8209
|
* @param id - ID of the instance to destroy
|
|
8174
8210
|
*/
|
|
8175
8211
|
static instance_destroy_id(id) {
|
|
8176
|
-
const
|
|
8177
|
-
if (
|
|
8178
|
-
|
|
8212
|
+
const inst2 = _instance.instance_find(id);
|
|
8213
|
+
if (inst2)
|
|
8214
|
+
inst2.instance_destroy();
|
|
8179
8215
|
}
|
|
8180
8216
|
/**
|
|
8181
8217
|
* Registers this instance's event handlers with the game loop.
|
|
@@ -8339,19 +8375,19 @@ var instance = class _instance extends resource {
|
|
|
8339
8375
|
run_draw() {
|
|
8340
8376
|
if (!this.visible || !this.active)
|
|
8341
8377
|
return;
|
|
8342
|
-
this.on_draw();
|
|
8378
|
+
run_as(this, () => this.on_draw());
|
|
8343
8379
|
}
|
|
8344
8380
|
/** Runs the Draw Begin event (skips hidden/inactive instances). */
|
|
8345
8381
|
run_draw_begin() {
|
|
8346
8382
|
if (!this.visible || !this.active)
|
|
8347
8383
|
return;
|
|
8348
|
-
this.on_draw_begin();
|
|
8384
|
+
run_as(this, () => this.on_draw_begin());
|
|
8349
8385
|
}
|
|
8350
8386
|
/** Runs the Draw End event (skips hidden/inactive instances). */
|
|
8351
8387
|
run_draw_end() {
|
|
8352
8388
|
if (!this.visible || !this.active)
|
|
8353
8389
|
return;
|
|
8354
|
-
this.on_draw_end();
|
|
8390
|
+
run_as(this, () => this.on_draw_end());
|
|
8355
8391
|
}
|
|
8356
8392
|
// =========================================================================
|
|
8357
8393
|
// Instance queries (static)
|
|
@@ -8388,8 +8424,8 @@ var instance = class _instance extends resource {
|
|
|
8388
8424
|
if (!rm)
|
|
8389
8425
|
return 0;
|
|
8390
8426
|
let count = 0;
|
|
8391
|
-
for (const
|
|
8392
|
-
if (object_match(
|
|
8427
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8428
|
+
if (object_match(inst2, obj) && inst2.active)
|
|
8393
8429
|
count++;
|
|
8394
8430
|
}
|
|
8395
8431
|
return count;
|
|
@@ -8405,10 +8441,10 @@ var instance = class _instance extends resource {
|
|
|
8405
8441
|
if (!rm)
|
|
8406
8442
|
return void 0;
|
|
8407
8443
|
let i = 0;
|
|
8408
|
-
for (const
|
|
8409
|
-
if (object_match(
|
|
8444
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8445
|
+
if (object_match(inst2, obj) && inst2.active) {
|
|
8410
8446
|
if (i === n)
|
|
8411
|
-
return
|
|
8447
|
+
return inst2;
|
|
8412
8448
|
i++;
|
|
8413
8449
|
}
|
|
8414
8450
|
}
|
|
@@ -8425,9 +8461,9 @@ var instance = class _instance extends resource {
|
|
|
8425
8461
|
const rm = game_loop.room;
|
|
8426
8462
|
if (!rm)
|
|
8427
8463
|
return void 0;
|
|
8428
|
-
for (const
|
|
8429
|
-
if (object_match(
|
|
8430
|
-
return
|
|
8464
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8465
|
+
if (object_match(inst2, obj) && inst2.active && point_in_instance(x, y, inst2)) {
|
|
8466
|
+
return inst2;
|
|
8431
8467
|
}
|
|
8432
8468
|
}
|
|
8433
8469
|
return void 0;
|
|
@@ -8445,14 +8481,14 @@ var instance = class _instance extends resource {
|
|
|
8445
8481
|
return void 0;
|
|
8446
8482
|
let nearest;
|
|
8447
8483
|
let min_dist = Infinity;
|
|
8448
|
-
for (const
|
|
8449
|
-
if (object_match(
|
|
8450
|
-
const dx =
|
|
8451
|
-
const dy =
|
|
8484
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8485
|
+
if (object_match(inst2, obj) && inst2.active) {
|
|
8486
|
+
const dx = inst2.x - x;
|
|
8487
|
+
const dy = inst2.y - y;
|
|
8452
8488
|
const d = dx * dx + dy * dy;
|
|
8453
8489
|
if (d < min_dist) {
|
|
8454
8490
|
min_dist = d;
|
|
8455
|
-
nearest =
|
|
8491
|
+
nearest = inst2;
|
|
8456
8492
|
}
|
|
8457
8493
|
}
|
|
8458
8494
|
}
|
|
@@ -8471,14 +8507,14 @@ var instance = class _instance extends resource {
|
|
|
8471
8507
|
return void 0;
|
|
8472
8508
|
let furthest;
|
|
8473
8509
|
let max_dist = -1;
|
|
8474
|
-
for (const
|
|
8475
|
-
if (object_match(
|
|
8476
|
-
const dx =
|
|
8477
|
-
const dy =
|
|
8510
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8511
|
+
if (object_match(inst2, obj) && inst2.active) {
|
|
8512
|
+
const dx = inst2.x - x;
|
|
8513
|
+
const dy = inst2.y - y;
|
|
8478
8514
|
const d = dx * dx + dy * dy;
|
|
8479
8515
|
if (d > max_dist) {
|
|
8480
8516
|
max_dist = d;
|
|
8481
|
-
furthest =
|
|
8517
|
+
furthest = inst2;
|
|
8482
8518
|
}
|
|
8483
8519
|
}
|
|
8484
8520
|
}
|
|
@@ -8493,10 +8529,10 @@ var instance = class _instance extends resource {
|
|
|
8493
8529
|
const rm = game_loop.room;
|
|
8494
8530
|
if (!rm)
|
|
8495
8531
|
return;
|
|
8496
|
-
for (const
|
|
8497
|
-
if (not_me &&
|
|
8532
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8533
|
+
if (not_me && inst2 === this)
|
|
8498
8534
|
continue;
|
|
8499
|
-
|
|
8535
|
+
inst2.active = false;
|
|
8500
8536
|
}
|
|
8501
8537
|
}
|
|
8502
8538
|
/**
|
|
@@ -8507,9 +8543,9 @@ var instance = class _instance extends resource {
|
|
|
8507
8543
|
const rm = game_loop.room;
|
|
8508
8544
|
if (!rm)
|
|
8509
8545
|
return;
|
|
8510
|
-
for (const
|
|
8511
|
-
if (object_match(
|
|
8512
|
-
|
|
8546
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8547
|
+
if (object_match(inst2, obj))
|
|
8548
|
+
inst2.active = false;
|
|
8513
8549
|
}
|
|
8514
8550
|
}
|
|
8515
8551
|
/**
|
|
@@ -8519,8 +8555,8 @@ var instance = class _instance extends resource {
|
|
|
8519
8555
|
const rm = game_loop.room;
|
|
8520
8556
|
if (!rm)
|
|
8521
8557
|
return;
|
|
8522
|
-
for (const
|
|
8523
|
-
|
|
8558
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8559
|
+
inst2.active = true;
|
|
8524
8560
|
}
|
|
8525
8561
|
}
|
|
8526
8562
|
/**
|
|
@@ -8531,9 +8567,9 @@ var instance = class _instance extends resource {
|
|
|
8531
8567
|
const rm = game_loop.room;
|
|
8532
8568
|
if (!rm)
|
|
8533
8569
|
return;
|
|
8534
|
-
for (const
|
|
8535
|
-
if (object_match(
|
|
8536
|
-
|
|
8570
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8571
|
+
if (object_match(inst2, obj))
|
|
8572
|
+
inst2.active = true;
|
|
8537
8573
|
}
|
|
8538
8574
|
}
|
|
8539
8575
|
/**
|
|
@@ -8544,9 +8580,9 @@ var instance = class _instance extends resource {
|
|
|
8544
8580
|
* @param r - Region right
|
|
8545
8581
|
* @param b - Region bottom
|
|
8546
8582
|
*/
|
|
8547
|
-
static _bbox_in_region(
|
|
8548
|
-
update_bbox(
|
|
8549
|
-
return
|
|
8583
|
+
static _bbox_in_region(inst2, l, t, r, b) {
|
|
8584
|
+
update_bbox(inst2);
|
|
8585
|
+
return inst2.bbox_right >= l && inst2.bbox_left <= r && inst2.bbox_bottom >= t && inst2.bbox_top <= b;
|
|
8550
8586
|
}
|
|
8551
8587
|
/**
|
|
8552
8588
|
* Deactivates instances within (or outside) a rectangular region.
|
|
@@ -8562,11 +8598,11 @@ var instance = class _instance extends resource {
|
|
|
8562
8598
|
if (!rm)
|
|
8563
8599
|
return;
|
|
8564
8600
|
const r = left + width, b = top + height;
|
|
8565
|
-
for (const
|
|
8566
|
-
if (not_me &&
|
|
8601
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8602
|
+
if (not_me && inst2 === this)
|
|
8567
8603
|
continue;
|
|
8568
|
-
if (_instance._bbox_in_region(
|
|
8569
|
-
|
|
8604
|
+
if (_instance._bbox_in_region(inst2, left, top, r, b) === inside)
|
|
8605
|
+
inst2.active = false;
|
|
8570
8606
|
}
|
|
8571
8607
|
}
|
|
8572
8608
|
/**
|
|
@@ -8582,9 +8618,9 @@ var instance = class _instance extends resource {
|
|
|
8582
8618
|
if (!rm)
|
|
8583
8619
|
return;
|
|
8584
8620
|
const r = left + width, b = top + height;
|
|
8585
|
-
for (const
|
|
8586
|
-
if (_instance._bbox_in_region(
|
|
8587
|
-
|
|
8621
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8622
|
+
if (_instance._bbox_in_region(inst2, left, top, r, b) === inside)
|
|
8623
|
+
inst2.active = true;
|
|
8588
8624
|
}
|
|
8589
8625
|
}
|
|
8590
8626
|
// =========================================================================
|
|
@@ -8895,13 +8931,13 @@ var instance = class _instance extends resource {
|
|
|
8895
8931
|
if (!rm)
|
|
8896
8932
|
return Infinity;
|
|
8897
8933
|
let min_dist = Infinity;
|
|
8898
|
-
for (const
|
|
8899
|
-
if (
|
|
8934
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
8935
|
+
if (inst2 === this || !inst2.active)
|
|
8900
8936
|
continue;
|
|
8901
|
-
if (!object_match(
|
|
8937
|
+
if (!object_match(inst2, obj))
|
|
8902
8938
|
continue;
|
|
8903
|
-
const dx =
|
|
8904
|
-
const dy =
|
|
8939
|
+
const dx = inst2.x - this.x;
|
|
8940
|
+
const dy = inst2.y - this.y;
|
|
8905
8941
|
const d = Math.sqrt(dx * dx + dy * dy);
|
|
8906
8942
|
if (d < min_dist)
|
|
8907
8943
|
min_dist = d;
|
|
@@ -9432,29 +9468,35 @@ var instance = class _instance extends resource {
|
|
|
9432
9468
|
};
|
|
9433
9469
|
function with_object(obj, callback) {
|
|
9434
9470
|
if (Array.isArray(obj)) {
|
|
9435
|
-
for (const
|
|
9436
|
-
if (
|
|
9437
|
-
callback(
|
|
9471
|
+
for (const inst2 of obj) {
|
|
9472
|
+
if (inst2.active)
|
|
9473
|
+
run_as(inst2, () => callback(inst2));
|
|
9438
9474
|
}
|
|
9439
9475
|
return;
|
|
9440
9476
|
}
|
|
9441
9477
|
const rm = game_loop.room;
|
|
9442
9478
|
if (!rm)
|
|
9443
9479
|
return;
|
|
9444
|
-
for (const
|
|
9445
|
-
if (object_match(
|
|
9446
|
-
callback(
|
|
9480
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
9481
|
+
if (object_match(inst2, obj) && inst2.active) {
|
|
9482
|
+
run_as(inst2, () => callback(inst2));
|
|
9447
9483
|
}
|
|
9448
9484
|
}
|
|
9449
9485
|
}
|
|
9450
9486
|
__name(with_object, "with_object");
|
|
9487
|
+
function instance_queue_create(target, creation_code) {
|
|
9488
|
+
game_loop.register(EVENT_TYPE.create, () => run_as(target, () => target.on_create()));
|
|
9489
|
+
if (creation_code)
|
|
9490
|
+
game_loop.register(EVENT_TYPE.create, () => run_as(target, creation_code));
|
|
9491
|
+
}
|
|
9492
|
+
__name(instance_queue_create, "instance_queue_create");
|
|
9451
9493
|
function collision_point(x, y, obj) {
|
|
9452
9494
|
const rm = game_loop.room;
|
|
9453
9495
|
if (!rm)
|
|
9454
9496
|
return void 0;
|
|
9455
|
-
for (const
|
|
9456
|
-
if (object_match(
|
|
9457
|
-
return
|
|
9497
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
9498
|
+
if (object_match(inst2, obj) && inst2.active && point_in_instance(x, y, inst2))
|
|
9499
|
+
return inst2;
|
|
9458
9500
|
}
|
|
9459
9501
|
return void 0;
|
|
9460
9502
|
}
|
|
@@ -9467,9 +9509,9 @@ function position_destroy(x, y) {
|
|
|
9467
9509
|
const rm = game_loop.room;
|
|
9468
9510
|
if (!rm)
|
|
9469
9511
|
return;
|
|
9470
|
-
for (const
|
|
9471
|
-
if (
|
|
9472
|
-
|
|
9512
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
9513
|
+
if (inst2.active && point_in_instance(x, y, inst2))
|
|
9514
|
+
inst2.instance_destroy();
|
|
9473
9515
|
}
|
|
9474
9516
|
}
|
|
9475
9517
|
__name(position_destroy, "position_destroy");
|
|
@@ -9477,9 +9519,9 @@ function collision_rectangle(x1, y1, x2, y2, obj) {
|
|
|
9477
9519
|
const rm = game_loop.room;
|
|
9478
9520
|
if (!rm)
|
|
9479
9521
|
return void 0;
|
|
9480
|
-
for (const
|
|
9481
|
-
if (object_match(
|
|
9482
|
-
return
|
|
9522
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
9523
|
+
if (object_match(inst2, obj) && inst2.active && rect_in_instance(x1, y1, x2, y2, inst2))
|
|
9524
|
+
return inst2;
|
|
9483
9525
|
}
|
|
9484
9526
|
return void 0;
|
|
9485
9527
|
}
|
|
@@ -9488,9 +9530,9 @@ function collision_circle(x, y, radius, obj) {
|
|
|
9488
9530
|
const rm = game_loop.room;
|
|
9489
9531
|
if (!rm)
|
|
9490
9532
|
return void 0;
|
|
9491
|
-
for (const
|
|
9492
|
-
if (object_match(
|
|
9493
|
-
return
|
|
9533
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
9534
|
+
if (object_match(inst2, obj) && inst2.active && circle_in_instance(x, y, radius, inst2))
|
|
9535
|
+
return inst2;
|
|
9494
9536
|
}
|
|
9495
9537
|
return void 0;
|
|
9496
9538
|
}
|
|
@@ -9499,9 +9541,9 @@ function collision_line(x1, y1, x2, y2, obj) {
|
|
|
9499
9541
|
const rm = game_loop.room;
|
|
9500
9542
|
if (!rm)
|
|
9501
9543
|
return void 0;
|
|
9502
|
-
for (const
|
|
9503
|
-
if (object_match(
|
|
9504
|
-
return
|
|
9544
|
+
for (const inst2 of rm.instance_get_all()) {
|
|
9545
|
+
if (object_match(inst2, obj) && inst2.active && line_in_instance(x1, y1, x2, y2, inst2))
|
|
9546
|
+
return inst2;
|
|
9505
9547
|
}
|
|
9506
9548
|
return void 0;
|
|
9507
9549
|
}
|
|
@@ -9556,8 +9598,8 @@ function instance_create(x, y, obj) {
|
|
|
9556
9598
|
return instance.instance_create(x, y, obj);
|
|
9557
9599
|
}
|
|
9558
9600
|
__name(instance_create, "instance_create");
|
|
9559
|
-
function instance_destroy(
|
|
9560
|
-
|
|
9601
|
+
function instance_destroy(inst2) {
|
|
9602
|
+
inst2.instance_destroy();
|
|
9561
9603
|
}
|
|
9562
9604
|
__name(instance_destroy, "instance_destroy");
|
|
9563
9605
|
|
|
@@ -10494,14 +10536,27 @@ var renderer = class {
|
|
|
10494
10536
|
* @param g - Clear color green (0–1)
|
|
10495
10537
|
* @param b - Clear color blue (0–1)
|
|
10496
10538
|
*/
|
|
10497
|
-
static begin_frame(r
|
|
10539
|
+
static begin_frame(r, g, b) {
|
|
10498
10540
|
const gl = this.gl;
|
|
10541
|
+
const c = this._clear_color;
|
|
10499
10542
|
gl.viewport(0, 0, this.canvas.width, this.canvas.height);
|
|
10500
|
-
gl.clearColor(r, g, b, 1);
|
|
10543
|
+
gl.clearColor(r ?? c[0], g ?? c[1], b ?? c[2], 1);
|
|
10501
10544
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
10502
10545
|
gl.useProgram(this.program);
|
|
10503
10546
|
this.upload_projection(this.canvas.width, this.canvas.height);
|
|
10504
10547
|
}
|
|
10548
|
+
/**
|
|
10549
|
+
* Sets the window clear color — the color the frame is cleared to each frame, i.e. what shows
|
|
10550
|
+
* around and behind rooms (a room paints its own background on top). Accepts a '#rrggbb' string.
|
|
10551
|
+
* @param hex - Color as '#rrggbb' (or 'rrggbb')
|
|
10552
|
+
*/
|
|
10553
|
+
static set_clear_color(hex) {
|
|
10554
|
+
const m = /^#?([0-9a-fA-F]{6})$/.exec(hex.trim());
|
|
10555
|
+
if (!m)
|
|
10556
|
+
return;
|
|
10557
|
+
const n = parseInt(m[1], 16);
|
|
10558
|
+
this._clear_color = [(n >> 16 & 255) / 255, (n >> 8 & 255) / 255, (n & 255) / 255];
|
|
10559
|
+
}
|
|
10505
10560
|
/**
|
|
10506
10561
|
* Called at the end of each draw frame to flush remaining batched quads.
|
|
10507
10562
|
*/
|
|
@@ -10877,20 +10932,20 @@ var renderer = class {
|
|
|
10877
10932
|
const obj = rm.view_object[i] ?? -1;
|
|
10878
10933
|
if (obj < 0)
|
|
10879
10934
|
return;
|
|
10880
|
-
const
|
|
10881
|
-
if (!
|
|
10935
|
+
const inst2 = rm.instance_get(obj);
|
|
10936
|
+
if (!inst2)
|
|
10882
10937
|
return;
|
|
10883
10938
|
const vw = rm.view_wview[i], vh = rm.view_hview[i];
|
|
10884
10939
|
const hb = rm.view_hborder[i] ?? 0, vb = rm.view_vborder[i] ?? 0;
|
|
10885
10940
|
let vx = rm.view_xview[i] ?? 0, vy = rm.view_yview[i] ?? 0;
|
|
10886
|
-
if (
|
|
10887
|
-
vx =
|
|
10888
|
-
else if (vx + vw -
|
|
10889
|
-
vx =
|
|
10890
|
-
if (
|
|
10891
|
-
vy =
|
|
10892
|
-
else if (vy + vh -
|
|
10893
|
-
vy =
|
|
10941
|
+
if (inst2.x - vx < hb)
|
|
10942
|
+
vx = inst2.x - hb;
|
|
10943
|
+
else if (vx + vw - inst2.x < hb)
|
|
10944
|
+
vx = inst2.x + hb - vw;
|
|
10945
|
+
if (inst2.y - vy < vb)
|
|
10946
|
+
vy = inst2.y - vb;
|
|
10947
|
+
else if (vy + vh - inst2.y < vb)
|
|
10948
|
+
vy = inst2.y + vb - vh;
|
|
10894
10949
|
rm.view_xview[i] = Math.max(0, Math.min(vx, rm.room_width - vw));
|
|
10895
10950
|
rm.view_yview[i] = Math.max(0, Math.min(vy, rm.room_height - vh));
|
|
10896
10951
|
}
|
|
@@ -11269,6 +11324,7 @@ renderer.current_font = new font_resource("Arial", 16);
|
|
|
11269
11324
|
renderer.halign = 0;
|
|
11270
11325
|
renderer.valign = 0;
|
|
11271
11326
|
renderer.active_surface = null;
|
|
11327
|
+
renderer._clear_color = [0, 0, 0];
|
|
11272
11328
|
|
|
11273
11329
|
// packages/engine/dist/drawing/sprite.js
|
|
11274
11330
|
var sprite = class extends resource {
|
|
@@ -11323,12 +11379,14 @@ var sprite = class extends resource {
|
|
|
11323
11379
|
};
|
|
11324
11380
|
var _TILE_CAP = 4096;
|
|
11325
11381
|
function sprite_scale_cells(mode, w, h, ox, oy, xscale, yscale, sl, st, sr, sb) {
|
|
11326
|
-
const
|
|
11327
|
-
const
|
|
11382
|
+
const sgx = xscale < 0 ? -1 : 1, sgy = yscale < 0 ? -1 : 1;
|
|
11383
|
+
const axs = Math.abs(xscale), ays = Math.abs(yscale);
|
|
11384
|
+
const W = w * axs, H = h * ays;
|
|
11385
|
+
const ax0 = -ox * axs, ay0 = -oy * ays;
|
|
11386
|
+
const cells = [];
|
|
11328
11387
|
if (mode === "tile" && w > 0 && h > 0) {
|
|
11329
11388
|
const cols = Math.min(_TILE_CAP, Math.ceil(W / w));
|
|
11330
11389
|
const rows = Math.min(_TILE_CAP, Math.ceil(H / h));
|
|
11331
|
-
const cells = [];
|
|
11332
11390
|
for (let j = 0; j < rows; j++) {
|
|
11333
11391
|
const cy0 = ay0 + j * h;
|
|
11334
11392
|
const ch = Math.min(h, H - j * h);
|
|
@@ -11338,9 +11396,7 @@ function sprite_scale_cells(mode, w, h, ox, oy, xscale, yscale, sl, st, sr, sb)
|
|
|
11338
11396
|
cells.push({ dx0: cx0, dy0: cy0, dx1: cx0 + cw, dy1: cy0 + ch, u0: 0, v0: 0, u1: cw / w, v1: ch / h });
|
|
11339
11397
|
}
|
|
11340
11398
|
}
|
|
11341
|
-
|
|
11342
|
-
}
|
|
11343
|
-
if (mode === "nineslice" && w > 0 && h > 0) {
|
|
11399
|
+
} else if (mode === "nineslice" && w > 0 && h > 0) {
|
|
11344
11400
|
let cl = Math.max(0, sl), cr = Math.max(0, sr);
|
|
11345
11401
|
let ct = Math.max(0, st), cb = Math.max(0, sb);
|
|
11346
11402
|
if (cl + cr > W && cl + cr > 0) {
|
|
@@ -11357,7 +11413,6 @@ function sprite_scale_cells(mode, w, h, ox, oy, xscale, yscale, sl, st, sr, sb)
|
|
|
11357
11413
|
const uy = [0, st / h, (h - sb) / h, 1];
|
|
11358
11414
|
const dx = [ax0, ax0 + cl, ax0 + W - cr, ax0 + W];
|
|
11359
11415
|
const dy = [ay0, ay0 + ct, ay0 + H - cb, ay0 + H];
|
|
11360
|
-
const cells = [];
|
|
11361
11416
|
for (let r = 0; r < 3; r++) {
|
|
11362
11417
|
for (let c = 0; c < 3; c++) {
|
|
11363
11418
|
if (dx[c + 1] - dx[c] <= 0 || dy[r + 1] - dy[r] <= 0)
|
|
@@ -11374,9 +11429,28 @@ function sprite_scale_cells(mode, w, h, ox, oy, xscale, yscale, sl, st, sr, sb)
|
|
|
11374
11429
|
});
|
|
11375
11430
|
}
|
|
11376
11431
|
}
|
|
11377
|
-
|
|
11432
|
+
} else {
|
|
11433
|
+
cells.push({ dx0: ax0, dy0: ay0, dx1: ax0 + W, dy1: ay0 + H, u0: 0, v0: 0, u1: 1, v1: 1 });
|
|
11434
|
+
}
|
|
11435
|
+
if (sgx < 0 || sgy < 0) {
|
|
11436
|
+
for (const c of cells) {
|
|
11437
|
+
if (sgx < 0) {
|
|
11438
|
+
const a = c.dx0, b = c.dx1, u0 = c.u0, u1 = c.u1;
|
|
11439
|
+
c.dx0 = -b;
|
|
11440
|
+
c.dx1 = -a;
|
|
11441
|
+
c.u0 = u1;
|
|
11442
|
+
c.u1 = u0;
|
|
11443
|
+
}
|
|
11444
|
+
if (sgy < 0) {
|
|
11445
|
+
const a = c.dy0, b = c.dy1, v0 = c.v0, v1 = c.v1;
|
|
11446
|
+
c.dy0 = -b;
|
|
11447
|
+
c.dy1 = -a;
|
|
11448
|
+
c.v0 = v1;
|
|
11449
|
+
c.v1 = v0;
|
|
11450
|
+
}
|
|
11451
|
+
}
|
|
11378
11452
|
}
|
|
11379
|
-
return
|
|
11453
|
+
return cells;
|
|
11380
11454
|
}
|
|
11381
11455
|
__name(sprite_scale_cells, "sprite_scale_cells");
|
|
11382
11456
|
function sprite_get_width(spr) {
|
|
@@ -13608,17 +13682,17 @@ var sound_instance = class {
|
|
|
13608
13682
|
};
|
|
13609
13683
|
var _instances = /* @__PURE__ */ new Map();
|
|
13610
13684
|
var _instance_groups = /* @__PURE__ */ new Map();
|
|
13611
|
-
function _register(
|
|
13612
|
-
_instances.set(
|
|
13613
|
-
_instance_groups.set(
|
|
13614
|
-
|
|
13615
|
-
_instances.delete(
|
|
13616
|
-
_instance_groups.delete(
|
|
13685
|
+
function _register(inst2, group_name = "") {
|
|
13686
|
+
_instances.set(inst2.instance_id, inst2);
|
|
13687
|
+
_instance_groups.set(inst2.instance_id, group_name);
|
|
13688
|
+
inst2.on_ended(() => {
|
|
13689
|
+
_instances.delete(inst2.instance_id);
|
|
13690
|
+
_instance_groups.delete(inst2.instance_id);
|
|
13617
13691
|
});
|
|
13618
13692
|
}
|
|
13619
13693
|
__name(_register, "_register");
|
|
13620
|
-
function register_instance(
|
|
13621
|
-
_register(
|
|
13694
|
+
function register_instance(inst2, group_name = "") {
|
|
13695
|
+
_register(inst2, group_name);
|
|
13622
13696
|
}
|
|
13623
13697
|
__name(register_instance, "register_instance");
|
|
13624
13698
|
function play_sound(asset, loop = asset.loop, gain = 1, pitch = 1) {
|
|
@@ -13635,9 +13709,9 @@ function play_sound(asset, loop = asset.loop, gain = 1, pitch = 1) {
|
|
|
13635
13709
|
source.connect(gain_node);
|
|
13636
13710
|
gain_node.connect(group.gain_node);
|
|
13637
13711
|
source.start();
|
|
13638
|
-
const
|
|
13639
|
-
_register(
|
|
13640
|
-
return
|
|
13712
|
+
const inst2 = new sound_instance(source, gain_node);
|
|
13713
|
+
_register(inst2, asset.group_name);
|
|
13714
|
+
return inst2;
|
|
13641
13715
|
}
|
|
13642
13716
|
__name(play_sound, "play_sound");
|
|
13643
13717
|
function audio_play_sound(asset, priority = 0, loop = false) {
|
|
@@ -13657,27 +13731,27 @@ function sound_get_name(name) {
|
|
|
13657
13731
|
return _sound_names.get(name);
|
|
13658
13732
|
}
|
|
13659
13733
|
__name(sound_get_name, "sound_get_name");
|
|
13660
|
-
function audio_stop_sound(
|
|
13661
|
-
|
|
13734
|
+
function audio_stop_sound(inst2) {
|
|
13735
|
+
inst2.stop();
|
|
13662
13736
|
}
|
|
13663
13737
|
__name(audio_stop_sound, "audio_stop_sound");
|
|
13664
13738
|
function audio_stop_all() {
|
|
13665
|
-
for (const
|
|
13666
|
-
|
|
13739
|
+
for (const inst2 of _instances.values())
|
|
13740
|
+
inst2.stop();
|
|
13667
13741
|
_instances.clear();
|
|
13668
13742
|
_instance_groups.clear();
|
|
13669
13743
|
}
|
|
13670
13744
|
__name(audio_stop_all, "audio_stop_all");
|
|
13671
|
-
function audio_is_playing(
|
|
13672
|
-
return
|
|
13745
|
+
function audio_is_playing(inst2) {
|
|
13746
|
+
return inst2.is_playing;
|
|
13673
13747
|
}
|
|
13674
13748
|
__name(audio_is_playing, "audio_is_playing");
|
|
13675
|
-
function audio_sound_gain(
|
|
13676
|
-
|
|
13749
|
+
function audio_sound_gain(inst2, gain) {
|
|
13750
|
+
inst2.set_gain(gain);
|
|
13677
13751
|
}
|
|
13678
13752
|
__name(audio_sound_gain, "audio_sound_gain");
|
|
13679
|
-
function audio_sound_pitch(
|
|
13680
|
-
|
|
13753
|
+
function audio_sound_pitch(inst2, pitch) {
|
|
13754
|
+
inst2.set_pitch(pitch);
|
|
13681
13755
|
}
|
|
13682
13756
|
__name(audio_sound_pitch, "audio_sound_pitch");
|
|
13683
13757
|
function audio_set_master_gain(gain) {
|
|
@@ -13696,8 +13770,8 @@ var spatial_sound_instance = class {
|
|
|
13696
13770
|
static {
|
|
13697
13771
|
__name(this, "spatial_sound_instance");
|
|
13698
13772
|
}
|
|
13699
|
-
constructor(panner,
|
|
13700
|
-
this.instance =
|
|
13773
|
+
constructor(panner, inst2) {
|
|
13774
|
+
this.instance = inst2;
|
|
13701
13775
|
this._panner = panner;
|
|
13702
13776
|
}
|
|
13703
13777
|
/**
|
|
@@ -13755,14 +13829,14 @@ function audio_play_sound_at(asset, x, y, ref_distance = 100, max_distance = 1e3
|
|
|
13755
13829
|
panner.connect(gain_node);
|
|
13756
13830
|
gain_node.connect(group.gain_node);
|
|
13757
13831
|
source.start();
|
|
13758
|
-
const
|
|
13759
|
-
register_instance(
|
|
13760
|
-
const spatial_inst = new spatial_sound_instance(panner,
|
|
13832
|
+
const inst2 = new sound_instance(source, gain_node);
|
|
13833
|
+
register_instance(inst2, asset.group_name);
|
|
13834
|
+
const spatial_inst = new spatial_sound_instance(panner, inst2);
|
|
13761
13835
|
return spatial_inst;
|
|
13762
13836
|
}
|
|
13763
13837
|
__name(audio_play_sound_at, "audio_play_sound_at");
|
|
13764
|
-
function audio_set_sound_position(
|
|
13765
|
-
|
|
13838
|
+
function audio_set_sound_position(inst2, x, y) {
|
|
13839
|
+
inst2.set_position(x, y);
|
|
13766
13840
|
}
|
|
13767
13841
|
__name(audio_set_sound_position, "audio_set_sound_position");
|
|
13768
13842
|
function audio_get_listener_x() {
|
|
@@ -16244,20 +16318,20 @@ for (const [key, getter, setter] of [
|
|
|
16244
16318
|
]) {
|
|
16245
16319
|
Object.defineProperty(global2, key, { get: getter, set: setter, enumerable: false, configurable: true });
|
|
16246
16320
|
}
|
|
16247
|
-
function variable_instance_get(
|
|
16248
|
-
return
|
|
16321
|
+
function variable_instance_get(inst2, name) {
|
|
16322
|
+
return inst2[name];
|
|
16249
16323
|
}
|
|
16250
16324
|
__name(variable_instance_get, "variable_instance_get");
|
|
16251
|
-
function variable_instance_set(
|
|
16252
|
-
|
|
16325
|
+
function variable_instance_set(inst2, name, value) {
|
|
16326
|
+
inst2[name] = value;
|
|
16253
16327
|
}
|
|
16254
16328
|
__name(variable_instance_set, "variable_instance_set");
|
|
16255
|
-
function variable_instance_exists(
|
|
16256
|
-
return name in
|
|
16329
|
+
function variable_instance_exists(inst2, name) {
|
|
16330
|
+
return name in inst2;
|
|
16257
16331
|
}
|
|
16258
16332
|
__name(variable_instance_exists, "variable_instance_exists");
|
|
16259
|
-
function variable_instance_get_names(
|
|
16260
|
-
return Object.keys(
|
|
16333
|
+
function variable_instance_get_names(inst2) {
|
|
16334
|
+
return Object.keys(inst2);
|
|
16261
16335
|
}
|
|
16262
16336
|
__name(variable_instance_get_names, "variable_instance_get_names");
|
|
16263
16337
|
function variable_global_get(name) {
|
|
@@ -16941,6 +17015,7 @@ export {
|
|
|
16941
17015
|
ini_section_exists,
|
|
16942
17016
|
ini_write_real,
|
|
16943
17017
|
ini_write_string,
|
|
17018
|
+
inst,
|
|
16944
17019
|
instance,
|
|
16945
17020
|
instance_create,
|
|
16946
17021
|
instance_destroy,
|
|
@@ -16949,6 +17024,7 @@ export {
|
|
|
16949
17024
|
instance_furthest,
|
|
16950
17025
|
instance_nearest,
|
|
16951
17026
|
instance_number,
|
|
17027
|
+
instance_queue_create,
|
|
16952
17028
|
instances_collide,
|
|
16953
17029
|
io_clear,
|
|
16954
17030
|
irandom,
|
|
@@ -17314,6 +17390,7 @@ export {
|
|
|
17314
17390
|
surface_get_width,
|
|
17315
17391
|
surface_reset_target,
|
|
17316
17392
|
surface_set_target,
|
|
17393
|
+
sw,
|
|
17317
17394
|
texture_manager,
|
|
17318
17395
|
tile_add,
|
|
17319
17396
|
tile_delete,
|