@gamely/gly-engine-lite 0.2.6 → 0.3.0

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.
Files changed (2) hide show
  1. package/dist/main.lua +157 -158
  2. package/package.json +1 -1
package/dist/main.lua CHANGED
@@ -1,58 +1,37 @@
1
+ local b2560 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
2
+ local r2560 = function(i, f)
3
+ return function()
4
+ local c = f()
5
+ b2560[i] = function() return c end
6
+ return c
7
+ end
8
+ end
1
9
  local math = ((function() local x, y = pcall(require, 'math'); return x and y end)()) or _G.math
2
- local source_version_2454 = nil
3
- local source_shared_engine_loadcore_245f = nil
4
- local source_shared_engine_loadgame_246a = nil
5
- local source_engine_api_data_encoder_247c = nil
6
- local source_engine_api_system_app_2487 = nil
7
- local source_engine_api_data_hash_2492 = nil
8
- local source_engine_api_io_http_249d = nil
9
- local source_engine_api_data_i18n_24a8 = nil
10
- local source_engine_api_system_key_24b3 = nil
11
- local source_engine_api_debug_log_24be = nil
12
- local source_engine_api_math_basic_24c9 = nil
13
- local source_engine_api_math_clib_24d4 = nil
14
- local source_engine_api_math_random_24df = nil
15
- local source_engine_api_data_array_24ea = nil
16
- local source_engine_api_io_media_24f5 = nil
17
- local source_engine_api_draw_fps_2500 = nil
18
- local source_engine_api_draw_text_250b = nil
19
- local source_engine_api_draw_poly_2516 = nil
20
- local source_engine_api_raw_memory_2521 = nil
21
- local source_engine_protocol_http_callback_2533 = nil
22
- local source_shared_var_object_root_2545 = nil
23
- local source_engine_api_system_color_2550 = nil
24
- local source_shared_var_object_std_255b = nil
25
- local source_shared_functional_pipeline_2a0d = nil
26
- local source_shared_string_dsl_requires_2a18 = nil
27
- local source_shared_string_eval_file_2c81 = nil
28
- local source_shared_string_eval_code_2c8c = nil
29
- local source_shared_functional_decorator_2f31 = nil
30
- local source_shared_string_encode_http_5d3b = nil
31
- local source_shared_string_encode_url_5d46 = nil
32
- local function main_244b()
33
- local version = source_version_2454()
34
- local loadcore = source_shared_engine_loadcore_245f()
35
- local loadgame = source_shared_engine_loadgame_246a()
36
- local engine_encoder = source_engine_api_data_encoder_247c()
37
- local engine_game = source_engine_api_system_app_2487()
38
- local engine_hash = source_engine_api_data_hash_2492()
39
- local engine_http = source_engine_api_io_http_249d()
40
- local engine_i18n = source_engine_api_data_i18n_24a8()
41
- local engine_key = source_engine_api_system_key_24b3()
42
- local engine_log = source_engine_api_debug_log_24be()
43
- local engine_math = source_engine_api_math_basic_24c9()
44
- local engine_math_clib = source_engine_api_math_clib_24d4()
45
- local engine_math_random = source_engine_api_math_random_24df()
46
- local engine_array = source_engine_api_data_array_24ea()
47
- local engine_media = source_engine_api_io_media_24f5()
48
- local engine_api_draw_fps = source_engine_api_draw_fps_2500()
49
- local engine_api_draw_text = source_engine_api_draw_text_250b()
50
- local engine_api_draw_poly = source_engine_api_draw_poly_2516()
51
- local engine_raw_memory = source_engine_api_raw_memory_2521()
52
- local callback_http = source_engine_protocol_http_callback_2533()
53
- local application_default = source_shared_var_object_root_2545()
54
- local color = source_engine_api_system_color_2550()
55
- local std = source_shared_var_object_std_255b()
10
+ local function m2560()
11
+ local version = b2560[1]('source_version')
12
+ local loadcore = b2560[2]('source_shared_engine_loadcore')
13
+ local loadgame = b2560[3]('source_shared_engine_loadgame')
14
+ local engine_encoder = b2560[4]('source_engine_api_data_encoder')
15
+ local engine_game = b2560[5]('source_engine_api_system_app')
16
+ local engine_hash = b2560[6]('source_engine_api_data_hash')
17
+ local engine_http = b2560[7]('source_engine_api_io_http')
18
+ local engine_i18n = b2560[8]('source_engine_api_data_i18n')
19
+ local engine_key = b2560[9]('source_engine_api_system_key')
20
+ local engine_env = b2560[10]('source_engine_api_system_getenv')
21
+ local engine_log = b2560[11]('source_engine_api_debug_log')
22
+ local engine_math = b2560[12]('source_engine_api_math_basic')
23
+ local engine_math_clib = b2560[13]('source_engine_api_math_clib')
24
+ local engine_math_random = b2560[14]('source_engine_api_math_random')
25
+ local engine_array = b2560[15]('source_engine_api_data_array')
26
+ local engine_media = b2560[16]('source_engine_api_io_media')
27
+ local engine_api_draw_fps = b2560[17]('source_engine_api_draw_fps')
28
+ local engine_api_draw_text = b2560[18]('source_engine_api_draw_text')
29
+ local engine_api_draw_poly = b2560[19]('source_engine_api_draw_poly')
30
+ local engine_raw_memory = b2560[20]('source_engine_api_raw_memory')
31
+ local callback_http = b2560[21]('source_engine_protocol_http_callback')
32
+ local application_default = b2560[22]('source_shared_var_object_root')
33
+ local color = b2560[23]('source_engine_api_system_color')
34
+ local std = b2560[24]('source_shared_var_object_std')
56
35
  local application = application_default
