-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add speed limit attribute #699
Open
ampersand38
wants to merge
13
commits into
zen-mod:master
Choose a base branch
from
ampersand38:speed-limit-attribute-with-toggle
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ed82661
add settings to toggle attributes
ampersand38 d182e45
add speed limit attribute
ampersand38 6e4892a
Merge remote-tracking branch 'upstream/master' into speed-limit-attri…
ampersand38 e9b1733
Merge remote-tracking branch 'upstream/master' into speed-limit-attri…
ampersand38 361bdd4
split out toggle settlings
ampersand38 1183816
separate speed ranges for land, heli plane
ampersand38 0fd6c73
remove unneeded
ampersand38 7007514
Merge remote-tracking branch 'upstream/master' into speed-limit-attri…
ampersand38 086dc4b
Merge remote-tracking branch 'upstream/master' into speed-limit-attri…
ampersand38 cbd9de1
tooltips
ampersand38 bd0a92a
toggle attribute setting
ampersand38 220b8c7
naming to SpeedLimit
ampersand38 0b7b802
handled in fnc_setSpeedLimit
ampersand38 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,60 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Ampersand | ||
* Sets the movement speed mode of the given vehicle(s). | ||
* | ||
* Arguments: | ||
* 0: Vehicle <OBJECT|ARRAY> | ||
* 1: Speed <NUMBER> (default: 0) | ||
* Man: Speed modes | ||
* Vehicles: km/h | ||
* | ||
* 2.12 | forceSpeed | limitSpeed | ||
* _speed | neg zero pos | neg zero pos -(_man getSpeed "SLOW") | ||
* -------|-------------------------|--------------------------------------------------------------------- | ||
* man | reset stop yes | reset stop yes reverse, doesn't work if combat mode | ||
* car | reset stop yes | reset reset yes | ||
* tank | reset stop yes | reset reset yes | ||
* heli | no-eff no-eff no-eff | reverse stop yes | ||
* plane | reset reset yes | min min yes | ||
* vtol | reset reset yes | min min yes | ||
* boat | reset stop yes | reset stop yes | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [_vehicle, 1] call zen_common_fnc_setSpeed | ||
* | ||
* Public: No | ||
*/ | ||
|
||
#define SPEED_RESET 0 | ||
#define SPEED_FAST 1 | ||
#define SPEED_NORMAL 2 | ||
#define SPEED_SLOW 3 | ||
#define SPEED_BACK 4 | ||
|
||
params ["_vehicle", "_speed"]; | ||
|
||
if (_vehicle isEqualType []) exitWith { | ||
{ | ||
[_x, _speed] call FUNC(setSpeed); | ||
} forEach _vehicle; | ||
}; | ||
|
||
if (!local _vehicle) exitWith {}; | ||
|
||
if (_vehicle isKindOf "Helicopter") exitWith { | ||
if (_speed == 0) exitWith { | ||
_vehicle limitSpeed (getNumber (configOf _vehicle >> "maxSpeed")); // Reset | ||
}; | ||
_vehicle limitSpeed _speed; // Allow reverse | ||
}; | ||
|
||
// Planes, LandVehicle, Ship | ||
if (_speed == 0) then { | ||
_speed = -1; // Reset | ||
}; | ||
|
||
_vehicle forceSpeed (_speed / 3.6); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if
spawn
would speed things along ?^ Granted, my laptop doesn't run both the game and the Server instance simultaneously especially fast, and on it I noticed that
forEach
+spawn
takes a noticeable time to get things done compared tocall
, likeCBA_fnc_setLoadout
can take something like 400-600ms (looks like it) to get the squad equipped (which also happens in a random order) instead of next to instantly (in the squad leader's command bar order).^ Might help when someone has a less good Internet connection, dunno.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting, so each one can run "in parallel"?
As for network, I tried to structure the CBA event and the function such that the selected array is pre-filtered and then only sent on network once, if I'm getting your meaning correctly.