teeworlds_network 0.0.3 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/game_client.rb +4 -0
- data/lib/teeworlds_client.rb +17 -11
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e05ee8e23b3dc0fc5d0d3127cbdeec642f5c190bfc2884c8deb8215d59df9940
|
4
|
+
data.tar.gz: e65baec89be5759245aecc3de871ecec301a2118d0e4b3fc81f9acfa1598fad7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37b19d41df9ab97d97f2c59a097647eb03ce0cb5c016d88cdfea7e16923e9ecec20aae196f803f440610db3e599283898f1aa42b1d76829da457eaf8708bc6c4
|
7
|
+
data.tar.gz: e01dda2a1988295908bd18b5e9965089286627f37daaa72001f1bdf7f5ebb11b6d3173528493f582655be823f37f7deb879b7a0e0a5f51b4a332970eae4fdd43
|
data/lib/game_client.rb
CHANGED
data/lib/teeworlds_client.rb
CHANGED
@@ -40,6 +40,7 @@ class TeeworldsClient
|
|
40
40
|
auth_off: [],
|
41
41
|
rcon_cmd_add: [],
|
42
42
|
rcon_cmd_rem: [],
|
43
|
+
tick: [],
|
43
44
|
maplist_entry_add: [],
|
44
45
|
maplist_entry_rem: []
|
45
46
|
}
|
@@ -76,6 +77,10 @@ class TeeworldsClient
|
|
76
77
|
@rcon_authed
|
77
78
|
end
|
78
79
|
|
80
|
+
def on_tick(&block)
|
81
|
+
@hooks[:tick].push(block)
|
82
|
+
end
|
83
|
+
|
79
84
|
def on_auth_on(&block)
|
80
85
|
@hooks[:auth_on].push(block)
|
81
86
|
end
|
@@ -310,18 +315,18 @@ class TeeworldsClient
|
|
310
315
|
)
|
311
316
|
end
|
312
317
|
|
313
|
-
def send_input
|
318
|
+
def send_input(input = {})
|
314
319
|
inp = {
|
315
|
-
direction: -1,
|
316
|
-
target_x: 10,
|
317
|
-
target_y: 10,
|
318
|
-
jump: rand(0..1),
|
319
|
-
fire: 0,
|
320
|
-
hook: 0,
|
321
|
-
player_flags: 0,
|
322
|
-
wanted_weapon: 0,
|
323
|
-
next_weapon: 0,
|
324
|
-
prev_weapon: 0
|
320
|
+
direction: input[:direction] || -1,
|
321
|
+
target_x: input[:target_x] || 10,
|
322
|
+
target_y: input[:target_y] || 10,
|
323
|
+
jump: input[:jump] || rand(0..1),
|
324
|
+
fire: input[:fire] || 0,
|
325
|
+
hook: input[:hook] || 0,
|
326
|
+
player_flags: input[:player_flags] || 0,
|
327
|
+
wanted_weapon: input[:wanted_weapon] || 0,
|
328
|
+
next_weapon: input[:next_weapon] || 0,
|
329
|
+
prev_weapon: input[:prev_weapon] || 0
|
325
330
|
}
|
326
331
|
|
327
332
|
data = []
|
@@ -466,6 +471,7 @@ class TeeworldsClient
|
|
466
471
|
puts 'retrying connection ...'
|
467
472
|
end
|
468
473
|
end
|
474
|
+
@game_client.on_tick
|
469
475
|
return unless pck
|
470
476
|
|
471
477
|
data = pck.first
|
data/lib/version.rb
CHANGED