Skip to content

Commit

Permalink
Fix incorrect server option -noTeamKills
Browse files Browse the repository at this point in the history
  • Loading branch information
RighthandSon committed Jan 21, 2024
1 parent ba00bbf commit 5818ccc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
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
4 changes: 2 additions & 2 deletions src/Document/Obstacles/Option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const OptionsProperties = {
'-mps': bzwInt,
'-ms': bzwInt,
'-mts': bzwInt,
'-noteamkills': bzwBool,
'-noTeamKills': bzwBool,
'-offa': bzwBool,
'+r': bzwBool,
'-rabbit': bzwRabbitMode,
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/Document/__tests__/parseBZWDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ describe('BZW Document Parser', () => {
-mps 420
-ms 1011
-mts 777
-noteamkills
-noTeamKills
-offa
+r
-rabbit killer
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/Document/__tests__/writeBZWDocument.ts
Original file line number Diff line number Diff line change
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 @@ -433,7 +433,7 @@ describe('BZW Document Writer', () => {
-mps 100
-ms 5
-mts 512
-noteamkills
-noTeamKills
-offa
+r
-rabbit killer
Expand Down

0 comments on commit 5818ccc

Please sign in to comment.