Fix ammo refill when switching skins and ...

- allow player to switch with backpack on.
- player_countmagazines now returns backpack magazines with ammo count.
Do with this as you like.
- Make sure dead players do not have to wait the abort (after the 5
seconds).
- Update changelog
This commit is contained in:
icomrade
2014-03-18 15:48:45 -04:00
parent 058519c926
commit ad2642a5f9
8 changed files with 161 additions and 78 deletions

View File

@@ -2,14 +2,16 @@
[ADDED] Latest version of Napf 1.0 by Momo
[ADDED] Classname C130J_US_EP1_DZ Weapon: 50 Magazine: 400 Backpack: 10 @Fank
[ADDED] Variable DZE_ForceNameTagsInTrader to force name tags in traders. @Skaronator @Fank
[ADDED] Switch seats in all vehicles. @icomrade
[FIXED] Instance already initialized error in server_monitor.sqf @vbawol
[FIXED] Fixed infinite chainsaw fuel when put into vaults/lockboxes. @SilvDev
[FIXED] Cargo Check overlapping. @SilvDev
[CHANGED] Lootsystem based on DayZ 1.8 @Skaronator @Fank
[CHANGED] Consum Eat/Drink in vehicle will add empty food/drink cans into vehicle inventory. @SilvDev @Fank
[CHANGED] Consume Eat/Drink in vehicle will add empty food/drink cans into vehicle inventory. @SilvDev @Fank
[CHANGED] SQL Removed empty fuel barrel from vehicle parts trader and moved to wholesaler as increased buy/sell price. @Fank
[CHANGED] You can switch skins with while wearing a backpack. @icomrade
[INFO] Models/textures by Paul Tomany. @Sequisha.
[INFO] Special thanks to http://verthosting.com for hosting our development server.

View File

@@ -1,55 +1,70 @@
/*
count player magazines with ammo count
value = call player_countmagazines;
value = call player_countMagazines; //must be called from a spawned thread (or use spawn)
return all player magazines with ammo count
Modified to save backpack magazine count by icomrade - Base for fix by Ziellos2k
*/
private ["_dialog","_control","_magazineArray","_item","_val","_max","_created"];
private ["_control","_item","_val","_max","_count","_magazineArray","_dialog"];
disableSerialization;
disableUserInput true;
_dialog = findDisplay 106;
_created = false;
if ( isNull _dialog ) then {
//startLoadingScreen [""];
createGearDialog [player, "RscDisplayGear"];
_dialog = findDisplay 106;
_created = true;
};
_magazineArray = [];
for "_i" from 109 to 120 do
{
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
_magazineArray = [[],[]];
_dialog = ["0"] call gearDialog_create;
if ((isNull _dialog) || (isNil "_dialog")) exitWith {disableUserInput false; (findDisplay 106) closeDisplay 0; closeDialog 0; _magazineArray};
//Main inventory
for "_i" from 109 to 120 do {
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
_magazineArray set [count _magazineArray,[_item,_val]];
(_magazineArray select 0) set [count (_magazineArray select 0),[_item,_val]];
} else {
_magazineArray set [count _magazineArray,_item];
(_magazineArray select 0) set [count (_magazineArray select 0),_item];
};
};
};
for "_i" from 122 to 129 do
{
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
//Pistol/secondary ammo
for "_i" from 122 to 129 do {
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
_magazineArray set [count _magazineArray,[_item,_val]];
(_magazineArray select 0) set [count (_magazineArray select 0),[_item,_val]];
} else {
_magazineArray set [count _magazineArray,_item];
(_magazineArray select 0) set [count (_magazineArray select 0),_item];
};
};
};
if ( _created ) then {
closeDialog 0;
//endLoadingScreen;
//backpack items
if ((typeOf (unitBackPack player)) != "") then {
_count = getNumber (configFile >> "CfgVehicles" >> (typeOf (unitBackpack Player)) >> "transportMaxMagazines");
ctrlActivate (_dialog displayCtrl 157);
if (gear_done) then {
waitUntil {ctrlShown (_dialog displayCtrl 159)};
sleep 0.001;
};
for "_i" from 5000 to (5000 + _count) do {
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
(_magazineArray select 1) set [count (_magazineArray select 1),[_item,_val]];
} else {
(_magazineArray select 1) set [count (_magazineArray select 1),_item];
};
};
};
};
disableUserInput false;
dayz_Magazines=_magazineArray;
(findDisplay 106) closeDisplay 0;
if (gear_done) then {sleep 0.001;};
_magazineArray

