interact actions updates

added action 16 that will repair most damaged player hitpoint and give
attributes
_unifiedInteract function now returns bool based on if item was removed.
added attributes to other new items
NOTE: will consider a digest system for 1.1
This commit is contained in:
vbawol 2017-10-04 11:17:41 -05:00
parent 46d6b042f5
commit 70b5f02011
2 changed files with 65 additions and 40 deletions

View File

@ -42,7 +42,8 @@ if (_inputCount >= 3) then {
_removeItem = {([player,_this] call BIS_fnc_invRemove) == 1}; _removeItem = {([player,_this] call BIS_fnc_invRemove) == 1};
_unifiedInteract = { _unifiedInteract = {
if (_item call _removeItem) then { private _removed = _item call _removeItem;
if (_removed) then {
if (_interactReturnOnUse != "") then { if (_interactReturnOnUse != "") then {
_interactReturnOnUse call EPOCH_fnc_addItemOverflow; _interactReturnOnUse call EPOCH_fnc_addItemOverflow;
}; };
@ -53,6 +54,7 @@ _unifiedInteract = {
}; };
} foreach _interactAttributes; } foreach _interactAttributes;
}; };
_removed
}; };
switch _interactOption do { switch _interactOption do {
@ -288,18 +290,16 @@ switch _interactOption do {
case 13: { //Heal Player case 13: { //Heal Player
_vehicles = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 6]; _vehicles = player nearEntities[["Epoch_Male_F", "Epoch_Female_F"], 6];
_vehicle = cursorTarget; _vehicle = cursorTarget;
if (_vehicle in _vehicles) then { if !(_vehicle in _vehicles) then {
if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then { _vehicle = player;
if (_item call _removeItem) then { };
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then {
["Healed other player", 5] call Epoch_message; if (_item call _removeItem) then {
}; [_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
}; if (_vehicle isEqualTo player) then {
} else {
if (damage player != 0 || {_x > 0} count ((getallhitpointsdamage player) select 2) > 0) then {
if (_item call _removeItem) then {
[player,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
["Healed yourself", 5] call Epoch_message; ["Healed yourself", 5] call Epoch_message;
} else {
["Healed other player", 5] call Epoch_message;
}; };
}; };
}; };
@ -323,6 +323,34 @@ switch _interactOption do {
}; };
}; };
case 16: { //Heal hitpoint with most damage first
_vehicle = player;
if (damage _vehicle != 0 || {_x > 0} count ((getallhitpointsdamage _vehicle) select 2) > 0) then {
if (call _unifiedInteract) then {
_highestDMG = 0;
_currentHIT = -1;
_currentDMG = 0;
{
_currentDMG = _x;
if (_currentDMG > _highestDMG) then {
_highestDMG = _currentDMG;
_currentHIT = _forEachIndex;
};
}forEach ((getAllHitPointsDamage _vehicle) param [2,[]]);
if (_highestDMG > 0) then {
_newDMG = ((_highestDMG - 0.5) max 0);
[_vehicle,[[_currentHIT,_newDMG]],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
} else {
if ((damage _vehicle) > 0) then {
[_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2];
};
};
private _itemName = _item call EPOCH_itemDisplayName;
[format["Used %1 on yourself",_itemName], 5] call Epoch_message;
};
};
};
default { default {
["Found nothing", 5] call Epoch_message; ["Found nothing", 5] call Epoch_message;
}; };

View File

@ -172,7 +172,7 @@ class CfgItemInteractions
}; };
class WhiskeyNoodle : Drink_base class WhiskeyNoodle : Drink_base
{ {
interactAttributes[] = {{"Thirst",800},{"Toxicity",-1},{"Radiation",-1},{"Stamina",50},{"Alcohol",10}}; interactAttributes[] = {{"Thirst",400},{"Toxicity",-1},{"Radiation",-1},{"Stamina",50},{"Alcohol",10},{"BloodP",1}};
}; };
class water_epoch : Drink_Jar_base class water_epoch : Drink_Jar_base
{ {
@ -538,7 +538,7 @@ class CfgItemInteractions
{ {
interactAction = 6; interactAction = 6;
interactText = "USE"; interactText = "USE";
interactAttributes[] = {{"Toxicity",-50}}; interactAttributes[] = {{"Toxicity",-5}};
}; };
class Pumpkin : Default class Pumpkin : Default
{ {
@ -862,42 +862,39 @@ class CfgItemInteractions
class ItemBottlePlastic_Dirty: Drink_base class ItemBottlePlastic_Dirty: Drink_base
{ {
interactAttributes[] = {{"Thirst",500},{"Toxicity",5,1},{"Stamina",50},{"Radiation",2,1}}; interactAttributes[] = {{"Thirst",500},{"Toxicity",5,1},{"Stamina",50},{"Radiation",2,1}};
interactReturnOnUse = "ItemBottlePlastic_Empty"; interactReturnOnUse = "ItemBottlePlastic_Empty";
}; };
class ItemCanteen_Dirty : Drink_base class ItemCanteen_Dirty : Drink_base
{ {
interactAttributes[] = {{"Thirst",1000},{"Toxicity",5,1},{"Stamina",50},{"Radiation",2,1}}; interactAttributes[] = {{"Thirst",1000},{"Toxicity",5,1},{"Stamina",50},{"Radiation",2,1}};
interactReturnOnUse = "ItemCanteen_Empty"; interactReturnOnUse = "ItemCanteen_Empty";
}; };
class adrenaline_epoch : FAK class adrenaline_epoch : Drink_base
{ {
interactAction = 13; // Radiation consume item action needed interactText = "USE"; // todo digest system to give attributes over time
interactAttributes[] = {{"Thirst",-50},{"Stamina",120},{"BloodP",20},{"Toxicity",5}};
};
class atropine_epoch : Drink_base
{
interactText = "USE"; // todo digest system to give attributes over time
interactAttributes[] = {{"Thirst",-50},{"Stamina",-20},{"Toxicity",-5},{"Immunity",-1}};
};
class morphine_epoch : Default
{
interactAction = 16; // currently heals most damaged hitpoint first on self and gives attributes
interactText = "USE"; interactText = "USE";
interactAttributes[] = {{"Thirst",-20},{"Stamina",-50},{"Toxicity",5},{"BloodP",5}};
}; };
class atropine_epoch : FAK class caffeinepills_epoch : Food_base
{ {
interactAction = 13; // Radiation consume item action needed // todo digest system to give attributes over time (some type of boost system is needed as well as new action to feed it)
interactText = "USE"; interactAttributes[] = {{"Thirst",-20},{"Stamina",50},{"Toxicity",1}};
}; };
class morphine_epoch : FAK class orlistat_epoch : Food_base
{ {
interactAction = 13; // part specific healing action needed // todo should reduce hunger downtick for a duration, if too much is taken causes bowel issues?
interactText = "USE"; interactAttributes[] = {{"Thirst",-20},{"Hunger",25},{"BloodP",-1}};
interactAttributes[] = {{"Thirst",-50},{"Stamina",-20}};
};
class caffeinepills_epoch : FAK
{
interactAction = 1; // some type of boost system is needed as well as new action to feed it
interactText = "EAT";
interactAttributes[] = {{"Thirst",-20},{"Stamina",50}};
};
class orlistat_epoch : FAK
{
interactAction = 1; // some type of boost system is needed as well as new action to feed it
interactText = "EAT";
interactAttributes[] = {{"Thirst",-20},{"Stamina",50}};
}; };
}; };
/*[[[end]]]*/ /*[[[end]]]*/