Skip to content

Commit 1870fa1

Browse files
author
Julien
committed
fix(sdk): remove now useless serialization of worldcommits
1 parent 3def7fa commit 1870fa1

File tree

4 files changed

+3
-31
lines changed

4 files changed

+3
-31
lines changed

engine/modules/entities/src/main/java/com/codingame/gameengine/module/entities/GraphicEntityModule.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,12 @@ private void sendFrameData() {
200200
currentWorldState.updateAllEntities(nextWorldState);
201201
}
202202

203-
Optional<String> worldCommits = gameSerializer.serializeWorldCommits(worldCommitsBuilder);
204-
205203
Optional<String> update = gameSerializer.serializeWorldDiff(updateBuilder);
206204

207205
worldStates.clear();
208206
gameManager.setViewData(
209207
"entitymodule",
210-
Stream.of(load, create, update, worldCommits)
208+
Stream.of(load, create, update)
211209
.filter(Optional::isPresent)
212210
.map(Optional::get)
213211
.collect(Collectors.joining("\n"))

engine/modules/entities/src/main/java/com/codingame/gameengine/module/entities/Serializer.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class Serializer {
7171
commands.put("CREATE", "C");
7272
commands.put("UPDATE", "U");
7373
commands.put("LOADSPRITESHEET", "L");
74-
commands.put("WORLDUPDATE", "W");
7574

7675
separators = new HashMap<>();
7776
separators.put("COMMAND", ";");
@@ -229,18 +228,6 @@ public Optional<String> serializeLoadSpriteSheets(List<SpriteSheetSplitter> spri
229228
}
230229
}
231230

232-
public Optional<String> serializeWorldCommits(List<String> worldCommits) {
233-
if (worldCommits.isEmpty()) {
234-
return Optional.empty();
235-
} else {
236-
return Optional.of(
237-
commands.get("WORLDUPDATE") +
238-
worldCommits.stream()
239-
.collect(Collectors.joining(separators.get("COMMAND_ARGUMENT")))
240-
);
241-
}
242-
}
243-
244231
public Optional<String> serializeWorldDiff(List<WorldState> diffs) {
245232
if (diffs.isEmpty()) {
246233
return Optional.empty();

engine/modules/entities/src/main/resources/view/entity-module/Command.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,4 @@ export class PropertiesCommand {
154154
entity.addState(this.t, { values: this.params, curve: this.curve }, frameInfo.number, frameInfo)
155155
entity.stateAdded = true
156156
}
157-
export class WorldCommitCommand {
158-
constructor (args, globalData) {
159-
this.times = args.map(v => +v)
160-
}
161-
162-
apply (entities, frameInfo) {
163-
entities.forEach(entity => {
164-
this.times.forEach(time => {
165-
entity.addState(time, { values: {}, curve: {} }, frameInfo.number, frameInfo)
166-
})
167-
})
168-
}
169157
}

engine/modules/entities/src/main/resources/view/entity-module/CommandParser.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { CreateCommand, PropertiesCommand, LoadCommand, WorldCommitCommand } from './Command.js'
1+
import { CreateCommand, PropertiesCommand, LoadCommand } from './Command.js'
22

33
const COMMAND_KEY_MAP = {
44
C: CreateCommand,
55
U: PropertiesCommand,
6-
L: LoadCommand,
7-
W: WorldCommitCommand
6+
L: LoadCommand
87
}
98

109
function splitOnCharOutsideQuotes (text, charParam) {

0 commit comments

Comments
 (0)