Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions MapChooserSharp/Modules/MapCycle/McsMapCycleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ private void OnMapStart(string mapName)
CurrentMap = NextMap;
NextMap = null;

Server.NextFrame(ExecuteMapLimitConfig);

// Wait for first people joined
// TODO() Maybe we can use Server.NextWorldUpdate() to execute things?
Expand Down Expand Up @@ -468,6 +469,42 @@ private Func<bool> GetCorrespondTimelimitCheck()
throw new InvalidOperationException($"This extend type {_timeLeftUtil.ExtendType} is not supported");
}
}

// Timelimit, Round time limit, Round Limit
private void ExecuteMapLimitConfig()
{
if (CurrentMap == null)
{
Logger.LogError("Failed to find current map config, we cannot execute map time/round limit config.");
return;
}

var cvarName = _timeLeftUtil.ExtendType switch
{
McsMapExtendType.TimeLimit => "mp_timelimit",
McsMapExtendType.RoundTime => "mp_roundtime",
McsMapExtendType.Rounds => "mp_maxrounds",
_ => throw new InvalidOperationException($"This extend type {_timeLeftUtil.ExtendType} is not supported")
};

var cvar = ConVar.Find(cvarName);
if (cvar == null)
{
Logger.LogError($"Failed to find ConVar: {cvarName}");
return;
}

switch (_timeLeftUtil.ExtendType)
{
case McsMapExtendType.TimeLimit:
case McsMapExtendType.RoundTime:
cvar.SetValue((float)CurrentMap.MapTime);
break;
case McsMapExtendType.Rounds:
cvar.SetValue(CurrentMap.MapRounds);
break;
}
}

// tuna: I know same method exists in vote controller, but I don't have mutch time to refactor so I simply copy paste it.
// TODO() Needs refactor
Expand Down
4 changes: 0 additions & 4 deletions docs/en/configuration/MAP_CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,6 @@ For time-based maps, specifies how many minutes to extend each time an extension

### MapTime

Currently not in use.

For time-based maps, specifies the duration of the map.

### ExtendRoundsPerExtends
Expand All @@ -324,8 +322,6 @@ For round-based maps, specifies how many rounds to extend each time an extension

### MapRounds

Currently not in use.

For round-based maps, specifies the number of rounds for the map.

## Nomination Settings
Expand Down
4 changes: 0 additions & 4 deletions docs/ja/configuration/MAP_CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ cost = 100

### MapTime

現在は使用していません。

マップが時間ベースの場合に、マップの時間を指定します。

### ExtendRoundsPerExtends
Expand All @@ -323,8 +321,6 @@ cost = 100

### MapRounds

現在は使用していません。

マップがラウンドベースの場合に、マップのラウンド数を指定します。

## ノミネート関連
Expand Down
Loading