Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect server options #52

Merged
merged 2 commits into from
Jan 23, 2024
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
6 changes: 3 additions & 3 deletions src/Document/Editor/FriendlyFireEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function getFriendlyFire(this: WorldEditorHelper): FriendlyFireMode {
return FriendlyFireMode.WithPenalty;
}

if (this.world._options['-noteamkills'] === true) {
if (this.world._options['-noTeamKills'] === true) {
return FriendlyFireMode.Impossible;
}

Expand All @@ -23,15 +23,15 @@ export function setFriendlyFire(
this: WorldEditorHelper,
mode: FriendlyFireMode,
): void {
const ffOpts: OptionsFlag[] = ['-noteamkills', '-tk'];
const ffOpts: OptionsFlag[] = ['-noTeamKills', '-tk'];

for (const ffOpt of ffOpts) {
delete this.world._options[ffOpt];
}

switch (mode) {
case FriendlyFireMode.Impossible:
this.world._options['-noteamkills'] = true;
this.world._options['-noTeamKills'] = true;
break;

case FriendlyFireMode.WithPenalty:
Expand Down
4 changes: 2 additions & 2 deletions src/Document/Editor/__tests__/WorldEditorHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ describe('BZW Editor Helper', () => {
description: 'should result in an "impossible" friendly fire mode',
world: bzw`
options
-noteamkills
-noTeamKills
end
`,
expected: FriendlyFireMode.Impossible,
Expand Down Expand Up @@ -389,7 +389,7 @@ describe('BZW Editor Helper', () => {
end
options
-noteamkills
-noTeamKills
end
`,
},
Expand Down
8 changes: 4 additions & 4 deletions src/Document/Obstacles/Option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function bzwFlag(input: string): FlagCount {
export const OptionsProperties = {
'-a': bzwAccelerations,
'-admsg': bzwRepeatable(bzwString),
'-autoteam': bzwBool,
'-autoTeam': bzwBool,
'-c': bzwBool,
'+f': bzwRepeatable(bzwFlag),
'-f': bzwRepeatable(bzwString),
Expand All @@ -121,7 +121,7 @@ export const OptionsProperties = {
'-mps': bzwInt,
'-ms': bzwInt,
'-mts': bzwInt,
'-noteamkills': bzwBool,
'-noTeamKills': bzwBool,
'-offa': bzwBool,
'+r': bzwBool,
'-rabbit': bzwRabbitMode,
Expand All @@ -140,7 +140,7 @@ export const OptionsProperties = {
export interface IOptions extends IBaseObject {
'-a'?: Accelerations;
'-admsg'?: string[];
'-autoteam'?: boolean;
'-autoTeam'?: boolean;
'-c'?: boolean;
'-fb'?: boolean;
'+f'?: FlagCount[];
Expand All @@ -153,7 +153,7 @@ export interface IOptions extends IBaseObject {
'-mps'?: number;
'-ms'?: number;
'-mts'?: number;
'-noteamkills'?: boolean;
'-noTeamKills'?: boolean;
'-offa'?: boolean;
'+r'?: boolean;
'-rabbit'?: RabbitMode;
Expand Down
8 changes: 4 additions & 4 deletions src/Document/__tests__/parseBZWDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ describe('BZW Document Parser', () => {
-a 12 45
-admsg there is a snake in my boot!
-admsg execute order 66
-autoteam
-autoTeam
-c
+f 23{34}
+f bad{69}
Expand All @@ -501,7 +501,7 @@ describe('BZW Document Parser', () => {
-mps 420
-ms 1011
-mts 777
-noteamkills
-noTeamKills
-offa
+r
-rabbit killer
Expand All @@ -528,7 +528,7 @@ describe('BZW Document Parser', () => {
'there is a snake in my boot!',
'execute order 66',
]);
expect(option['-autoteam']).toEqual(true);
expect(option['-autoTeam']).toEqual(true);
expect(option['-c']).toEqual(true);
expect(option['+f']).toEqual([
{ flag: '23', count: 34 } as FlagCount,
Expand All @@ -552,7 +552,7 @@ describe('BZW Document Parser', () => {
expect(option['-mps']).toEqual(420);
expect(option['-ms']).toEqual(1011);
expect(option['-mts']).toEqual(777);
expect(option['-noteamkills']).toEqual(true);
expect(option['-noTeamKills']).toEqual(true);
expect(option['-offa']).toEqual(true);
expect(option['+r']).toEqual(true);
expect(option['-rabbit']).toEqual('killer' as RabbitMode);
Expand Down
8 changes: 4 additions & 4 deletions src/Document/__tests__/writeBZWDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ describe('BZW Document Writer', () => {
angular: 38,
},
'-admsg': ['Welcome to my wonder map!', ' by blast'],
'-autoteam': true,
'-autoTeam': true,
'-c': true,
'+f': [
{
Expand Down Expand Up @@ -374,7 +374,7 @@ describe('BZW Document Writer', () => {
'-mps': 100,
'-ms': 5,
'-mts': 512,
'-noteamkills': true,
'-noTeamKills': true,
'-offa': true,
'+r': true,
'-rabbit': 'killer',
Expand Down Expand Up @@ -417,7 +417,7 @@ describe('BZW Document Writer', () => {
-a 50 38
-admsg "Welcome to my wonder map!"
-admsg " by blast"
-autoteam
-autoTeam
-c
+f G{10}
+f US{50}
Expand All @@ -433,7 +433,7 @@ describe('BZW Document Writer', () => {
-mps 100
-ms 5
-mts 512
-noteamkills
-noTeamKills
-offa
+r
-rabbit killer
Expand Down
Loading