Add switch seats + fix 0 divisor

Also fix CFG error
This commit is contained in:
icomrade
2014-03-16 16:32:30 -04:00
parent eaa0ba1b04
commit 3c28809247
5 changed files with 130 additions and 8 deletions

View File

@@ -74,7 +74,7 @@ class CfgWeapons {
class PK;
class PK_DZ: PK {
type = "1";
}
};
class Default {
canlock = 0;

View File

@@ -0,0 +1,40 @@
/*
Created exclusively for ArmA2:OA - DayZMod and DayZ Epoch. Script by icomrade.
permission is required to use, alter and/or distribute from the author or project leader.
*/
private ["_array","_count","_action","_driver","_vehicle","_vehicleType","_emptySeat","_emptyGun"];
_array = _this select 3;
_action = _array select 0;
_driver = _array select 1;
_vehicle = vehicle player;
_vehicleType = typeOf _vehicle;
_emptySeat = count (assignedCargo _vehicle);
_count = count (configFile >> "CfgVehicles" >> _vehicleType >> "Turrets");
_emptyGun = ((_vehicle emptyPositions "Gunner") - _count);
switch _action do {
case "MoveToPilot": {
if (((_vehicle emptyPositions "Driver") == 0) and (!alive _driver)) then {
_driver action ["EJECT", _vehicle];
sleep 0.5; //wait for ejection
};
if ((_vehicle emptyPositions "Driver") > 0) then {
player action [_action, _vehicle];
};
};
case "MoveToCargo": {
if ((_vehicle emptyPositions "Cargo") > 0) then {
player action [_action, _vehicle, _emptySeat];
};
};
case "MoveToTurret": {
if ((_vehicle emptyPositions "Gunner") > 0) then {
player action [_action, _vehicle, [abs(_emptyGun)]];
};
};
case "MoveToCommander": {
if ((_vehicle emptyPositions "Commander") > 0) then {
player action [_action, _vehicle];
};
};
};

View File

@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_damageActions.sqf";
- Function
- [] call fnc_usec_damageActions;
************************************************************/
private ["_weaponName","_action","_turret","_weapons","_assignedRole","_action1","_action2","_x","_vehicle","_unit","_vehType","_displayName","_ammoQty","_ammoSerial","_weapon","_magTypes","_type","_typeVeh","_index","_inventory","_unitTo","_isEngineer","_vehClose","_hasVehicle","_unconscious","_lowBlood","_injured","_inPain","_legsBroke","_armsBroke","_charID","_friendlies","_playerMagazines","_hasBandage","_hasEpi","_hasMorphine","_hasBlood","_hasToolbox","_hasJerry","_hasJerryE","_hasWire","_hasPainkillers","_unconscious_crew","_patients","_crew","_menClose","_hasPatient","_inVehicle","_isClose","_bag","_classbag","_isDisallowRefuel","_hasBarrel","_hasBarrelE"];
private ["_action","_weaponName","_turret","_weapons","_assignedRole","_driver","_action1","_action2","_x","_vehicle","_unit","_vehType","_type","_typeVeh","_isDisallowRefuel","_vehClose","_hasVehicle","_unconscious","_lowBlood","_injured","_inPain","_legsBroke","_armsBroke","_charID","_friendlies","_playerMagazines","_hasBandage","_hasEpi","_hasMorphine","_hasBlood","_hasJerry","_hasBarrel","_hasJerryE","_hasBarrelE","_hasPainkillers","_unconscious_crew","_patients","_crew","_menClose","_hasPatient","_inVehicle","_isClose"];
disableSerialization;
@@ -15,17 +15,48 @@ _hasPatient = alive _menClose;
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
_isClose = ((player distance _menClose) < ((sizeOf typeOf _menClose) / 2));
_bag = unitBackpack player;
_classbag = typeOf _bag;
//_bag = unitBackpack player;
//_classbag = typeOf _bag;
if (_inVehicle) then {
r_player_lastVehicle = _vehicle;
_assignedRole = assignedVehicleRole player;
_driver = driver (vehicle player);
if (str (_assignedRole) != str (r_player_lastSeat)) then {
call r_player_removeActions2;
};
if (!r_player_unconscious && !r_action2) then {
r_player_lastSeat = _assignedRole;
if (_inVehicle) then {
//allow switch to pilot
if (((_assignedRole select 0) != "driver") and ((!alive _driver) or ((_vehicle emptyPositions "Driver") > 0))) then {
if (_vehicle isKindOf "helicopter") then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_308A", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToPilot",_driver], 0, false, true];
} else {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_308", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToPilot",_driver], 0, false, true];
};
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
};
//allow switch to cargo
if (((_assignedRole select 0) != "cargo") and ((_vehicle emptyPositions "Cargo") > 0)) then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_309", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToCargo",_driver], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
};
//allow switch to gunner
if (((_assignedRole select 0) != "Turret") and ((_vehicle emptyPositions "Gunner") > 0)) then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_310", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToTurret",_driver], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
};
//allow switch to commander
if (((assignedCommander _vehicle) != player) and ((_vehicle emptyPositions "Commander") > 0)) then {
_action = _vehicle addAction [localize "STR_EPOCH_PLAYER_311", "\z\addons\dayz_code\actions\veh_seatActions.sqf",["MoveToTurret",_driver], 0, false, true];
r_player_actions2 set [count r_player_actions2,_action];
r_action2 = true;
};
};
if (count _assignedRole > 1) then {
_turret = _assignedRole select 1;
_weapons = _vehicle weaponsTurret _turret;
@@ -62,13 +93,13 @@ if (!isNull _menClose and _hasPatient and !r_drag_sqf and !r_action and !_inVehi
_hasEpi = "ItemEpinephrine" in _playerMagazines;
_hasMorphine = "ItemMorphine" in _playerMagazines;
_hasBlood = "ItemBloodbag" in _playerMagazines;
_hasToolbox = "ItemToolbox" in items player;
//_hasToolbox = "ItemToolbox" in items player;
_hasJerry = "ItemJerrycan" in _playerMagazines;
_hasBarrel = "ItemFuelBarrel" in _playerMagazines;
_hasJerryE = "ItemJerrycanEmpty" in _playerMagazines;
_hasBarrelE = "ItemFuelBarrelEmpty" in _playerMagazines;
//_hasEtool = "ItemEtool" in weapons player;
_hasWire = "ItemWire" in _playerMagazines;
//_hasWire = "ItemWire" in _playerMagazines;
_hasPainkillers = "ItemPainkiller" in _playerMagazines;
//Allow player to drag

View File

@@ -3,6 +3,7 @@ disableSerialization;
if ((!r_player_handler1) and (r_handlerCount == 0)) then {
//Unconscious Meter
_totalTimeout = r_player_timeout;
if (_totalTimeout == 0) then { _totalTimeout = 1; }; //Fix for zero divisor
4 cutRsc ["playerStatusWaiting", "PLAIN",0];
_display = uiNamespace getVariable 'DAYZ_GUI_waiting';
_ctrl1 = _display displayCtrl 1400;

View File

@@ -5996,6 +5996,56 @@
<!-- <French></French> -->
<!-- <Czech></Czech> -->
</Key>
<Key ID="STR_EPOCH_PLAYER_308">
<Original>To driver's seat</Original>
<English>To driver's seat</English>
<Spanish>Para el asiento del conductor</Spanish>
<Russian>Для сиденья водителя</Russian>
<French>Pour le siège du conducteur</French>
<Czech>Chcete-li sedadla řidiče</Czech>
<!-- <Dutch></Dutch> -->
<!-- <German></German> -->
</Key>
<Key ID="STR_EPOCH_PLAYER_308A">
<Original>To pilot's seat</Original>
<English>To pilot's seat</English>
<Spanish>Al asiento de piloto</Spanish>
<Russian>Пересесть на место пилота</Russian>
<French>Vers la place conducteur</French>
<Czech>Na místo pilota</Czech>
<!-- <Dutch></Dutch> -->
<!-- <German></German> -->
</Key>
<Key ID="STR_EPOCH_PLAYER_309">
<Original>To back seat</Original>
<English>To back seat</English>
<Spanish>Al asiento trasero</Spanish>
<Russian>Пересесть на место пассажира</Russian>
<French>Vers une place passager</French>
<Czech>Na zadní sedadlo</Czech>
<!-- <Dutch></Dutch> -->
<!-- <German></German> -->
</Key>
<Key ID="STR_EPOCH_PLAYER_310">
<Original>To gunner's seat</Original>
<English>To gunner's seat</English>
<Spanish>Al asiento del artillero</Spanish>
<Russian>Пересесть на место стрелка</Russian>
<French>Vers la place du tireur</French>
<Czech>Na sedadlo střelce</Czech>
<!-- <Dutch></Dutch> -->
<!-- <German></German> -->
</Key>
<Key ID="STR_EPOCH_PLAYER_311">
<Original>To commander's seat</Original>
<English>To commander's seat</English>
<Spanish>Para el asiento del comandante</Spanish>
<Russian>Чтобы сиденье командира</Russian>
<French>Pour le siège du commandant</French>
<Czech>Chcete-li sídlo velitele</Czech>
<!-- <Dutch></Dutch> -->
<!-- <German></German> -->
</Key>
<Key ID="STR_EPOCH_PLAYER_REPAIRV">
<Original>Repair Vehicle</Original>
<English>Repair Vehicle</English>