View File

@@ -21,7 +21,7 @@ if (!_hasclothesitem) exitWith { DZE_ActionInProgress = false; cutText [format[(
if (vehicle player != player) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_85"), "PLAIN DOWN"]};
if (!isNull (unitBackpack player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_9"), "PLAIN DOWN"] };
//if (!isNull (unitBackpack player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_9"), "PLAIN DOWN"] };
if ("CSGAS" in (magazines player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_10"), "PLAIN DOWN"] };

View File

@@ -21,6 +21,7 @@ if (!r_player_dead and time - dayz_lastCheckBit > 10) then {
call dayz_forceSave;
};
if (r_player_dead || (!alive player)) exitWith {_btnAbort ctrlEnable true; _btnAbort ctrlSetText _btnAbortText;};
_sleep = 1;
while {!isNull _display} do {

View File

@@ -1,25 +1,20 @@
private ["_class","_position","_dir","_group","_oldUnit","_newUnit","_currentWpn","_muzzles","_currentAnim","_playerUID","_weapons","_magazines","_primweapon","_secweapon","_playerObjName","_wpnType","_ismelee","_tagSetting"];
_class = _this;
private ["_weapons","_backpackWpn","_backpackMag","_currentWpn","_backpackWpnTypes","_backpackWpnQtys","_countr","_class","_position","_dir","_currentAnim","_tagSetting","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_oldUnit","_group","_newUnit","_playerObjName","_wpnType","_ismelee"];
_class = _this;
_position = getPosATL player;
_dir = getDir player;
_currentAnim = animationState player;
_tagSetting = player getVariable["DZE_display_name",false];
//Get PlayerID
_playerUID = getPlayerUID player;
//BackUp Weapons and Mags
_weapons = weapons player;
_magazines = call player_countmagazines; //magazines player;
_countMags = call player_countMagazines;
_magazines = _countMags select 0;
if ( (_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};
if ((_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};
_primweapon = primaryWeapon player;
_secweapon = secondaryWeapon player;
//Checks
if(!(_primweapon in _weapons) && _primweapon != "") then {
_weapons = _weapons + [_primweapon];
};
@@ -28,6 +23,14 @@ if(!(_secweapon in _weapons) && _secweapon != "") then {
_weapons = _weapons + [_secweapon];
};
//BackUp Backpack
dayz_myBackpack = unitBackpack player;
_newBackpackType = (typeOf dayz_myBackpack);
if(_newBackpackType != "") then {
_backpackWpn = getWeaponCargo unitBackpack player;
_backpackMag = _countMags select 1;
};
//Get Muzzle
_currentWpn = currentWeapon player;
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
@@ -46,7 +49,6 @@ _oldUnit = player;
/**********************************/
//Create New Character
//[player] joinSilent grpNull;
_group = createGroup west;
_newUnit = _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];
@@ -59,7 +61,7 @@ removeAllWeapons _newUnit;
//Equip New Charactar
{
if (typeName _x == "ARRAY") then {_newUnit addMagazine [_x select 0,_x select 1] } else { _newUnit addMagazine _x };
if (typeName _x == "ARRAY") then {if ((count _x) > 0) then {_newUnit addMagazine [(_x select 0), (_x select 1)]; }; } else { _newUnit addMagazine _x; };
} forEach _magazines;
{
@@ -82,7 +84,6 @@ if(str(_weapons) != str(weapons _newUnit)) then {
if(_primweapon != (primaryWeapon _newUnit)) then {
_newUnit addWeapon _primweapon;
};
if (_primweapon == "MeleeCrowbar") then {
_newUnit addMagazine 'crowbar_swing';
};
@@ -102,23 +103,51 @@ if (_primweapon == "MeleeFishingPole") then {
if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
_newUnit addWeapon _secweapon;
};
//Make New Unit Playable
addSwitchableUnit _newUnit;
setPlayable _newUnit;
selectPlayer _newUnit;
//Clear and delete old Unit
removeAllWeapons _oldUnit;
{_oldUnit removeMagazine _x;} forEach magazines _oldUnit;
deleteVehicle _oldUnit;
//Move player inside
if(_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
_switchUnit = {
addSwitchableUnit _newUnit;
setPlayable _newUnit;
selectPlayer _newUnit;
removeAllWeapons _oldUnit;
{_oldUnit removeMagazine _x;} forEach magazines _oldUnit;
deleteVehicle _oldUnit;
if(_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
};
//Add and Fill BackPack
if (!isNil "_newBackpackType") then {
if (_newBackpackType != "") then {
_newUnit addBackpack _newBackpackType;
dayz_myBackpack = unitBackpack _newUnit;
//Weapons
_backpackWpnTypes = [];
_backpackWpnQtys = [];
if (count _backpackWpn > 0) then {
_backpackWpnTypes = _backpackWpn select 0;
_backpackWpnQtys = _backpackWpn select 1;
};
[] call _switchUnit;
if (gear_done) then {sleep 0.001;};
["1"] call gearDialog_create;
//magazines
_countr = 0;
{
_countr = _countr + 1;
if ((typeName _x) != "STRING") then {
(unitBackpack player) addMagazineCargoGlobal [(_x select 0), 1];
_idc = 4999 + _countr;
_idc setIDCAmmoCount (_x select 1);
} else {
(unitBackpack player) addMagazineCargoGlobal [_x, 1];
};
} forEach _backpackMag;
(findDisplay 106) closeDisplay 0;
_countr = 0;
{
(unitBackpack player) addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
_countr = _countr + 1;
} forEach _backpackWpnTypes;
} else { [] call _switchUnit; };
} else { [] call _switchUnit; };
[objNull, player, rSwitchMove,_currentAnim] call RE;
//dayz_originalPlayer attachTo [_newUnit];
player disableConversation true;
//player setVariable ["bodyName",dayz_playerName,true]; //Outcommit (Issue #991) - Also removed in DayZ Mod 1.8

View File

@@ -288,6 +288,40 @@ if (!isDedicated) then {
};
};
gearDialog_create = {
private ["_i","_dialog"];
if (!isNull (findDisplay 106)) then {
(findDisplay 106) closeDisplay 0;
};
openMap false;
closeDialog 0;
if (gear_done) then {sleep 0.001;};
player action ["Gear", player];
if (gear_done) then {sleep 0.001;};
_dialog = findDisplay 106;
_i = 0;
while {isNull _dialog} do {//DO NOT CHANGE TO A FOR LOOP!
_i = _i + 1;
_dialog = findDisplay 106;
if (gear_done) then {sleep 0.001;};
if (_i in [100,200,299]) then {
closeDialog 0;
player action ["Gear", player];
};
if (_i > 300) exitWith {};
};
if (gear_done) then {sleep 0.001;};
_dialog = findDisplay 106;
if ((parseNumber(_this select 0)) != 0) then {
ctrlActivate (_dialog displayCtrl 157);
if (gear_done) then {
waitUntil {ctrlShown (_dialog displayCtrl 159)};
sleep 0.001;
};
};
_dialog
};
gear_ui_offMenu = {
private["_control","_parent","_menu"];
disableSerialization;

View File

@@ -15,6 +15,7 @@ Soldier1_DZ = "Soldier1_DZ";
Rocket_DZ = "Rocket_DZ";
AllPlayers = ["Survivor2_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ","SurvivorWsequishaD_DZ","SurvivorWsequisha_DZ","SurvivorWpink_DZ","SurvivorW3_DZ","SurvivorW2_DZ","Bandit1_DZ","Bandit2_DZ","BanditW1_DZ","BanditW2_DZ","Soldier_Crew_PMC","Sniper1_DZ","Camo1_DZ","Soldier1_DZ","Rocket_DZ","Rocker1_DZ","Rocker2_DZ","Rocker3_DZ","Rocker4_DZ","Priest_DZ","Functionary1_EP1_DZ","GUE_Commander_DZ","Ins_Soldier_GL_DZ","Haris_Press_EP1_DZ","Pilot_EP1_DZ","RU_Policeman_DZ","pz_policeman","pz_suit1","pz_suit2","pz_worker1","pz_worker2","pz_worker3","pz_doctor","pz_teacher","pz_hunter","pz_villager1","pz_villager2","pz_villager3","pz_priest","Soldier_TL_PMC_DZ","Soldier_Sniper_PMC_DZ","Soldier_Bodyguard_AA12_PMC_DZ","Drake_Light_DZ","CZ_Special_Forces_GL_DES_EP1_DZ","TK_INS_Soldier_EP1_DZ","TK_INS_Warlord_EP1_DZ","FR_OHara_DZ","FR_Rodriguez_DZ","CZ_Soldier_Sniper_EP1_DZ","Graves_Light_DZ","GUE_Soldier_MG_DZ","GUE_Soldier_Sniper_DZ","GUE_Soldier_Crew_DZ","GUE_Soldier_CO_DZ","GUE_Soldier_2_DZ","TK_Special_Forces_MG_EP1_DZ","TK_Soldier_Sniper_EP1_DZ","TK_Commander_EP1_DZ","RU_Soldier_Crew_DZ","INS_Lopotev_DZ","INS_Soldier_AR_DZ","INS_Soldier_CO_DZ","INS_Bardak_DZ","INS_Worker2_DZ"];
gear_done = false;
//Cooking
meatraw = [

View File

@@ -1,7 +1,7 @@
/*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Player Monitor">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,4346,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"init"};
item0[] = {"init",0,250,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"init"};
item1[] = {"isServer",4,218,50.000000,-350.000000,150.000000,-300.000000,0.000000,"isServer"};
item2[] = {"wait",2,250,50.000000,-275.000000,150.000000,-225.000000,0.000000,"wait"};
item3[] = {"Allow_Conn",4,218,50.000000,-200.000000,150.000000,-150.000000,0.000000,"Allow" \n "Conn"};
@@ -20,7 +20,7 @@ item15[] = {"Parse_Login",2,250,-75.000000,500.000000,25.000000,550.000000,0.000
item16[] = {"Hive_Bad",4,218,50.000000,500.000000,150.000000,550.000000,10.000000,"Hive" \n "Bad"};
item17[] = {"ERROR__Wrong_HIVE",2,250,175.000000,500.000000,275.000000,550.000000,0.000000,"ERROR:" \n "Wrong HIVE" \n "Version"};
item18[] = {"Hive_Ok",4,218,-175.000000,550.000000,-75.000000,600.000000,0.000000,"Hive" \n "Ok"};
item19[] = {"Phase_One",2,250,-75.000000,600.000000,25.000000,650.000000,0.000000,"Phase One"};
item19[] = {"Phase_One",2,4346,-75.000000,600.000000,25.000000,650.000000,0.000000,"Phase One"};
item20[] = {"Response",4,218,-175.000000,650.000000,-75.000000,700.000000,0.000000,"Response"};
item21[] = {"Phase_Two",2,250,-75.000000,700.000000,25.000000,750.000000,0.000000,"Phase Two"};
item22[] = {"Dead_Player",4,218,50.000000,700.000000,150.000000,750.000000,0.000000,"Dead" \n "Player"};
@@ -169,8 +169,8 @@ link85[] = {75,57};
link86[] = {76,78};
link87[] = {77,76};
link88[] = {78,57};
globals[] = {25.000000,1,0,0,0,640,480,1,143,6316128,1,-578.392273,577.375793,454.378448,-471.659088,1137,911,1};
window[] = {2,0,0,-1,-1,817,340,1618,59,3,1155};
globals[] = {25.000000,1,0,0,0,640,480,1,143,6316128,1,-629.823975,628.807434,621.934326,-518.250671,1137,1030,1};
window[] = {2,-1,-1,-1,-1,1018,260,1538,260,3,1155};
*//*%FSM</HEAD>*/
class FSM
{
@@ -194,7 +194,7 @@ class FSM
"_timeStart = diag_tickTime;" \n
"_readytoAuth = false;" \n
"_startCheck = 0;" \n
"_debug = DZEdebug;" \n
"_debug = DZEdebug;" \n
"" \n
"if (_debug) then {" \n
"diag_log (""DAYZ: CLIENT IS RUNNING DAYZ_CODE "" + str(dayz_versionNo));" \n
@@ -639,6 +639,7 @@ class FSM
init = /*%FSM<STATEINIT""">*/"dayz_playerName = name player;" \n
"_model call player_switchModel;" \n
"" \n
"gear_done= true;" \n
"player allowDamage false;" \n
"_lastAte = _survival select 1;" \n
"_lastDrank = _survival select 2;" \n