Commit 4e44d2c7 authored by nanahira's avatar nanahira

replay_mode flag

parent 829ee179
......@@ -1304,12 +1304,14 @@ class Room
@recover_buffers = [[], [], [], []]
@welcome = "${recover_hint}"
@hostinfo.replay_mode = 0 # 0x1: Save the replays in file. 0x2: Block the replays to observers.
@hostinfo.replay_mode = 0
if settings.modules.tournament_mode.enabled
if settings.modules.tournament_mode.enabled # 0x1: Save the replays in file
@hostinfo.replay_mode |= 0x1
if (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.block_replay_to_player) or (@hostinfo.mode == 1 and settings.modules.replay_delay)
if (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.block_replay_to_player) or (@hostinfo.mode == 1 and settings.modules.replay_delay) # 0x2: Block the replays to observers
@hostinfo.replay_mode |= 0x2
if settings.modules.tournament_mode.enabled or room.arena # 0x4: Save chat in cloud replay
@hostinfo.replay_mode |= 0x4
if !@recovered
@spawn()
......@@ -1756,6 +1758,11 @@ class Room
else
@last_active_time = moment_now_string
addRecorderBuffer: (buffer) ->
if settings.modules.cloud_replay.enabled
@recorder_buffers.push buffer
return
# 网络连接
netRequestHandler = (client) ->
client.ip = client.remoteAddress
......@@ -2392,8 +2399,8 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
recorder.on 'data', (data)->
room=ROOM_all[client.rid]
return unless room and settings.modules.cloud_replay.enabled
room.recorder_buffers.push data
return unless room
room.addRecorderBuffer(data)
return
recorder.on 'error', (error)->
......
......@@ -1703,13 +1703,16 @@
this.welcome = "${recover_hint}";
}
}
this.hostinfo.replay_mode = 0; // 0x1: Save the replays in file. 0x2: Block the replays to observers.
if (settings.modules.tournament_mode.enabled) {
this.hostinfo.replay_mode = 0;
if (settings.modules.tournament_mode.enabled) { // 0x1: Save the replays in file
this.hostinfo.replay_mode |= 0x1;
}
if ((settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.block_replay_to_player) || (this.hostinfo.mode === 1 && settings.modules.replay_delay)) {
if ((settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.block_replay_to_player) || (this.hostinfo.mode === 1 && settings.modules.replay_delay)) { // 0x2: Block the replays to observers
this.hostinfo.replay_mode |= 0x2;
}
if (settings.modules.tournament_mode.enabled || room.arena) { // 0x4: Save chat in cloud replay
this.hostinfo.replay_mode |= 0x4;
}
if (!this.recovered) {
this.spawn();
}
......@@ -2379,6 +2382,12 @@
}
}
addRecorderBuffer(buffer) {
if (settings.modules.cloud_replay.enabled) {
this.recorder_buffers.push(buffer);
}
}
};
// 网络连接
......@@ -3148,10 +3157,10 @@
});
recorder.on('data', function(data) {
room = ROOM_all[client.rid];
if (!(room && settings.modules.cloud_replay.enabled)) {
if (!room) {
return;
}
room.recorder_buffers.push(data);
room.addRecorderBuffer(data);
});
recorder.on('error', function(error) {});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment