Merge pull request #1125 from vbawol/Feature/0

Updated Craftitem & split config
This commit is contained in:
Florian Kinder
2014-02-15 02:08:39 +01:00
3 changed files with 83 additions and 69 deletions

View File

@@ -7,6 +7,7 @@ class CfgMagazines {
// Gems
#include "CfgMagazines\DZE\Gems.hpp"
#include "CfgMagazines\DZE\Ores.hpp"
// Items
#include "CfgMagazines\DZE\Items.hpp"
#include "CfgMagazines\DZE\Bulk.hpp"
@@ -1268,72 +1269,6 @@ class CfgMagazines {
};
};
class PartOre: CA_Magazine
{
scope = 2;
count = 1;
type = 256;
displayName = "Iron Ore";
model = "\z\addons\dayz_epoch\models\iron_ore.p3d";
picture="\z\addons\dayz_epoch\pictures\equip_iron_ore_CA.paa";
descriptionShort = "Used for crafting scrap metal. Can be mined from rocks using a sledgehammer.";
weight = 1;
class ItemActions {
class Crafting
{
text = $STR_EPOCH_PLAYER_265;
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;";
neednearby[] = {"fire"};
requiretools[] = {"ItemSledge"};
output[] = {{"PartGeneric",1},{"ItemWaterbottleUnfilled",1}};
input[] = {{"PartOre",4},{"ItemWaterbottle",1}};
};
};
};
class PartOreSilver: CA_Magazine
{
scope = 2;
count = 1;
type = 256;
displayName = "Silver Ore";
model = "\z\addons\dayz_epoch\models\silver_ore.p3d";
picture="\z\addons\dayz_epoch\pictures\equip_silver_ore_CA.paa";
descriptionShort = "Can be mined from rocks using a sledgehammer.";
weight = 1;
class ItemActions {
class Crafting
{
text = $STR_EPOCH_PLAYER_266;
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;";
neednearby[] = {"fire"};
requiretools[] = {"ItemSledge"};
output[] = {{"ItemSilverBar",1},{"ItemWaterbottleUnfilled",1}};
input[] = {{"PartOreSilver",1},{"ItemWaterbottle",1}};
};
};
};
class PartOreGold: CA_Magazine
{
scope = 2;
count = 1;
type = 256;
displayName = "Gold Ore";
model = "\z\addons\dayz_epoch\models\gold_ore.p3d";
picture="\z\addons\dayz_epoch\pictures\equip_gold_ore_CA.paa";
descriptionShort = "Can be mined from rocks using a sledgehammer.";
weight = 1;
class ItemActions {
class Crafting
{
text = $STR_EPOCH_PLAYER_267;
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;";
neednearby[] = {"fire"};
requiretools[] = {"ItemSledge"};
output[] = {{"ItemGoldBar",1},{"ItemWaterbottleUnfilled",1}};
input[] = {{"PartOreGold",1},{"ItemWaterbottle",1}};
};
};
};
class PartVRotor: CA_Magazine
{
scope = 2;

View File

@@ -0,0 +1,60 @@
class PartOre: CA_Magazine {
scope = 2;
count = 1;
type = 256;
displayName = "Iron Ore";
model = "\z\addons\dayz_epoch\models\iron_ore.p3d";
picture="\z\addons\dayz_epoch\pictures\equip_iron_ore_CA.paa";
descriptionShort = "Used for crafting scrap metal. Can be mined from rocks using a sledgehammer.";
weight = 1;
class ItemActions {
class Crafting {
text = $STR_EPOCH_PLAYER_265;
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;";
neednearby[] = {"fire"};
requiretools[] = {"ItemSledge"};
output[] = {{"PartGeneric",1},{"ItemWaterbottleUnfilled",1}};
input[] = {{"PartOre",4},{"ItemWaterbottle",1}};
};
};
};
class PartOreSilver: CA_Magazine {
scope = 2;
count = 1;
type = 256;
displayName = "Silver Ore";
model = "\z\addons\dayz_epoch\models\silver_ore.p3d";
picture="\z\addons\dayz_epoch\pictures\equip_silver_ore_CA.paa";
descriptionShort = "Can be mined from rocks using a sledgehammer.";
weight = 1;
class ItemActions {
class Crafting {
text = $STR_EPOCH_PLAYER_266;
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;";
neednearby[] = {"fire"};
requiretools[] = {"ItemSledge"};
output[] = {{"ItemSilverBar",1},{"ItemWaterbottleUnfilled",1}};
input[] = {{"PartOreSilver",1},{"ItemWaterbottle",1}};
};
};
};
class PartOreGold: CA_Magazine {
scope = 2;
count = 1;
type = 256;
displayName = "Gold Ore";
model = "\z\addons\dayz_epoch\models\gold_ore.p3d";
picture="\z\addons\dayz_epoch\pictures\equip_gold_ore_CA.paa";
descriptionShort = "Can be mined from rocks using a sledgehammer.";
weight = 1;
class ItemActions {
class Crafting {
text = $STR_EPOCH_PLAYER_267;
script = ";['Crafting','CfgMagazines', _id] spawn player_craftItem;";
neednearby[] = {"fire"};
requiretools[] = {"ItemSledge"};
output[] = {{"ItemGoldBar",1},{"ItemWaterbottleUnfilled",1}};
input[] = {{"PartOreGold",1},{"ItemWaterbottle",1}};
};
};
};

View File

@@ -20,7 +20,7 @@ class ItemActions
};
};
*/
private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_selectedRecipeInputStrict","_num_removed","_removed_total","_temp_removed_array","_abort","_reason","_isNear","_missingTools","_hastoolweapon","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons","_randomOutput","_craft_doLoop","_selectedWeapon","_selectedMag","_sfx"];
private ["_tradeComplete","_onLadder","_canDo","_selectedRecipeOutput","_proceed","_itemIn","_countIn","_missing","_missingQty","_qty","_itemOut","_countOut","_started","_finished","_animState","_isMedic","_removed","_tobe_removed_total","_textCreate","_textMissing","_selectedRecipeInput","_selectedRecipeInputStrict","_num_removed","_removed_total","_temp_removed_array","_abort","_waterLevel","_waterLevel_lowest","_reason","_isNear","_missingTools","_hastoolweapon","_selectedRecipeTools","_distance","_crafting","_needNear","_item","_baseClass","_num_removed_weapons","_outputWeapons","_inputWeapons","_randomOutput","_craft_doLoop","_selectedWeapon","_selectedMag","_sfx"];
if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_63") , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;
@@ -152,6 +152,7 @@ if (_canDo) then {
_removed_total = 0; // count total of removed items
_tobe_removed_total = 0; // count total of all to be removed items
_waterLevel_lowest = 0; // find the lowest _waterLevel
// Take items
{
_removed = 0;
@@ -160,10 +161,29 @@ if (_canDo) then {
// diag_log format["Recipe Finish: %1 %2", _itemIn,_countIn];
_tobe_removed_total = _tobe_removed_total + _countIn;
// Preselect the item
{
_configParent = configName(inheritsFrom(configFile >> "cfgMagazines" >> _x));
if ((_x == _itemIn) || (!_selectedRecipeInputStrict && _configParent == _itemIn)) then {
// Get lowest waterlevel
if ((_x == "ItemWaterbottle") ||( _configParent == "ItemWaterbottle")) then {
_waterLevel = floor((getNumber(configFile >> "CfgMagazines" >> _x >> "wateroz")) - 1);
if (_waterLevel_lowest == 0 || _waterLevel < _waterLevel_lowest) then {
_waterLevel_lowest = _waterLevel;
};
};
};
} forEach magazines player;
{
_configParent = configName(inheritsFrom(configFile >> "cfgMagazines" >> _x));
if( (_removed < _countIn) && ((_x == _itemIn) || (!_selectedRecipeInputStrict && _configParent == _itemIn))) then {
_num_removed = ([player,_x] call BIS_fnc_invRemove);
if ((_waterLevel_lowest == 0) || ((_waterLevel_lowest > 0) && (getNumber(configFile >> "CfgMagazines" >> _x >> "wateroz") == _waterLevel_lowest))) then {
_num_removed = ([player,_x] call BIS_fnc_invRemove);
}
else {
_num_removed = 0;
};
_removed = _removed + _num_removed;
_removed_total = _removed_total + _num_removed;
if(_num_removed >= 1) then {
@@ -174,7 +194,6 @@ if (_canDo) then {
_temp_removed_array set [count _temp_removed_array,_x];
};
};
} forEach magazines player;
} forEach _selectedRecipeInput;