Skip to content

Commit

Permalink
fix respawn in water
Browse files Browse the repository at this point in the history
  • Loading branch information
McDiod committed Dec 5, 2018
1 parent 2ba5478 commit 85385f7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
10 changes: 9 additions & 1 deletion functions/events/fn_findSoloRespawnPosition.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ private _respawnPos = [];
private _searchPos = if (count _aliveTeamMates > 0) then {
getPos selectRandom _aliveTeamMates
} else {
[EGVAR(missionSetup,playAreaCenter),[0,EGVAR(missionSetup,playAreaSize) - 25],[0,360]] call EFUNC(common,randomPos);
_noWaterPos = [0,0,0];
for "_i" from 0 to 1000 do {
_noWaterPos = [EGVAR(missionSetup,playAreaCenter),[0,EGVAR(missionSetup,playAreaSize) - 25],[0,360]] call EFUNC(common,randomPos);
if (!surfaceIsWater _noWaterPos) exitWith {};
};
if (surfaceIsWater _noWaterPos) then {
_noWaterPos = EGVAR(missionSetup,playAreaCenter);
};
_noWaterPos
};

for "_i" from 0 to 10 do {
Expand Down
9 changes: 8 additions & 1 deletion functions/events/fn_respawnTeam.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ _teamNamespace setVariable [QGVAR(teamRespawnRunning),true];
private _teamMateUIDs = _teamNamespace getVariable [QEGVAR(missionSetup,teamMateUIDs),[]];
private _teamMates = _teamMateUIDs apply {[_x] call BIS_fnc_getUnitByUid};

private _teamRespawnPos = [EGVAR(missionSetup,playAreaCenter),[0,EGVAR(missionSetup,playAreaSize) - 25],[0,360]] call EFUNC(common,randomPos);
private _teamRespawnPos = [0,0,0];
for "_i" from 0 to 1000 do {
_teamRespawnPos = [EGVAR(missionSetup,playAreaCenter),[0,EGVAR(missionSetup,playAreaSize) - 25],[0,360]] call EFUNC(common,randomPos);
if (!surfaceIsWater _teamRespawnPos) exitWith {};
};
if (surfaceIsWater _teamRespawnPos) then {
_teamRespawnPos = EGVAR(missionSetup,playAreaCenter);
};

{
_respawnPos = ([_searchPos,[0,30]] call EFUNC(common,randomPos)) findEmptyPosition [0,30,"B_Soldier_F"];
Expand Down
7 changes: 4 additions & 3 deletions functions/events/fn_waitTeamRespawnTime.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ params ["_timeLeft"];
//hint predefine ===============================================================
private _rule = parseText "<t align='center'><t color='#708090'>-----------------------------------------------------<br /></t></t>";
private _lineBreak = parseText "<br />";
private _respawnText = ["Respawn in: ","Team dead. Respawn in max: "] select ((missionNamespace getVariable [QEGVAR(missionSetup,teamSize),0]) > 1);

[{
params ["_args","_handle"];
_args params ["_timeLeft","_rule","_lineBreak"];
_args params ["_timeLeft","_rule","_lineBreak","_respawnText"];

if (_timeLeft <= 0 || missionNamespace getVariable [QGVAR(gameEnded),false]) exitWith {
_respawning = parseText format ["<t align='center' color='#00ff00' size='1.4'>Respawning...</t>"];
Expand All @@ -20,9 +21,9 @@ private _lineBreak = parseText "<br />";

//hint
_timestr = [_timeleft, "MM:SS"] call BIS_fnc_secondsToString;
_respawnIn = parseText format ["<t align='center' size='1.4'>Team dead. Respawn in max: <t color='#ffff00'>%1</t></t>", _timestr];
_respawnIn = parseText format ["<t align='center' size='1.4'>%1<t color='#ffff00'>%2</t></t>",_respawnText, _timestr];
hintSilent composeText [_rule,_respawnin,_linebreak,_rule];

_args set [0,_timeLeft - 1];

},1,[_timeLeft,_rule,_lineBreak]] call CBA_fnc_addPerFrameHandler;
},1,[_timeLeft,_rule,_lineBreak,_respawnText]] call CBA_fnc_addPerFrameHandler;
1 change: 1 addition & 0 deletions functions/missionSetup/fn_scoreBoard.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "..\..\dialog\scoreboard\defines.hpp"

if (!hasInterface) exitWith {};
if !(missionNamespace getVariable [QGVAR(gameStarted),false]) exitWith {};

private ["_display", "_teamScore", "_teamName"];
if (!alive player) exitWith {};
Expand Down

0 comments on commit 85385f7

Please sign in to comment.