57
36
  local engine = {
58
37
  keyboard = function(a, b, c, d) end,
@@ -118,6 +97,9 @@ local cfg_xml = {
118
97
  decode = native_xml_decode,
119
98
  encode = native_xml_encode
120
99
  }
100
+ local cfg_env = {
101
+ get_env = native_system_get_env
102
+ }
121
103
  function native_callback_loop(dt)
122
104
  std.milis = std.milis + dt
123
105
  std.delta = dt
@@ -182,6 +164,7 @@ loadcore.setup(std, application, engine)
182
164
  :package('@draw.poly', engine_api_draw_poly, cfg_poly)
183
165
  :package('@color', color)
184
166
  :package('@log', engine_log, cfg_log)
167
+ :package('@env', engine_env, cfg_env)
185
168
  :package('math', engine_math_clib)
186
169
  :package('math.random', engine_math_random)
187
170
  :package('http', engine_http, cfg_http)
@@ -210,13 +193,12 @@ version=version
210
193
  }
211
194
  return P
212
195
  end
213
- source_version_2454 = function()
214
- return '0.2.6'
215
- end
216
- --
217
- source_shared_engine_loadcore_245f = function()
218
- local zeebo_pipeline = source_shared_functional_pipeline_2a0d()
219
- local requires = source_shared_string_dsl_requires_2a18()
196
+ b2560[1] = r2560(1, function()
197
+ return '0.3.0'
198
+ end)
199
+ b2560[2] = r2560(2, function()
200
+ local zeebo_pipeline = b2560[25]('source_shared_functional_pipeline')
201
+ local requires = b2560[26]('source_shared_string_dsl_requires')
220
202
  local function step_install_libsys(self, lib_name, library, custom, is_system)
221
203
  if not is_system then return end
222
204
  local ok, msg = pcall(function()
@@ -296,11 +278,10 @@ local P = {
296
278
  setup = setup
297
279
  }
298
280
  return P
299
- end
300
- --
301
- source_shared_engine_loadgame_246a = function()
302
- local eval_file = source_shared_string_eval_file_2c81()
303
- local eval_code = source_shared_string_eval_code_2c8c()
281
+ end)
282
+ b2560[3] = r2560(3, function()
283
+ local eval_file = b2560[27]('source_shared_string_eval_file')
284
+ local eval_code = b2560[28]('source_shared_string_eval_code')
304
285
  local has_io_open = io and io.open
305
286
  local function normalize(app, base)
306
287
  if not app then return nil end
@@ -371,9 +352,8 @@ local P = {
371
352
  script = script
372
353
  }
373
354
  return P
374
- end
375
- --
376
- source_engine_api_data_encoder_247c = function()
355
+ end)
356
+ b2560[4] = r2560(4, function()
377
357
  local function install(std, engine, library, name)
378
358
  std = std or {}
379
359
  std[name] = {
@@ -386,10 +366,9 @@ local P = {
386
366
  install=install
387
367
  }
388
368
  return P
389
- end
390
- --
391
- source_engine_api_system_app_2487 = function()
392
- local util_decorator = source_shared_functional_decorator_2f31()
369
+ end)
370
+ b2560[5] = r2560(5, function()
371
+ local util_decorator = b2560[29]('source_shared_functional_decorator')
393
372
  local function reset(std, engine)
394
373
  if std.node then
395
374
  std.bus.emit('exit')
@@ -427,9 +406,8 @@ local P = {
427
406
  install=install
428
407
  }
429
408
  return P
430
- end
431
- --
432
- source_engine_api_data_hash_2492 = function()
409
+ end)
410
+ b2560[6] = r2560(6, function()
433
411
  local function djb2(digest)
434
412
  local index = 1
435
413
  local hash = 5381
@@ -451,10 +429,9 @@ local P = {
451
429
  install = install
452
430
  }
453
431
  return P
454
- end
455
- --
456
- source_engine_api_io_http_249d = function()
457
- local zeebo_pipeline = source_shared_functional_pipeline_2a0d()
432
+ end)
433
+ b2560[7] = r2560(7, function()
434
+ local zeebo_pipeline = b2560[25]('source_shared_functional_pipeline')
458
435
  local function json(self)
459
436
  self.options['json'] = true
460
437
  return self
@@ -610,9 +587,8 @@ local P = {
610
587
  install=install
611
588
  }
612
589
  return P
613
- end
614
- --
615
- source_engine_api_data_i18n_24a8 = function()
590
+ end)
591
+ b2560[8] = r2560(8, function()
616
592
  local language = 'en-US'
617
593
  local language_default = 'en-US'
618
594
  local language_list = {}
@@ -702,9 +678,8 @@ local P = {
702
678
  install=install
703
679
  }
704
680
  return P
705
- end
706
- --
707
- source_engine_api_system_key_24b3 = function()
681
+ end)
682
+ b2560[9] = r2560(9, function()
708
683
  local function real_key(std, engine, rkey, rvalue)
709
684
  local value = rvalue == 1 or rvalue == true
710
685
  local key = engine.key_bindings[rkey] or (std.key.axis[rkey] and rkey)
@@ -739,10 +714,52 @@ local P = {
739
714
  install = install
740
715
  }
741
716
  return P
717
+ end)
718
+ b2560[10] = r2560(10, function()
719
+ local function setenv(engine)
720
+ return function(varname, value)
721
+ if engine.root ~= engine.current then
722
+ error('unauthorized set environment', 0)
742
723
  end
743
- --
744
- source_engine_api_debug_log_24be = function()
745
- local util_decorator = source_shared_functional_decorator_2f31()
724
+ if varname then
725
+ engine.overrides_envs[varname] = tostring(value)
726
+ end
727
+ end
728
+ end
729
+ local function getenv(engine, get_env)
730
+ return function(varname)
731
+ local game_envs = engine.root and engine.root.envs
732
+ local core_envs = engine.envs
733
+ if not (varname or #varname > 0) then
734
+ return nil
735
+ end
736
+ if engine.overrides_envs[varname] then
737
+ return engine.overrides_envs[varname]
738
+ end
739
+ if game_envs and game_envs[varname] then
740
+ return game_envs[varname]
741
+ end
742
+ if core_envs and core_envs[varname] then
743
+ return core_envs[varname]
744
+ end
745
+ if get_env then
746
+ return get_env(varname)
747
+ end
748
+ return nil
749
+ end
750
+ end
751
+ local function install(std, engine, cfg)
752
+ engine.overrides_envs = {}
753
+ std.getenv = getenv(engine, cfg.get_env)
754
+ std.setenv = setenv(engine)
755
+ end
756
+ local P = {
757
+ install = install
758
+ }
759
+ return P
760
+ end)
761
+ b2560[11] = r2560(11, function()
762
+ local util_decorator = b2560[29]('source_shared_functional_decorator')
746
763
  local logging_types = {
747
764
  'none', 'fatal', 'error', 'warn', 'debug', 'info'
748
765
  }
@@ -786,9 +803,8 @@ local P = {
786
803
  install = install
787
804
  }
788
805
  return P
789
- end
790
- --
791
- source_engine_api_math_basic_24c9 = function()
806
+ end)
807
+ b2560[12] = r2560(12, function()
792
808
  local function abs(value)
793
809
  if value < 0 then
794
810
  return -value
@@ -885,9 +901,8 @@ local P = {
885
901
  install = install
886
902
  }
887
903
  return P
888
- end
889
- --
890
- source_engine_api_math_clib_24d4 = function()
904
+ end)
905
+ b2560[13] = r2560(13, function()
891
906
  local function install(std)
892
907
  assert(math and (1/2 ~= 0))
893
908
  std.math = std.math or {}
@@ -921,9 +936,8 @@ local P = {
921
936
  install = install
922
937
  }
923
938
  return P
924
- end
925
- --
926
- source_engine_api_math_random_24df = function()
939
+ end)
940
+ b2560[14] = r2560(14, function()
927
941
  local function install(std)
928
942
  assert(math and (1/2 ~= 0))
929
943
  std.math = std.math or {}
@@ -938,10 +952,9 @@ local P = {
938
952
  install = install
939
953
  }
940
954
  return P
941
- end
942
- --
943
- source_engine_api_data_array_24ea = function()
944
- local util_decorator = source_shared_functional_decorator_2f31()
955
+ end)
956
+ b2560[15] = r2560(15, function()
957
+ local util_decorator = b2560[29]('source_shared_functional_decorator')
945
958
  local function array_map(array, func)
946
959
  local res = {}
947
960
  local index = 1
@@ -1100,14 +1113,13 @@ local P = {
1100
1113
  install = install
1101
1114
  }
1102
1115
  return P
1103
- end
1104
- --
1105
- source_engine_api_io_media_24f5 = function()
1116
+ end)
1117
+ b2560[16] = r2560(16, function()
1106
1118
  local function media_create(node, channels, handler)
1107
1119
  local decorator = function(func)
1108
1120
  func = func or function() end
1109
- return function(self, a, b, c, d)
1110
- func(0, a, b, c, d)
1121
+ return function(self, a, b, c, d, e, f)
1122
+ func(0, a, b, c, d, e, f)
1111
1123
  return self
1112
1124
  end
1113
1125
  end
@@ -1146,9 +1158,8 @@ local P = {
1146
1158
  install=install
1147
1159
  }
1148
1160
  return P
1149
- end
1150
- --
1151
- source_engine_api_draw_fps_2500 = function()
1161
+ end)
1162
+ b2560[17] = r2560(17, function()
1152
1163
  local function draw_fps(std, engine, show, pos_x, pos_y)
1153
1164
  if show < 1 then return end
1154
1165
  local x = engine.current.config.offset_x + pos_x
@@ -1195,10 +1206,9 @@ local P = {
1195
1206
  install=install
1196
1207
  }
1197
1208
  return P
1198
- end
1199
- --
1200
- source_engine_api_draw_text_250b = function()
1201
- local util_decorator = source_shared_functional_decorator_2f31()
1209
+ end)
1210
+ b2560[18] = r2560(18, function()
1211
+ local util_decorator = b2560[29]('source_shared_functional_decorator')
1202
1212
  local function text_put(std, engine, font_previous, pos_x, pos_y, text, size)
1203
1213
  size = size or 2
1204
1214
  local hem = engine.current.data.width / 80
@@ -1225,9 +1235,8 @@ local P = {
1225
1235
  install=install
1226
1236
  }
1227
1237
  return P
1228
- end
1229
- --
1230
- source_engine_api_draw_poly_2516 = function()
1238
+ end)
1239
+ b2560[19] = r2560(19, function()
1231
1240
  local function decorator_poo(object, func)
1232
1241
  if not object or not func then return func end
1233
1242
  return function(a, b, c, d)
@@ -1332,9 +1341,8 @@ local P = {
1332
1341
  install=install
1333
1342
  }
1334
1343
  return P
1335
- end
1336
- --
1337
- source_engine_api_raw_memory_2521 = function()
1344
+ end)
1345
+ b2560[20] = r2560(20, function()
1338
1346
  local memory_dict_unload = {}
1339
1347
  local memory_dict = {}
1340
1348
  local memory_list = {}
@@ -1387,11 +1395,10 @@ local P = {
1387
1395
  install=install
1388
1396
  }
1389
1397
  return P
1390
- end
1391
- --
1392
- source_engine_protocol_http_callback_2533 = function()
1393
- local str_http = source_shared_string_encode_http_5d3b()
1394
- local str_url = source_shared_string_encode_url_5d46()
1398
+ end)
1399
+ b2560[21] = r2560(21, function()
1400
+ local str_http = b2560[31]('source_shared_string_encode_http')
1401
+ local str_url = b2560[32]('source_shared_string_encode_url')
1395
1402
  local callbacks = {
1396
1403
  ['async-promise'] = function(self)
1397
1404
  return self:promise()
@@ -1442,6 +1449,9 @@ end,
1442
1449
  ['set-body'] = function(self, data)
1443
1450
  self.set('body', data)
1444
1451
  end,
1452
+ ['set-headers'] = function(self, data)
1453
+ self.set('headers', data or {})
1454
+ end,
1445
1455
  ['add-body-data'] = function(self, data, std)
1446
1456
  self.set('body', (std.http.body or '')..data)
1447
1457
  end
@@ -1456,9 +1466,8 @@ local P = {
1456
1466
  func = native_http_callback
1457
1467
  }
1458
1468
  return P
1459
- end
1460
- --
1461
- source_shared_var_object_root_2545 = function()
1469
+ end)
1470
+ b2560[22] = r2560(22, function()
1462
1471
  local P = {
1463
1472
  data={
1464
1473
  width=1280,
@@ -1486,9 +1495,8 @@ callbacks={
1486
1495
  }
1487
1496
  }
1488
1497
  return P;
1489
- end
1490
- --
1491
- source_engine_api_system_color_2550 = function()
1498
+ end)
1499
+ b2560[23] = r2560(23, function()
1492
1500
  local function install(std)
1493
1501
  std.color = std.color or {}
1494
1502
  std.color.white = 0xFFFFFFFF
@@ -1521,9 +1529,8 @@ local P = {
1521
1529
  install = install
1522
1530
  }
1523
1531
  return P
1524
- end
1525
- --
1526
- source_shared_var_object_std_255b = function()
1532
+ end)
1533
+ b2560[24] = r2560(24, function()
1527
1534
  local P = {
1528
1535
  milis = 0,
1529
1536
  delta = 0,
@@ -1589,9 +1596,8 @@ any=false
1589
1596
  }
1590
1597
  }
1591
1598
  return P;
1592
- end
1593
- --
1594
- source_shared_functional_pipeline_2a0d = function()
1599
+ end)
1600
+ b2560[25] = r2560(25, function()
1595
1601
  local function pipe(self)
1596
1602
  return function()
1597
1603
  self:run()
@@ -1639,9 +1645,8 @@ resume=resume,
1639
1645
  run=run
1640
1646
  }
1641
1647
  return P
1642
- end
1643
- --
1644
- source_shared_string_dsl_requires_2a18 = function()
1648
+ end)
1649
+ b2560[26] = r2560(26, function()
1645
1650
  local function encode(dsl_string)
1646
1651
  local spec = {
1647
1652
  list = {},
@@ -1688,9 +1693,8 @@ missing = missing,
1688
1693
  should_import = should_import
1689
1694
  }
1690
1695
  return P
1691
- end
1692
- --
1693
- source_shared_string_eval_file_2c81 = function()
1696
+ end)
1697
+ b2560[27] = r2560(27, function()
1694
1698
  local function script(src)
1695
1699
  local ok, app = false, nil
1696
1700
  if require then
@@ -1714,9 +1718,8 @@ local P = {
1714
1718
  script = script,
1715
1719
  }
1716
1720
  return P
1717
- end
1718
- --
1719
- source_shared_string_eval_code_2c8c = function()
1721
+ end)
1722
+ b2560[28] = r2560(28, function()
1720
1723
  local function script(src)
1721
1724
  local loader = loadstring or load
1722
1725
  if not loader then
@@ -1735,9 +1738,8 @@ local P = {
1735
1738
  script = script,
1736
1739
  }
1737
1740
  return P
1738
- end
1739
- --
1740
- source_shared_functional_decorator_2f31 = function()
1741
+ end)
1742
+ b2560[29] = r2560(29, function()
1741
1743
  local function decorator_prefix3(zig, zag, zom, func)
1742
1744
  return function (a, b, c, d, e, f)
1743
1745
  return func(zig, zag, zom, a, b, c, d, e, f)
@@ -1793,9 +1795,8 @@ prefix1 = decorator_prefix1,
1793
1795
  prefix1_t = table_prefix1
1794
1796
  }
1795
1797
  return P
1796
- end
1797
- --
1798
- source_shared_string_encode_http_5d3b = function()
1798
+ end)
1799
+ b2560[31] = r2560(31, function()
1799
1800
  local function is_ok(status)
1800
1801
  return (status and 200 <= status and status < 300) or false
1801
1802
  end
@@ -1940,9 +1941,8 @@ get_content=get_content,
1940
1941
  get_user_agent=get_user_agent,
1941
1942
  create_request=create_request
1942
1943
  }
1943
- end
1944
- --
1945
- source_shared_string_encode_url_5d46 = function()
1944
+ end)
1945
+ b2560[32] = r2560(32, function()
1946
1946
  local function search_param(param_list, param_dict)
1947
1947
  local index, params = 1, ''
1948
1948
  while param_list and param_dict and index <= #param_list do
@@ -1962,6 +1962,5 @@ local P = {
1962
1962
  search_param = search_param
1963
1963
  }
1964
1964
  return P
1965
- end
1966
- --
1967
- return main_244b()
1965
+ end)
1966
+ return m2560()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamely/gly-engine-lite",
3
- "version": "0.2.6",
3
+ "version": "0.3.0",
4
4
  "author": "RodrigoDornelles",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.gamely.com.br",