Skip to content

Commit

Permalink
added detachable radio unit
Browse files Browse the repository at this point in the history
  • Loading branch information
nomisum committed Mar 21, 2016
1 parent bd5d652 commit 8169bdc
Show file tree
Hide file tree
Showing 15 changed files with 314 additions and 443 deletions.
2 changes: 1 addition & 1 deletion init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ if (hasInterface) then {
checkJIP = {
if ((OPFOR_TELEPORT_TARGET select 0 != 0) && didJIP && time > jipTime) then {
player setDamage 1;
["forced"] spawn CSSA3_fnc_createSpectateDialog;
} else {
if (!didJIP) exitWith {
[] call checkSpawnButton;
Expand Down Expand Up @@ -323,6 +322,7 @@ if (hasInterface) then {
[] execVM "player\opforOpforTeleportListener.sqf"; diag_log format ["setup: opforOpforTeleportListener initiated"];
[] execVM "player\bluforRussianPointsListener.sqf";
[] spawn checkJIP; diag_log format ["setup: createStartHints initiated"];
player setVariable ["radioAttached",false]; // for use in detaching radio from radio truck
};


Expand Down
8 changes: 4 additions & 4 deletions mission.sqm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ class EditorData
};
class Camera
{
pos[]={1653.5035,82.990616,6004.2529};
dir[]={0.044427481,-0.65623856,0.75325894};
up[]={0.038638279,0.75455058,0.6551035};
aside[]={0.99827683,-4.8836228e-007,-0.058877323};
pos[]={1613.2671,12.056331,5392.2759};
dir[]={0.16499333,-0.23893414,-0.95695496};
up[]={0.040601429,0.97103274,-0.23548557};
aside[]={-0.98549837,7.8856829e-008,-0.16991524};
};
};
binarizationWanted=0;
Expand Down
53 changes: 13 additions & 40 deletions mission_setup/teleport.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ checkWater = {
};
};

if (str player == "opfor_teamlead") then {
opforTeleporting = {
OPFOR_TELEPORT_TARGET = _this;
publicVariableServer "OPFOR_TELEPORT_TARGET";
debugLog("opfor published target");

OPFOR_TELEPORTED = true;
publicVariable "OPFOR_TELEPORTED";
};

// executed on player only anyway?!
// if (player == opfor_teamlead) then {

[
"teleportClickOpf",
"onMapSingleClick",
Expand All @@ -23,42 +34,4 @@ if (str player == "opfor_teamlead") then {
};
}
] call BIS_fnc_addStackedEventHandler;
};

