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

Modernize pickupAction function #654

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

DarkWiiPlayer
Copy link

Whether or not it's cash can be read from the variable and for the target client there's now the remoteExecutedOwner command.

if (_cash) then {
_obj remoteExecCall ["life_fnc_pickupMoney",_client];

if (_target getVariable "item" select 0 isEqualTo "cash") then {
Copy link
Contributor

@blackfisch blackfisch May 1, 2020

Choose a reason for hiding this comment

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

check for "item" variable to be nil -> could theoretically happen. Better safe than sorry

private _target = param [0, objNull, [objNull]];

if (!isRemoteExecuted) exitWith { ["Not remote executed"] call BIS_fnc_error };
if (isNull _obj) exitWith { ["Target object is NULL"] call BIS_fnc_error };
Copy link
Contributor

Choose a reason for hiding this comment

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

_obj not defined -> you renamed it to _target

carries on throughout the file

Comment on lines 10 to 11
if (!isRemoteExecuted) exitWith { ["Not remote executed"] call BIS_fnc_error };
if (isNull _obj) exitWith { ["Target object is NULL"] call BIS_fnc_error };
Copy link
Contributor

Choose a reason for hiding this comment

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

don't know if there's a real reason, but I don't think Altis Life uses this function, so we shouldn't start doing so now for consistencies sake

@DarkWiiPlayer
Copy link
Author

By the way I assume these commits will all be squashed anyway, as there's no real point to keeping them around, so I'm not really trying to keep them atomic or anything ;D

if (isNull _obj) exitWith {};
if (!(_target getVariable ["item", false]) isEqualType []) exitWith {};

if !(_obj getVariable ["inUse",false]) exitWith {
Copy link
Contributor

Choose a reason for hiding this comment

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

would rather actually exit if its in use than executing code when it isnt

Suggested change
if !(_obj getVariable ["inUse",false]) exitWith {
if (_obj getVariable ["inUse",false]) exitWith {};

private _target = param [0, objNull, [objNull]];

if (!isRemoteExecuted) exitWith {};
if (isNull _obj) exitWith {};
Copy link
Contributor

Choose a reason for hiding this comment

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

still _obj

life_server/Functions/Actions/fn_pickupAction.sqf Outdated Show resolved Hide resolved
["_client",objNull,[objNull]],
["_cash",false,[true]]
];
private _target = param [0, objNull, [objNull]];
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 _target = param [0, objNull, [objNull]];
params [
["_target", objNull, [objNull]]
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants