From 5a5ac0f8678b6f1e54b4eccdd3b3962ddd843431 Mon Sep 17 00:00:00 2001 From: Aaron Clark Date: Mon, 5 Nov 2012 16:11:06 -0600 Subject: [PATCH] 1.7.4 CE sync --- dayz_code/actions/dog/follow.sqf | 2 +- dayz_code/actions/dog/move.sqf | 5 + dayz_code/cfgVehicles.hpp | 16 +- dayz_code/compile/local_deleteObj.sqf | 3 +- dayz_code/compile/player_animalCheck.sqf | 5 +- dayz_code/compile/player_humanityMorph.sqf | 2 +- dayz_code/compile/player_tameDog.sqf | 15 + dayz_code/compile/vehicle_handleDamage.sqf | 2 +- dayz_code/compile/vehicle_handleKilled.sqf | 6 - dayz_code/init/compiles.sqf | 12 +- dayz_code/rscTitles.hpp | 37 +++ dayz_code/stringtable.xml | 2 +- dayz_code/system/dog_agent.fsm | 367 ++++++++++++++++++--- dayz_code/system/player_monitor.fsm | 4 +- 14 files changed, 408 insertions(+), 70 deletions(-) create mode 100644 dayz_code/actions/dog/move.sqf create mode 100644 dayz_code/compile/player_tameDog.sqf diff --git a/dayz_code/actions/dog/follow.sqf b/dayz_code/actions/dog/follow.sqf index 80c872f62..45f8c9970 100644 --- a/dayz_code/actions/dog/follow.sqf +++ b/dayz_code/actions/dog/follow.sqf @@ -9,5 +9,5 @@ if(_whistle) then { sleep 1; -_handle setFSMVariable ["_command","none"]; +_handle setFSMVariable ["_command","return"]; diff --git a/dayz_code/actions/dog/move.sqf b/dayz_code/actions/dog/move.sqf new file mode 100644 index 000000000..904f9d1a4 --- /dev/null +++ b/dayz_code/actions/dog/move.sqf @@ -0,0 +1,5 @@ +_array = _this select 3; +_handle = _array; + +_handle setFSMVariable ["_command","move"]; + diff --git a/dayz_code/cfgVehicles.hpp b/dayz_code/cfgVehicles.hpp index 7b98eea82..78bf318d3 100644 --- a/dayz_code/cfgVehicles.hpp +++ b/dayz_code/cfgVehicles.hpp @@ -1,5 +1,7 @@ class CfgVehicles { class Animal; + class Pastor; + class Fin; class DZAnimal: Animal { scope = 0; @@ -39,12 +41,24 @@ class CfgVehicles { class VariablesScalar {}; class VariablesString {}; }; - class Dog1 : DZAnimal { + class DZ_Pastor : Pastor { scope = 2; model = "\ca\animals2\Dogs\Pastor\Pastor"; displayName = "Alsatian"; moves = "CfgMovesDogDZ"; gestures = "CfgGesturesDogDZ"; + fsmDanger = ""; + fsmFormation = ""; + }; + + class DZ_Fin : Fin { + scope = 2; + model = "\ca\animals2\Dogs\Fin\Fin"; + displayName = "Fin"; + moves = "CfgMovesDogDZ"; + gestures = "CfgGesturesDogDZ"; + fsmDanger = ""; + fsmFormation = ""; }; class Soldier_Crew_PMC; diff --git a/dayz_code/compile/local_deleteObj.sqf b/dayz_code/compile/local_deleteObj.sqf index 8911e860e..eb89f0013 100644 --- a/dayz_code/compile/local_deleteObj.sqf +++ b/dayz_code/compile/local_deleteObj.sqf @@ -12,8 +12,7 @@ if (isServer) then { _key = format["CHILD:304:%1:",_id]; _key call server_hiveWrite; diag_log format["DELETE: Deleted by ID: %1",_id]; - }; - if (parseNumber _uid > 0) then { + } else { //Send request _key = format["CHILD:310:%1:",_uid]; _key call server_hiveWrite; diff --git a/dayz_code/compile/player_animalCheck.sqf b/dayz_code/compile/player_animalCheck.sqf index 518cccdd6..7e9652ccd 100644 --- a/dayz_code/compile/player_animalCheck.sqf +++ b/dayz_code/compile/player_animalCheck.sqf @@ -3,7 +3,7 @@ _list = getposATL player nearEntities [["CAAnimalBase"],dayz_animalDistance]; if (count _list < dayz_maxAnimals) then { //Find where animal likes - _animalssupported = ["hen","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit"]; + _animalssupported = ["hen","Cow","Sheep","WildBoar","WildBoar","WildBoar","Goat","Rabbit","Rabbit","Fin", "Pastor"]; _type = (_animalssupported select floor(random(count _animalssupported))); if (_type == "Cow") then { _animalssupported = ["Cow01","Cow02","Cow03","Cow04"]; @@ -32,6 +32,9 @@ if (count _list < dayz_maxAnimals) then { _agent = createAgent [_type, _Pos, [], 0, "FORM"]; _agent setpos _Pos; _id = [_pos,_agent] execFSM "\z\addons\dayz_code\system\animal_agent.fsm"; + if (_type == "Fin" || _type == "Pastor") then { + _tame = _agent addAction ["Tame Dog", "\z\addons\dayz_code\compile\player_tameDog.sqf"]; + }; }; sleep 1; };z \ No newline at end of file diff --git a/dayz_code/compile/player_humanityMorph.sqf b/dayz_code/compile/player_humanityMorph.sqf index 0723584c6..9271e49c6 100644 --- a/dayz_code/compile/player_humanityMorph.sqf +++ b/dayz_code/compile/player_humanityMorph.sqf @@ -54,7 +54,7 @@ if (count _medical > 0) then { // player setVariable ["hit_legs",(_fractures select 0),true]; // player setVariable ["hit_hands",(_fractures select 1),true]; [player,"legs", (_fractures select 0)] call object_setHit; - [player,"hands", (_fractures select 0)] call object_setHit; + [player,"hands", (_fractures select 1)] call object_setHit; } else { //Reset Fractures player setVariable ["hit_legs",0,true]; diff --git a/dayz_code/compile/player_tameDog.sqf b/dayz_code/compile/player_tameDog.sqf new file mode 100644 index 000000000..a28ff401e --- /dev/null +++ b/dayz_code/compile/player_tameDog.sqf @@ -0,0 +1,15 @@ +private["_target", "_caller", "_id", "_params", "_pos"]; +_target = _this select 0; +_caller = _this select 1; +_id = _this select 2; +_params = _this select 3; +_pos = position _target; + +deleteVehicle (_this select 0); +_dog = (group player) createUnit [format["DZ_%1", typeOf _target], _pos, [], 0, "FORM"]; +_dog disableAI "FSM"; +_fsmid = [_dog, (count units group _caller)] execFSM "\z\addons\dayz_code\system\dog_agent.fsm"; +_fsmid setFSMVariable ["_handle", _fsmid]; +_target removeAction _id; + +//handle publicVariables here later. diff --git a/dayz_code/compile/vehicle_handleDamage.sqf b/dayz_code/compile/vehicle_handleDamage.sqf index 1a284412f..d6b7fa45f 100644 --- a/dayz_code/compile/vehicle_handleDamage.sqf +++ b/dayz_code/compile/vehicle_handleDamage.sqf @@ -29,7 +29,7 @@ if (_dam < 1 ) then { dayzUpdateVehicle call server_updateObject; }; } else { - publicVariable "dayzUpdateVehicle"; + publicVariableServer "dayzUpdateVehicle"; }; }; }; diff --git a/dayz_code/compile/vehicle_handleKilled.sqf b/dayz_code/compile/vehicle_handleKilled.sqf index 4392bb3d0..f1d498fb7 100644 --- a/dayz_code/compile/vehicle_handleKilled.sqf +++ b/dayz_code/compile/vehicle_handleKilled.sqf @@ -3,12 +3,6 @@ private["_unit","_selection","_killer"]; _unit = _this select 0; _killer = _this select 1; -// Prevent spazzing out vehicles from spamming server/MySQL -_waskilled = _unit getVariable ['waskilled', 0]; -if (_waskilled) exitWith{}; - -_unit setVariable ['waskilled', 1, true]; - _hitPoints = _unit call vehicle_getHitpoints; { _selection = getText (configFile >> "CfgVehicles" >> (typeof _unit) >> "HitPoints" >> _x >> "name"); diff --git a/dayz_code/init/compiles.sqf b/dayz_code/init/compiles.sqf index 6a4c1971f..e7214d625 100644 --- a/dayz_code/init/compiles.sqf +++ b/dayz_code/init/compiles.sqf @@ -46,6 +46,7 @@ if (!isDedicated) then { player_alertZombies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_alertZombies.sqf"; player_fireMonitor = compile preprocessFileLineNumbers "\z\addons\dayz_code\system\fire_monitor.sqf"; //player_combatLogged = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_combatLogged.sqf"; + player_tameDog = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_tameDog.sqf"; //Objects object_roadFlare = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_roadFlare.sqf"; @@ -120,7 +121,7 @@ if (!isDedicated) then { }; ui_initDisplay = { - private["_control","_ctrlBleed","_display","_ctrlFracture"]; + private["_control","_ctrlBleed","_display","_ctrlFracture","_ctrlDogFood","_ctrlDogWater","_ctrlDogWaterBorder", "_ctrlDogFoodBorder"]; disableSerialization; _display = uiNamespace getVariable 'DAYZ_GUI_display'; _control = _display displayCtrl 1204; @@ -133,6 +134,15 @@ if (!isDedicated) then { _ctrlFracture = _display displayCtrl 1203; _ctrlFracture ctrlShow false; }; + _ctrlDogFoodBorder = _display displayCtrl 1501; + _ctrlDogFoodBorder ctrlShow false; + _ctrlDogFood = _display displayCtrl 1701; + _ctrlDogFood ctrlShow false; + + _ctrlDogWaterBorder = _display displayCtrl 1502; + _ctrlDogWaterBorder ctrlShow false; + _ctrlDogWater = _display displayCtrl 1702; + _ctrlDogWater ctrlShow false }; dayz_losCheck = { diff --git a/dayz_code/rscTitles.hpp b/dayz_code/rscTitles.hpp index e14f826ce..bc1d56d4d 100644 --- a/dayz_code/rscTitles.hpp +++ b/dayz_code/rscTitles.hpp @@ -1113,6 +1113,24 @@ class RscTitles w = 0.06; h = 0.08; }; + class RscPicture_1501: RscPictureGUI + { + idc = 1501; + text = "\z\addons\dayz_code\gui\status_food_border_ca.paa"; + x = 0.945313 * safezoneW + safezoneX; + y = 0.95 * safezoneH + safezoneY; //1 + w = 0.04; + h = 0.053333; + }; + class RscPicture_1502: RscPictureGUI + { + idc = 1502; + text = "\z\addons\dayz_code\gui\status_thirst_border_ca.paa"; + x = 0.945313 * safezoneW + safezoneX; + y = 0.816666 * safezoneH + safezoneY; //3 + w = 0.04; + h = 0.053333; + }; }; class Controls{ class RscPicture_1301: RscPictureGUI @@ -1187,6 +1205,25 @@ class RscTitles w = 0.06; h = 0.08; }; + class RscPicture_1701: RscPictureGUI + + { + idc = 1701; + text = "\z\addons\dayz_code\gui\status_food_inside_ca.paa"; + x = 0.945313 * safezoneW + safezoneX; + y = 0.95 * safezoneH + safezoneY; + w = 0.04; + h = 0.053333; + }; + class RscPicture_1702: RscPictureGUI + { + idc = 1702; + text = "\z\addons\dayz_code\gui\status_thirst_inside_ca.paa"; + x = 0.945313 * safezoneW + safezoneX; + y = 0.816666 * safezoneH + safezoneY; + w = 0.04; + h = 0.053333; + }; }; }; }; \ No newline at end of file diff --git a/dayz_code/stringtable.xml b/dayz_code/stringtable.xml index efff96a27..36bb65f91 100644 --- a/dayz_code/stringtable.xml +++ b/dayz_code/stringtable.xml @@ -443,7 +443,7 @@ Please select the gender you wish to play as. Your gender will be bound to this unique character and cannot be changed until you die. Please select the gender you wish to play as. Your gender will be bound to this unique character and cannot be changed until you die. Bitte wählen Sie das Geschlecht, die Sie als zu spielen. Ihr Geschlecht wird zu dieser einzigartigen Charakter gebunden und kann nicht geändert werden, bis Sie sterben. - Пожалуйста, выберите пол вы хотите играть. Ваш пол будет связано с этим уникальным характером и не может быть изменено, пока не умрешь. + Пожалуйста, выберите пол вашего персонажа. Учтите, вы не сможете изменить его в течении игры, до тех пор, пока не погибнете. MALE diff --git a/dayz_code/system/dog_agent.fsm b/dayz_code/system/dog_agent.fsm index 9618c83f2..315448772 100644 --- a/dayz_code/system/dog_agent.fsm +++ b/dayz_code/system/dog_agent.fsm @@ -63,6 +63,20 @@ item58[] = {"",7,210,370.999969,95.999992,379.000000,104.000000,0.000000,""}; item59[] = {"",7,210,171.000000,96.000000,179.000000,104.000000,0.000000,""}; item60[] = {"",7,210,58.500000,96.000000,66.500000,104.000000,0.000000,""}; item61[] = {"",7,210,546.000000,321.000000,554.000000,329.000000,0.000000,""}; +item62[] = {"move",4,218,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"move"}; +item63[] = {"Get_Position",2,250,50.000000,-350.000000,150.000000,-300.000000,0.000000,"Get Position"}; +item64[] = {"valid_position",4,218,50.000000,-425.000000,150.000000,-375.000000,0.000000,"valid position"}; +item65[] = {"Moving_1",2,250,175.000000,-425.000000,275.000000,-375.000000,0.000000,"Moving"}; +item66[] = {"no_position",4,218,50.000000,-275.000000,150.000000,-225.000000,0.000000,"no position"}; +item67[] = {"Panda",2,250,175.000000,-275.000000,275.000000,-225.000000,0.000000,"Panda"}; +item68[] = {"commanded",4,218,175.000000,-350.000000,275.000000,-300.000000,0.000000,"commanded"}; +item69[] = {"",7,210,221.000000,-179.000000,229.000000,-171.000000,0.000000,""}; +item70[] = {"lost",4,218,300.000000,-425.000000,400.000000,-375.000000,0.000000,"lost"}; +item71[] = {"call_back",4,218,300.000000,-275.000000,400.000000,-225.000000,0.000000,"call back"}; +item72[] = {"Wander",2,250,300.000000,-350.000000,400.000000,-300.000000,0.000000,"Wander"}; +item73[] = {"In_Position",4,218,425.000000,-275.000000,525.000000,-225.000000,1.000000,"In Position"}; +item74[] = {"",7,210,171.000015,-154.000000,178.999985,-146.000000,0.000000,""}; +item75[] = {"",7,210,321.000000,-154.000031,329.000000,-145.999969,0.000000,""}; link0[] = {0,7}; link1[] = {1,9}; link2[] = {2,3}; @@ -103,48 +117,68 @@ link36[] = {25,11}; link37[] = {26,24}; link38[] = {27,31}; link39[] = {28,27}; -link40[] = {29,37}; -link41[] = {29,38}; -link42[] = {29,46}; -link43[] = {30,40}; -link44[] = {31,32}; -link45[] = {31,36}; -link46[] = {32,29}; -link47[] = {33,41}; -link48[] = {34,35}; -link49[] = {35,43}; -link50[] = {36,33}; -link51[] = {36,58}; -link52[] = {37,30}; -link53[] = {37,36}; -link54[] = {38,39}; -link55[] = {39,42}; -link56[] = {40,41}; -link57[] = {41,34}; -link58[] = {42,55}; -link59[] = {42,56}; -link60[] = {43,44}; -link61[] = {44,45}; -link62[] = {45,48}; -link63[] = {46,29}; -link64[] = {47,48}; -link65[] = {48,6}; -link66[] = {49,11}; -link67[] = {50,51}; -link68[] = {51,5}; -link69[] = {52,13}; -link70[] = {52,16}; -link71[] = {53,54}; -link72[] = {54,15}; -link73[] = {55,42}; -link74[] = {56,57}; -link75[] = {57,37}; -link76[] = {58,59}; -link77[] = {59,60}; -link78[] = {60,13}; -link79[] = {61,24}; -globals[] = {25.000000,1,0,0,0,640,480,1,169,6316128,1,-360.074860,721.091919,670.563354,-317.706665,1094,1000,1}; -window[] = {2,-1,-1,-1,-1,1211,210,1418,210,3,1116}; +link40[] = {28,62}; +link41[] = {29,37}; +link42[] = {29,38}; +link43[] = {29,46}; +link44[] = {30,40}; +link45[] = {31,32}; +link46[] = {31,36}; +link47[] = {32,29}; +link48[] = {33,41}; +link49[] = {34,35}; +link50[] = {35,43}; +link51[] = {36,33}; +link52[] = {36,58}; +link53[] = {37,30}; +link54[] = {37,36}; +link55[] = {38,39}; +link56[] = {39,42}; +link57[] = {40,41}; +link58[] = {41,34}; +link59[] = {42,55}; +link60[] = {42,56}; +link61[] = {43,69}; +link62[] = {44,45}; +link63[] = {45,48}; +link64[] = {46,29}; +link65[] = {47,48}; +link66[] = {48,6}; +link67[] = {49,11}; +link68[] = {50,51}; +link69[] = {51,5}; +link70[] = {52,13}; +link71[] = {52,16}; +link72[] = {53,54}; +link73[] = {54,15}; +link74[] = {55,42}; +link75[] = {56,57}; +link76[] = {57,37}; +link77[] = {58,59}; +link78[] = {59,60}; +link79[] = {60,13}; +link80[] = {61,24}; +link81[] = {62,63}; +link82[] = {63,64}; +link83[] = {63,66}; +link84[] = {64,65}; +link85[] = {65,68}; +link86[] = {65,70}; +link87[] = {65,74}; +link88[] = {66,67}; +link89[] = {67,69}; +link90[] = {68,67}; +link91[] = {69,44}; +link92[] = {70,72}; +link93[] = {71,67}; +link94[] = {72,71}; +link95[] = {72,73}; +link96[] = {72,75}; +link97[] = {73,72}; +link98[] = {74,13}; +link99[] = {75,74}; +globals[] = {25.000000,1,0,0,0,640,480,1,201,6316128,1,-335.377930,726.206177,762.469299,-723.096069,651,911,1}; +window[] = {2,-1,-1,-1,-1,1151,150,1358,150,3,669}; *//*%FSM*/ class FSM { @@ -156,6 +190,7 @@ class FSM { name = "init"; init = /*%FSM*/"_dog = _this select 0;" \n + "_num = _this select 1;" \n "_standing = true;" \n "_command = ""none"";" \n "_forceWalk = false;" \n @@ -168,6 +203,7 @@ class FSM "_target setVariable ['forceWalk',false];" \n "_lastPos = [0,0,0];" \n "_move = """";" \n + "_movePos = [];" \n "_watchDog = true;" \n "_idleTime = 5;" \n "_coolDown = 0;" \n @@ -178,7 +214,7 @@ class FSM "" \n "_actionDir = ""\z\addons\dayz_code\actions\dog\"";" \n "" \n - "_speedVal = [1,4,-1];"/*%FSM*/; + "_speedVal = [1,6,-1];"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -279,6 +315,16 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class move + { + priority = 0.000000; + to="Get_Position"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command == ""move"""/*%FSM*/; + action=/*%FSM*/"_command = ""none"";"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class close { @@ -349,6 +395,16 @@ class FSM action=/*%FSM*/""/*%FSM*/; }; /*%FSM*/ + /*%FSM*/ + class move + { + priority = 0.000000; + to="Get_Position"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command == ""move"""/*%FSM*/; + action=/*%FSM*/"_command = ""none"";"/*%FSM*/; + }; + /*%FSM*/ /*%FSM*/ class master_moved { @@ -472,6 +528,7 @@ class FSM "" \n "player removeAction _actionSpeedStealth;" \n "player removeAction _actionSpeedFree;" \n + "" \n "if(!isNil ""_actionCall"") then {" \n " player removeAction _actionCall;" \n "};"/*%FSM*/; @@ -580,7 +637,13 @@ class FSM " _dog forceSpeed (_speedVal select _maxSpeed);" \n " _forceChange = false;" \n "};" \n - "_waitTime = time;"/*%FSM*/; + "" \n + "" \n + "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n + "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n + "" \n + "_waitTime = time;" \n + ""/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -601,7 +664,7 @@ class FSM to="reset_1"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command != ""track"""/*%FSM*/; - action=/*%FSM*/"if (_command == ""none"") then {" \n + action=/*%FSM*/"if (_command == ""return"") then {" \n " if ((player distance _dog > 5) and (_watchDog)) then {" \n " _dog playActionNow ""GestureBark"";" \n " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n @@ -650,7 +713,6 @@ class FSM { name = "Checking"; init = /*%FSM*/"_dog removeAction _actionTrack;" \n - "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n "_lastPos = position _dog;" \n "" \n "_list = (position _dog) nearEntities [""Animal"",(_senseSkill * 3)];" \n @@ -705,7 +767,14 @@ class FSM { name = "reset_1"; init = /*%FSM*/"_actionTrack = _dog addAction [""Track"",_actionDir + ""track.sqf"",_handle, 4, true, true];" \n - "player removeAction _actionCall;"/*%FSM*/; + "" \n + "if(!isNil ""_actionFollow"") then {" \n + " _dog removeAction _actionFollow;" \n + "};" \n + "" \n + "if(!isNil ""_actionCall"") then {" \n + " player removeAction _actionCall;" \n + "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; class Links { @@ -754,7 +823,7 @@ class FSM to="Reset_1"; precondition = /*%FSM*/""/*%FSM*/; condition=/*%FSM*/"_command != ""track"""/*%FSM*/; - action=/*%FSM*/"if (_command == ""none"") then {" \n + action=/*%FSM*/"if (_command == ""return"") then {" \n " if ((player distance _dog > 5) and (_watchDog)) then {" \n " _dog playActionNow ""GestureBark"";" \n " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n @@ -792,21 +861,35 @@ class FSM class action_init { name = "action_init"; - init = /*%FSM*/"_actionStay = _dog addAction [""Stay"",_actionDir + ""stay.sqf"",_handle, 5, true, true];" \n + init = /*%FSM*/"_actionFood = _dog addAction [""Feed"",_actionDir + ""feed.sqf"",[_handle,0], 1, false, false,"""",""'FoodSteakRaw' in magazines player;""];" \n + "_actionWater = _dog addAction [""Water"",_actionDir + ""feed.sqf"",[_handle,1], 1, false, false,"""",""'ItemWaterbottle' in magazines player;""];" \n + "_actionStay = _dog addAction [""Stay"",_actionDir + ""stay.sqf"",_handle, 5, true, true];" \n "_actionTrack = _dog addAction [""Track"",_actionDir + ""track.sqf"",_handle, 4, true, true];" \n "_actionBark = _dog addAction [""Speak"",_actionDir + ""speak.sqf"",_handle, 3, false, false];" \n "_actionWarn = _dog addAction [""Alert"",_actionDir + ""warn.sqf"",[_handle,true], 2, false, true];" \n - "_actionFood = _dog addAction [""Feed"",_actionDir + ""feed.sqf"",[_handle,0], 1, false, false,"""",""'FoodSteakRaw' in magazines player;""];" \n - "_actionWater = _dog addAction [""Water"",_actionDir + ""feed.sqf"",[_handle,1], 1, false, false,"""",""'ItemWaterbottle' in magazines player;""];" \n "" \n - "_actionSpeedStealth = player addAction [""Slow Down"",_actionDir + ""speed.sqf"",[_handle,true,true], 0, false, false];" \n - "_actionSpeedFree = player addAction [""Speed Up"",_actionDir + ""speed.sqf"",[_handle,true,false], 0, false, false];" \n + "_actionMove = player addAction [""Move To"", _actionDir + ""move.sqf"", _handle, 0, false, false];" \n + "_actionSpeedStealth = player addAction [""Walk"", _actionDir + ""speed.sqf"",[_handle,true,true], 0, false, false, """", ""_maxSpeed == 1;""];" \n + "_actionSpeedFree = player addAction [""Run"", _actionDir + ""speed.sqf"",[_handle,true,false], 0, false, false, """", ""_maxSpeed == 0;""];" \n "" \n "_heartbeat = [_dog,_handle] spawn {" \n + " disableSerialization;" \n + "" \n " _dog = _this select 0;" \n " _handle = _this select 1;" \n " _handle setFSMVariable [""_thirst"",0];" \n " _handle setFSMVariable [""_hunger"",0];" \n + " " \n + " _display = uiNamespace getVariable 'DAYZ_GUI_display';" \n + " _ctrlDogFood = _display displayCtrl 1701;" \n + " _ctrlDogFood ctrlShow true;" \n + " _ctrlDogFoodBorder = _display displayCtrl 1501;" \n + " _ctrlDogFoodBorder ctrlShow true;" \n + " _ctrlDogWater = _display displayCtrl 1702;" \n + " _ctrlDogWater ctrlShow true;" \n + " _ctrlDogWaterBorder = _display displayCtrl 1502;" \n + " _ctrlDogWaterBorder ctrlShow true;" \n + " " \n " while {alive _dog} do {" \n " _vel = velocity _dog;" \n " _speed = [0,0,0] distance _vel;" \n @@ -814,6 +897,29 @@ class FSM " _hunger = _handle getFSMVariable ""_hunger"";" \n " _thirst = _thirst + (0.001 * dayz_scaleLight * _speed) + 0.001;" \n " _hunger = _hunger + (0.001 * _speed) + 0.001;" \n + " _foodVal = 1 - (_hunger / SleepFood);" \n + " _thirstVal = 1 - (_thirst / SleepWater);" \n + " " \n + " _ctrlDogFood ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_foodVal))),(Dayz_GUI_G * _foodVal),(Dayz_GUI_B * _foodVal), 0.5];" \n + " _ctrlDogWater ctrlSetTextColor [(Dayz_GUI_R + (0.3 * (1-_thirstVal))),(Dayz_GUI_G * _thirstVal),(Dayz_GUI_B * _thirstVal), 0.5];" \n + " " \n + " if (_foodVal < 0.2) then {" \n + " _ctrlDogFood call player_guiControlFlash;" \n + " };" \n + " if (_thirstVal < 0.2) then {" \n + " _ctrlDogWater call player_guiControlFlash;" \n + " };" \n + "" \n + " if (_foodVal <= 0 || _thirstVal <= 0) then {" \n + " _cantSee = [player, _dog] call dayz_losCheck;" \n + " while {alive _dog && !(_cantSee)} do {" \n + " _dog doMove [0, ((random (10000)) + 1000), 0];" \n + " sleep 2;" \n + " _cantSee = [player, _dog] call dayz_losCheck;" \n + " };" \n + " deleteVehicle _dog;" \n + " }; " \n + " " \n " _handle setFSMVariable [""_thirst"",_thirst];" \n " _handle setFSMVariable [""_hunger"",_hunger];" \n " sleep 0.5;" \n @@ -838,6 +944,161 @@ class FSM }; }; /*%FSM*/ + /*%FSM*/ + class Get_Position + { + name = "Get_Position"; + init = /*%FSM*/"_movePos = screenToWorld [0.5, 0.5];"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class no_position + { + priority = 0.000000; + to="Panda"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(count _movePos == 0)" \n + ""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class valid_position + { + priority = 0.000000; + to="Moving_1"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(count _movePos > 0)" \n + ""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Moving_1 + { + name = "Moving_1"; + init = /*%FSM*/"_dog doMove _movePos;" \n + "_dog forceSpeed (_speedVal select _maxSpeed);" \n + "_forceChange = false;" \n + "" \n + "_actionFollow = _dog addAction [""Follow Me"", _actionDir + ""follow.sqf"",[_handle,false], 0, true, true];" \n + "_actionCall = player addAction [""Call Dog"", _actionDir + ""follow.sqf"",[_handle,true], 0, false, true];" \n + "" \n + "_waitTime = time;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class lost + { + priority = 0.000000; + to="Wander"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"(((time - _waitTime) > 60)&& (player distance _dog > 100))"/*%FSM*/; + action=/*%FSM*/"_pos = position _dog;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class dead + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class commanded + { + priority = 0.000000; + to="Panda"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command != ""none"""/*%FSM*/; + action=/*%FSM*/"if (_command == ""none"") then {" \n + " if ((player distance _dog > 5) and (_watchDog)) then {" \n + " _dog playActionNow ""GestureBark"";" \n + " [_dog,""dog_bark"",0,false] call dayz_zombieSpeak;" \n + " };" \n + "};"/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Panda + { + name = "Panda"; + init = /*%FSM*/"if(!isNil ""_actionFollow"") then {" \n + " _dog removeAction _actionFollow;" \n + "};" \n + "" \n + "if(!isNil ""_actionCall"") then {" \n + " player removeAction _actionCall;" \n + "};"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class true + { + priority = 0.000000; + to="Waiting"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"true"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ + /*%FSM*/ + class Wander + { + name = "Wander"; + init = /*%FSM*/"_isAlive = alive _dog;"/*%FSM*/; + precondition = /*%FSM*/""/*%FSM*/; + class Links + { + /*%FSM*/ + class In_Position + { + priority = 1.000000; + to="Wander"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_dog distance _pos < 3"/*%FSM*/; + action=/*%FSM*/"_pos = [(getPos _dog),10,90,4,0,5,0] call BIS_fnc_findSafePos;" \n + "_dog moveTo _pos;"/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class dead + { + priority = 0.000000; + to="End"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"!(alive _dog)"/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + /*%FSM*/ + class call_back + { + priority = 0.000000; + to="Panda"; + precondition = /*%FSM*/""/*%FSM*/; + condition=/*%FSM*/"_command == ""return"""/*%FSM*/; + action=/*%FSM*/""/*%FSM*/; + }; + /*%FSM*/ + }; + }; + /*%FSM*/ }; initState="init"; finalStates[] = diff --git a/dayz_code/system/player_monitor.fsm b/dayz_code/system/player_monitor.fsm index 096f53f74..e2c7fd9ca 100644 --- a/dayz_code/system/player_monitor.fsm +++ b/dayz_code/system/player_monitor.fsm @@ -1062,12 +1062,12 @@ class FSM "dayz_slowCheck = [] spawn player_spawn_2;" \n "" \n "_world = toUpper(worldName); //toUpper(getText (configFile >> ""CfgWorlds"" >> (worldName) >> ""description""));" \n - "_nearestCity = (nearestLocations [getPos player, [""NameCityCapital"",""NameCity"",""NameVillage"",""NameLocal""],1000] select 0);" \n + "_nearestCity = nearestLocations [getPos player, [""NameCityCapital"",""NameCity"",""NameVillage"",""NameLocal""],1000];" \n "_town = ""Wilderness"";" \n "" \n "diag_log (""NearestCity"" + str(_nearestCity));" \n "" \n - "if (!isNull _nearestCity) then {_town = text _nearestCity};" \n + "if (count _nearestCity > 0) then {_town = text (_nearestCity select 0)};" \n "" \n "_strTime = call curTimeStr;" \n "_strDate = date;" \n