if (str player == "blufor_teamlead") then {
[
"teleportClickBlu",
"onMapSingleClick",
{
try {
if (OPFOR_TELEPORT_TARGET select 0 == 0) then { throw "opfor not yet teleported" };

["teleportClickBlu", "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;

//_pos call bluforTeleporting;
} catch {
hint str _exception;
};
}
] call BIS_fnc_addStackedEventHandler;
};

opforTeleporting = {
OPFOR_TELEPORT_TARGET = _this;
publicVariableServer "OPFOR_TELEPORT_TARGET";
debugLog("opfor published target");

OPFOR_TELEPORTED = true;
publicVariable "OPFOR_TELEPORTED";
};

bluforTeleporting = {

BLUFOR_TELEPORT_TARGET = _this;
publicVariableServer "BLUFOR_TELEPORT_TARGET";

BLUFOR_TELEPORTED = true;
publicVariable "BLUFOR_TELEPORTED";
};


// };
25 changes: 25 additions & 0 deletions player/radioAttached.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

// put away weapon
[player] call ace_weaponselect_fnc_putWeaponAway;
sleep 1.1;
radioSuitcaseCarry = "Land_Suitcase_F" createvehicle getpos player;
radioSuitcaseCarry attachTo [player, [-0.03,-.1,-0.26], "RightHandMiddle1"];
radioSuitcaseCarry setVectorDirAndUp [[1,0,0],[0,0,1]];
player setVariable ["radioAttached",true];
publicVariable "radioSuitcaseCarry";

// checks
while {true} do {
if (!alive player) exitWith {}; // if player is dead
if (currentWeapon player != "") exitWith {}; // if player switches to weapon
if (!(player getVariable ["radioAttached",false])) exitWith {}; // if player lost the radio in another way (put it back)
sleep 0.5;
};

if (player getVariable ["radioAttached",false]) then {
radioSuitcaseDropped = createVehicle ['Land_SatellitePhone_F', [getPos player select 0, (getPos player select 1) - 0.5,0], [], 0, 'CAN_COLLIDE'];
publicVariable "radioSuitcaseDropped";
};

player setVariable ["radioAttached",false];
deleteVehicle radioSuitcaseCarry;
15 changes: 12 additions & 3 deletions server/russianMarker.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bluforSurrendered = {
};

funkwagenIsSending = {
((funkwagen getVariable ["tf_range",0]) == 50000) || (inflamed funkwagen);
((funkwagen getVariable ["tf_range",0]) == 50000) || funkwagen getVariable ["detachableRadio", 0] == 2;
};

booleanEqual = {
Expand Down Expand Up @@ -61,8 +61,17 @@ sleep 2; // give it time, boy - possible fix for "Undefined variable in expressi
if (!alive funkwagen) exitWith {
[] call bluforCaptured;
};

[getPos funkwagen select 0, getPos funkwagen select 1] call setRussianMarkerPosition;
if (funkwagen getVariable ["detachableRadio", 0] == 0 || funkwagen getVariable ["detachableRadio", 0] == 1) then {
[getPos funkwagen select 0, getPos funkwagen select 1] call setRussianMarkerPosition;
} else {
if (!isNil "radioSuitcaseDropped") then {
[getPos radioSuitcaseDropped select 0, getPos radioSuitcaseDropped select 1] call setRussianMarkerPosition;
};
if (!isNil "radioSuitcaseCarry") then {
[getPos radioSuitcaseCarry select 0, getPos radioSuitcaseCarry select 1] call setRussianMarkerPosition;
};
};


sleep 1;
};
Expand Down
2 changes: 0 additions & 2 deletions server/spawnBluforHQ.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ spawnOpforHQ = {
/* listener to remove spawn pad and actionhelper, when its time */
BUY_OPTION_OPFOR = {
if (BUY_OPTION_OPFOR) exitWith {};
detach rusActionHelper;
deleteVehicle rusActionHelper;
hideObjectGlobal RUS_SPAWN_PAD;
};
"BUY_OPTION_OPFOR" addPublicVariableEventHandler BUY_OPTION_OPFOR;
Expand Down
19 changes: 6 additions & 13 deletions server/teleportListener.sqf
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
createOpforStuff = {
_position = _this;

if (USE_FIREPLACE_INSTEAD_OF_RADIO_TRUCK) then {
funkwagen = "land_campfire" createVehicle _position;
} else {
funkwagen = [_position, 0, 1, "rhs_gaz66_r142_vv"] call spawnStuff;
};

funkwagen = [_position, 0, 1, "rhs_gaz66_r142_vv"] call spawnStuff;
// used for detachable radio unit
funkwagen setVariable ["detachableRadio", 0, true];

sleep 1;
[funkwagen] call clearInventory;


// hide light covers for optical reasons
funkwagen animate ["light_hide",1];
sleep 0.1;

rusActionHelper = createVehicle ["Land_SatellitePhone_F", [(getPos funkwagen select 0) + 2, (getPos funkwagen select 1) - 1, 0.5], [], 0, "NONE"];
rusActionHelper attachTo [funkwagen, [-1.34,-2.26,0.1]];
rusActionHelper setVectorDirAndUp [[1,0,0],[0,0,1]];

[getPos funkwagen, 50] call spawnOpforHQ;


Expand Down Expand Up @@ -51,7 +45,6 @@ _OPFOR_TELEPORT_TARGET_listener = {
_BLUFOR_TELEPORT_TARGET_listener = {
_pos = _this select 1;
publicVariable "BLUFOR_TELEPORT_TARGET";

[] spawn {
sleep 2; // just to make sure no one is missed, send again (dirty fix for spawn prob?)
publicVariable "BLUFOR_TELEPORT_TARGET";
Expand All @@ -75,4 +68,4 @@ if (!isMultiplayer) then {
waitUntil {BLUFOR_TELEPORT_TARGET select 0 != 0};
[0, OPFOR_TELEPORT_TARGET] call _this;
};
};
};
60 changes: 57 additions & 3 deletions spawn/addInteractions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,70 @@ _rusAction = ["RusBuyMenu", (localize "str_GRAD_buy_vehicles"), "",
},
{side player == east}] call ace_interact_menu_fnc_createAction;
["rhs_gaz66_r142_vv", 0, ["ACE_MainActions"],_rusAction] call ace_interact_menu_fnc_addActionToClass;
["land_campfire", 0, ["ACE_MainActions"], _rusAction] call ace_interact_menu_fnc_addActionToClass;


_destroyAction = ["usDestroyMenu", (localize "str_GRAD_destroy_vehicle"), "",
{
[60, [_this select 0], {((_this select 0) select 0) setdamage 1;}, {hint "Cancelled action"}, (localize "str_GRAD_destroying_radio")] call ace_common_fnc_progressBar;
},
{side player == west}] call ace_interact_menu_fnc_createAction;
["rhs_gaz66_r142_vv", 0, ["ACE_MainActions"],_destroyAction] call ace_interact_menu_fnc_addActionToClass;
["land_campfire", 0, ["ACE_MainActions"],_destroyAction] call ace_interact_menu_fnc_addActionToClass;

_destroyActionPortableRadio = ["usDestroyMenuDropped", (localize "str_GRAD_destroy_vehicle"), "",
{
[60, [_this select 0], {((_this select 0) select 0) setdamage 1; BLUFOR_CAPTURED = TRUE; publicVariable "BLUFOR_CAPTURED";}, {hint "Cancelled action"}, (localize "str_GRAD_destroying_radio")] call ace_common_fnc_progressBar;
},
{side player == west}] call ace_interact_menu_fnc_createAction;
["Land_SatellitePhone_F", 0, ["ACE_MainActions"],_destroyActionPortableRadio] call ace_interact_menu_fnc_addActionToClass;

_destroyActionPortableRadio = ["usDestroyMenuPortable", (localize "str_GRAD_destroy_vehicle"), "",
{
[60, [_this select 0], {((_this select 0) select 0) setdamage 1; BLUFOR_CAPTURED = TRUE; publicVariable "BLUFOR_CAPTURED";}, {hint "Cancelled action"}, (localize "str_GRAD_destroying_radio")] call ace_common_fnc_progressBar;
},
{side player == west}] call ace_interact_menu_fnc_createAction;
["Land_Suitcase_F", 0, ["ACE_MainActions"],_destroyActionPortableRadio] call ace_interact_menu_fnc_addActionToClass;


_detachRadioAction = ["RusDetachMenu", (localize "str_GRAD_detach_radio"), "",
{
[6, [_this select 0], {
((_this select 0) select 0) setVariable ["detachableRadio", 2, true];
[] execVM "player\radioAttached.sqf";
}, {hint "Cancelled action"}, (localize "str_GRAD_detaching_radio")] call ace_common_fnc_progressBar;
},
{side player == east && ((_this select 0) getVariable ["detachableRadio", 0] == 1)}] call ace_interact_menu_fnc_createAction;
["rhs_gaz66_r142_vv", 0, ["ACE_MainActions"],_detachRadioAction] call ace_interact_menu_fnc_addActionToClass;

_attachRadioAction = ["RusDetachMenu", (localize "str_GRAD_attach_radio"), "",
{
[6, [_this select 0], {
((_this select 0) select 0) setVariable ["detachableRadio", 1, true];

radioSuitcaseAttached = createVehicle ['Land_SatellitePhone_F', [(getPos ((_this select 0) select 0) select 0) + 2, (getPos ((_this select 0) select 0) select 1) - 1, 0.5], [], 0, 'NONE'];
radioSuitcaseAttached attachTo [((_this select 0) select 0), [-1.34,-2.26,0.1]];
radioSuitcaseAttached setVectorDirAndUp [[1,0,0],[0,0,1]];
player setVariable ["radioAttached",false];
}, {hint "Cancelled action"}, (localize "str_GRAD_attaching_radio")] call ace_common_fnc_progressBar;
},
{side player == east && ((_this select 0) getVariable ["detachableRadio", 0] == 2)}] call ace_interact_menu_fnc_createAction;
["rhs_gaz66_r142_vv", 0, ["ACE_MainActions"],_attachRadioAction] call ace_interact_menu_fnc_addActionToClass;

////////////// attach action to dropped radio
_droppedRadioAction = ["droppedRadioMenu", (localize "str_GRAD_pickup_radio"), "",
{
[0.5, [_this select 0], {
deleteVehicle ((_this select 0) select 0);
[] execVM "player\radioAttached.sqf";
}, {hint "Cancelled action"}, (localize "str_GRAD_pickup_radio")] call ace_common_fnc_progressBar;
},
{side player == east && funkwagen getVariable ["detachableRadio", 0] == 2}] call ace_interact_menu_fnc_createAction;
["Land_SatellitePhone_F", 0, ["ACE_MainActions"],_droppedRadioAction] call ace_interact_menu_fnc_addActionToClass;


_dropRadioAction = ["ACE_MainActions", (localize "str_GRAD_drop_radio"), "",
{(player setVariable ["radioAttached",false];},
{side player == east && (player getVariable ["radioAttached",false])}] call ace_interact_menu_fnc_createAction;

[player, 0, ["ACE_MainActions"], _dropRadioAction] call ace_interact_menu_fnc_addActionToObject;



Expand Down
Loading

0 comments on commit 8169bdc

Please sign in to comment.