Skip to content

Major vehicle overhaul #640

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

Open
wants to merge 43 commits into
base: master
Choose a base branch
from

Conversation

DomT602
Copy link
Member

@DomT602 DomT602 commented Mar 26, 2020

Resolves #528.

Changes proposed in this pull request:

@DomT602 DomT602 self-assigned this Mar 26, 2020
@DomT602 DomT602 added 6.0.0 bug-fix For pull requests that fix a bug or other issue. enhancement For pull requests and issues that suggest an improvement to an existing feature. In Progress labels Mar 26, 2020
Copy link
Contributor

@blackfisch blackfisch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good, however there's some things bothering me :D

You make me do work, I'll make you work!

@DomT602 DomT602 changed the title Initial vehicle work Major vehicle overhaul Mar 26, 2020
@DomT602 DomT602 requested a review from BoGuu April 25, 2020 16:19
SQL1_INPUTS = 1, 2, 3

[insertVehicle]
SQL1_1 = INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear, damage) VALUES (?, ?, ?, ?, '1','1','[[],0]', ?, ?,'[]','[]')
SQL1_1 = INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear) VALUES (?, ?, ?, ?, '1','1','[[],0]', ?, ?,'[]'); SELECT LAST_INSERT_ID()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a separate statement.

Suggested change
SQL1_1 = INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear) VALUES (?, ?, ?, ?, '1','1','[[],0]', ?, ?,'[]'); SELECT LAST_INSERT_ID()
SQL1_1 = INSERT INTO vehicles (side, classname, type, pid, alive, active, inventory, color, plate, gear) VALUES (?, ?, ?, ?, '1','1','[[],0]', ?, ?,'[]')
SQL1_2 = SELECT LAST_INSERT_ID()

@@ -6,14 +6,13 @@
Description:
Called when purchasing a license. May need to be revised.
*/
private ["_type","_varName","_displayName","_sideFlag","_price"];
_type = _this select 3;
params ["", "", "", "_type"];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use extended syntax for type safety:

Suggested change
params ["", "", "", "_type"];
params ["", "", "", ["_type", "", [""]]];

private ["_fish","_type","_typeName"];
if (!(vehicle player isKindOf "Ship")) exitWith {};
_fish = (nearestObjects[getPos vehicle player,["Fish_Base_F"],20]);
private _vehicle = vehicle player;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private _vehicle = vehicle player;
private _vehicle = objectParent player;

would be the nicer way. might have to check for isNull _vehicle tho


if (_zone != "") exitWith {};
if !(_zone isEqualTo "") exitWith {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use new isNotEqualTo command

};

if (_zone isEqualTo "") exitWith {life_action_inUse = false;};

if (_requiredItem != "") then {
_valItem = missionNamespace getVariable "life_inv_" + _requiredItem;
if !(_requiredItem isEqualTo "") then {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use new isNotEqualTo command


if (hmd player != "") then {
if !(hmd player isEqualTo "") then {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use new isNotEqualTo command

private _owners = _vehicle getVariable "vehicle_info_owners";
private _insertedIndex = _owners pushBackUnique [_uid,_unit getVariable ["realname",name _unit]];

if (_insertedIndex != -1) then {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use new isNotEqualTo command

};

private _textureArray = M_CONFIG(getArray,"LifeCfgVehicles",_className,"textures");
private _colorIndex = _textureArray findIf {_x select 0 == _colorName};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEqualTo


//Error checks
if (isNull _vehicle || isNull _unit) exitWith {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (isNull _vehicle || isNull _unit) exitWith {
if (isNull _vehicle || {isNull _unit}) exitWith {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.0.0 bug-fix For pull requests that fix a bug or other issue. enhancement For pull requests and issues that suggest an improvement to an existing feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants