Skip to content

Commit

Permalink
Add Time config option
Browse files Browse the repository at this point in the history
  • Loading branch information
ellieisjelly committed Jan 22, 2024
1 parent 218acbd commit fed387c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
import xyz.nucleoid.fantasy.Fantasy;
import xyz.nucleoid.plasmid.game.common.config.PlayerConfig;

public record SabotageConfig(Identifier map, Identifier dimension, int countdownTime, int gracePeriod, int timeLimit, int endDelay, int chestCount, InnocentConfig innocentConfig, DetectiveConfig detectiveConfig, SaboteurConfig saboteurConfig, PlayerConfig playerConfig) {
public record SabotageConfig(Identifier map, int time, Identifier dimension, int countdownTime, int gracePeriod, int timeLimit, int endDelay, int chestCount, InnocentConfig innocentConfig, DetectiveConfig detectiveConfig, SaboteurConfig saboteurConfig, PlayerConfig playerConfig) {
public static final Codec<SabotageConfig> CODEC = RecordCodecBuilder.create(instance ->
instance.group(
Identifier.CODEC.fieldOf("map").forGetter(SabotageConfig::map),
Codec.INT.optionalFieldOf("time", 6000).forGetter(SabotageConfig::time),
Identifier.CODEC.optionalFieldOf("dimension", Fantasy.DEFAULT_DIM_TYPE.getValue()).forGetter(SabotageConfig::dimension),
Codec.INT.optionalFieldOf("countdown_time", 5).forGetter(SabotageConfig::countdownTime),
Codec.INT.optionalFieldOf("grace_period", 15).forGetter(SabotageConfig::gracePeriod),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public static GameOpenProcedure Open(GameOpenContext<SabotageConfig> context) {
RuntimeWorldConfig worldConfig = new RuntimeWorldConfig()
.setGenerator(map.asChunkGenerator(server))
.setDimensionType(RegistryKey.of(RegistryKeys.DIMENSION_TYPE, config.dimension()))
.setTimeOfDay(6000);

.setTimeOfDay(config.time());
return context.openWithWorld(worldConfig, (activity, world) -> {
SabotageWaiting game = new SabotageWaiting(config, activity.getGameSpace(), map, world);
GameWaitingLobby.addTo(activity, config.playerConfig());
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/data/sabotage/games/skybound.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "sabotage:sabotage",
"map": "sabotage:skybound",
"time": 15000,
"chest_count": 75,
"players": {
"min": 1,
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/data/sabotage/games/village.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"type": "sabotage:sabotage",
"map": "sabotage:village",
"time": 0,
"chest_count": 125,
"players": {
"min": 1,
Expand Down
Binary file modified src/main/resources/data/sabotage/map_templates/skybound.nbt
Binary file not shown.

0 comments on commit fed387c

Please sign in to comment.