Skip to content

Instantly share code, notes, and snippets.

@johnsmm
Created February 22, 2017 17:05
Show Gist options
  • Save johnsmm/5c3f5f7a796dcc95b1e2e73efed760f6 to your computer and use it in GitHub Desktop.
Save johnsmm/5c3f5f7a796dcc95b1e2e73efed760f6 to your computer and use it in GitHub Desktop.
//--- Deal with a structure
if (_nearest distance _mappos < 50 && isNull _fobr && isNull _foblarger) then {
if (isNil {_nearest getVariable "cti_sell"}) then {
//--- Commander Refund
if (!isNil {_nearest getVariable "cti_structure_type"} && isNil{_nearest getVariable "cti_sell"}) then {
_nearest setVariable ["cti_sell", true, true];
_var = missionNamespace getVariable format ["CTI_%1_%2", CTI_P_SideJoined, _nearest getVariable "cti_structure_type"];
_label = ((_var select 0) select 1);
_refund = round((_var select 2) * CTI_BASE_CONSTRUCTION_REFUNDS);
_coords = mapGridPosition _nearest;
_delay = missionNamespace getVariable "CTI_BASE_CONSTRUCTION_DELAY";
sleep _delay;
[CTI_P_SideJoined, _refund] call CTI_CO_FNC_ChangeSideSupply;
["structure-sold", [_label, _coords]] remoteExec ["CTI_PVF_CLT_OnMessageReceived", CTI_P_SideJoined];
["structure-sold-refund", [_refund, _label]] call CTI_CL_FNC_DisplayMessage;
};
_nearest setDammage 1;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment