-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #742 from LVPlayground/feature/gravityKey
add key to easily swap around gravity in the car
- Loading branch information
Showing
6 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2020 Las Venturas Playground. All rights reserved. | ||
// Use of this source code is governed by the MIT license, a copy of which can | ||
// be found in the LICENSE file. | ||
|
||
import Command from 'features/playground/command.js'; | ||
import { CommandBuilder } from 'components/command_manager/command_builder.js'; | ||
|
||
// Command: /gravitykey [player] | ||
export default class GravityKeyCommand extends Command { | ||
get name() { return 'gravitykey'; } | ||
get defaultPlayerLevel() { return Player.LEVEL_MANAGEMENT; } | ||
|
||
build(commandBuilder) { | ||
commandBuilder | ||
.parameters([{ name: 'target', type: CommandBuilder.PLAYER_PARAMETER, optional: true }]) | ||
.build(GravityKeyCommand.prototype.onGravityKeyCommand.bind(this)); | ||
} | ||
|
||
// Turn on or off the ability to use indicators. | ||
async onGravityKeyCommand(player, target) { | ||
const subject = target || player; | ||
|
||
if (subject.syncedData.vehicleKeys & Vehicle.kVehicleKeysGravity) { | ||
subject.syncedData.vehicleKeys &= ~ Vehicle.kVehicleKeysGravity; | ||
subject.gravity = Player.kDefaultGravity; | ||
|
||
player.sendMessage(Message.COMMAND_SUCCESS, subject.name + ' can\'t switch gravity anymore.'); | ||
return; | ||
} | ||
|
||
subject.syncedData.vehicleKeys |= Vehicle.kVehicleKeysGravity; | ||
player.sendMessage(Message.COMMAND_SUCCESS, subject.name + ' will now able to switch gravity.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters