Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework monster equipment #36377

Merged
merged 27 commits into from
Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/json/itemgroups/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@
"id": "horse_gear",
"type": "item_group",
"//": "Horse vehicle items",
"items": [ [ "riding_saddle", 50 ], [ "yoke_harness", 50 ] ]
"items": [ [ "horse_tack", 50 ], [ "yoke_harness", 50 ] ]
}
]
2 changes: 1 addition & 1 deletion data/json/itemgroups/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
[ "chem_hexamine", 10 ],
[ "esbit_stove", 15 ],
[ "mess_tin", 5 ],
[ "riding_saddle", 3 ],
[ "horse_tack", 3 ],
[ "saddlebag", 5 ],
[ "lifestraw", 3 ],
[ "acetylene_machine", 2 ]
Expand Down
121 changes: 69 additions & 52 deletions data/json/items/armor/pets_horse_armor.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,85 @@
[
{
"abstract": "horse_armor",
"type": "PET_ARMOR",
"id": "kevlar_armor_horse",
"name": "horse armor",
"symbol": "[",
"looks_like": "hsurvivor_suit",
"min_pet_vol": "380 L",
"max_pet_vol": "1000 L",
"pet_bodytype": "horse",
"flags": [ "IS_PET_ARMOR" ]
},
{
"type": "PET_ARMOR",
"id": "kevlar_armor_horse",
"copy-from": "horse_armor",
"color": "yellow",
"name": "Kevlar-lined horse peto",
"name": { "str": "Kevlar-lined horse peto" },
"description": "A heavy mattress-like armor of cloth, leather and thick linings of Kevlar, originally used as protection in bullfighting. You could put this on a friendly horse.",
"price": 50000,
"price_postapoc": 5000,
"material": [ "kevlar" ],
"weight": "30000 g",
"material": [ "cotton", "leather", "kevlar" ],
"weight": "30 kg",
"volume": "150 L",
"bashing": 10,
"to_hit": -3,
"flags": [ "IS_PET_ARMOR", "NO_SALVAGE" ],
"material_thickness": 2,
"max_pet_vol": "1000000 ml",
"min_pet_vol": "380000 ml",
"pet_bodytype": "horse"
"material_thickness": 10
},
{
"type": "PET_ARMOR",
"id": "acidchitin_armor_horse",
"copy-from": "kevlar_armor_horse",
"copy-from": "horse_armor",
"color": "green",
"name": "biosilicified chitin horse body armor",
"name": { "str": "biosilicified chitin horse armor" },
"description": "A makeshift assembly of criniere, peytral and croupiere made from biosilicified chitin fitted to a thin mesh. You could put this on a friendly horse.",
"proportional": { "price": 1.67, "price_postapoc": 1.67, "weight": 1.15 },
"relative": { "environmental_protection": 7 },
"material": [ "acidchitin" ]
"price": 120000,
"price_postapoc": 12000,
"material": [ "acidchitin", "steel" ],
"weight": "35 kg",
"volume": "150 L",
"material_thickness": 6,
"environmental_protection": 7
},
{
"type": "PET_ARMOR",
"id": "chitin_armor_horse",
"copy-from": "acidchitin_armor_horse",
"name": "chitin horse body armor",
"copy-from": "horse_armor",
"color": "green",
"name": { "str": "chitin horse armor" },
"description": "A makeshift assembly of criniere, peytral and croupiere made from chitin fitted to a thin mesh. You could put this on a friendly horse.",
"relative": { "price": -15000, "price_postapoc": -1500, "environmental_protection": -3 },
"material": [ "chitin" ]
"price": 100000,
"price_postapoc": 10000,
"material": [ "chitin", "steel" ],
"weight": "35 kg",
"volume": "150 L",
"material_thickness": 6,
"environmental_protection": 4
},
{
"type": "PET_ARMOR",
"id": "chainmail_armor_horse",
"copy-from": "kevlar_armor_horse",
"color": "light_red",
"name": "chainmail horse coat",
"copy-from": "horse_armor",
"color": "green",
"name": { "str": "chainmail horse armor" },
"description": "A heavy covering of chainmail, suitably made for horses as protection. You could put this on a friendly horse.",
"proportional": { "price": 0.83, "price_postapoc": 0.83, "weight": 1.3 },
"relative": { "material_thickness": -2 },
"material": [ "iron", "budget_steel" ]
"price": 40000,
"price_postapoc": 4000,
"material": [ "steel", "leather" ],
"weight": "40 kg",
"volume": "150 L",
"material_thickness": 6
},
{
"type": "PET_ARMOR",
"id": "leather_armor_horse",
"copy-from": "kevlar_armor_horse",
"color": "brown",
"name": "boiled leather horse barding with caparison",
"copy-from": "horse_armor",
"color": "green",
"name": { "str": "boiled leather horse barding with caprison" },
"description": "A full barding for horses consisting of boiled leather and cloth undercovering. This caparison is depicting a battle between a monstrous dragon and regal griffin. You could put this on a friendly horse.",
"proportional": { "price": 0.58, "price_postapoc": 0.58, "weight": 0.5 },
"price": 30000,
"price_postapoc": 3000,
"material": [ "cotton", "leather" ],
"weight": "15 kg",
"volume": "150 L",
"material_thickness": 6,
"snippet_category": [
{
"id": "battle",
Expand Down Expand Up @@ -98,40 +118,37 @@
{
"type": "PET_ARMOR",
"id": "leatherbone_armor_horse",
"copy-from": "leather_armor_horse",
"copy-from": "horse_armor",
"color": "green",
"name": { "str": "boiled leather horse barding with bones", "str_pl": "boiled leather horse bardings with bones" },
"description": "Decorative bones affixed to leather horse barding to invoke fear in bandits and raiders and traders all! You could put this on a friendly horse.",
"relative": { "price": 1500, "price_postapoc": 150, "weight": 500 },
"material": [ "bone", "leather" ]
"price": 45000,
"price_postapoc": 4500,
"material": [ "bone", "leather" ],
"weight": "17 kg",
"volume": "150 L",
"material_thickness": 6
},
{
"type": "PET_ARMOR",
"id": "rubber_armor_horse",
"copy-from": "kevlar_armor_horse",
"color": "dark_gray",
"name": "horse rain sheet",
"copy-from": "horse_armor",
"color": "green",
"name": { "str": "horse rain sheet" },
"description": "A thin plastic covering adapted for horses to protect from acid rain and other caustic sources. You could put this on a friendly horse.",
"proportional": { "price": 0.34, "price_postapoc": 0.34, "min_pet_vol": 0.6, "weight": 0.45 },
"relative": { "environmental_protection": 10, "material_thickness": -2 },
"material": [ "neoprene", "plastic" ]
},
{
"type": "PET_ARMOR",
"id": "superalloy_armor_horse",
"copy-from": "kevlar_armor_horse",
"color": "light_cyan",
"name": "superalloy crafted horse barding",
"description": "The latest fashion statement and protection for polo equestrians and ahistorical reenactor steeds alike, designed and manufactured by Land Dwarf Industries. You could put this on a friendly horse.",
"proportional": { "price": 100, "price_postapoc": 100, "min_pet_vol": 0.72, "weight": 0.72 },
"relative": { "environmental_protection": 10, "storage": 32 },
"material": [ "superalloy" ]
"price": 15000,
"price_postapoc": 1500,
"material": [ "neoprene", "plastic" ],
"weight": "14 kg",
"volume": "150 L",
"material_thickness": 3
},
{
"id": "saddlebag",
"type": "ARMOR",
"name": { "str": "pair of saddle bags", "str_pl": "pairs of saddle bags" },
"description": "A pair of covered pouches laid across the back of a horse behind the saddle.",
"weight": "1000 g",
"weight": "1 kg",
"volume": "7500 ml",
"price": 15000,
"material": [ "leather" ],
Expand Down
5 changes: 5 additions & 0 deletions data/json/items/migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,11 @@
"type": "MIGRATION",
"replace": "40x46mm_m651"
},
{
"id": "riding_saddle",
"type": "MIGRATION",
"replace": "horse_tack"
},
{
"id": "ballistic_vest",
"type": "MIGRATION",
Expand Down
15 changes: 8 additions & 7 deletions data/json/items/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@
"flags": [ "RADIO_MODABLE", "RADIO_INVOKE_PROC", "BOMB", "GRENADE" ]
},
{
"id": "riding_saddle",
"id": "horse_tack",
"type": "TOOL",
"name": "riding saddle",
"description": "A saddle that can be placed on a tamed animal that is capable of being ridden.",
"weight": "800 g",
"volume": "2 L",
"name": "horse tack",
"description": "A saddle, bridle, and associated tack that can be placed on a tamed animal that is capable of being ridden.",
"weight": "2 kg",
"volume": "7 L",
"price": 0,
"to_hit": -1,
"bashing": 5,
"material": [ "leather" ],
"material": [ "leather", "steel" ],
"symbol": "M",
"color": "yellow"
"color": "yellow",
"flags": [ "TACK" ]
},
{
"id": "EMPbomb_act",
Expand Down
2 changes: 1 addition & 1 deletion data/json/mapgen/isherwood_farms/cabin_isherwood.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"liquids": { "l": { "liquid": "water_clean", "amount": [ 0, 100 ] } },
"place_loot": [
{ "item": "cattlefodder", "x": [ 17, 18 ], "y": [ 2, 4 ], "chance": 100 },
{ "item": "riding_saddle", "x": 15, "y": 2, "chance": 100 },
{ "item": "horse_tack", "x": 15, "y": 2, "chance": 100 },
{ "item": "stepladder", "x": 15, "y": 4, "chance": 100 },
{ "item": "straw_pile", "x": [ 17, 18 ], "y": [ 2, 4 ], "chance": 30, "repeat": [ 2, 4 ] }
],
Expand Down
4 changes: 2 additions & 2 deletions data/json/npcs/isherwood_farm/NPC_Jesse_Isherwood.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
"success_lie": "Show me the bodies.",
"failure": "It was a lost cause anyways…"
},
"end": { "opinion": { "trust": 1, "value": 1 }, "effect": [ { "u_buy_item": "riding_saddle", "count": 1 } ] }
"end": { "opinion": { "trust": 1, "value": 1 }, "effect": [ { "u_buy_item": "horse_tack", "count": 1 } ] }
},
{
"id": "MISSION_ISHERWOOD_JESSE_2",
Expand All @@ -232,7 +232,7 @@
"success_lie": "Show me the bodies.",
"failure": "It was a lost cause anyways…"
},
"end": { "opinion": { "trust": 1, "value": 1 }, "effect": [ { "u_buy_item": "riding_saddle", "count": 1 } ] }
"end": { "opinion": { "trust": 1, "value": 1 }, "effect": [ { "u_buy_item": "horse_tack", "count": 1 } ] }
},
{
"id": "MISSION_ISHERWOOD_JESSE_2",
Expand Down
2 changes: 1 addition & 1 deletion data/json/professions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3881,7 +3881,7 @@
"cowboy_hat",
"boots_western",
"wristwatch",
"riding_saddle",
"horse_tack",
"pockknife",
"cattlefodder",
"cattlefodder",
Expand Down
7 changes: 3 additions & 4 deletions data/json/recipes/other/tool.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,15 @@
]
},
{
"result": "riding_saddle",
"result": "horse_tack",
"type": "recipe",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_TOOLS",
"skill_used": "tailor",
"difficulty": 4,
"skills_required": [ [ "fabrication", 3 ], [ "tailor", 4 ] ],
"time": 300000,
"book_learn": [ [ "textbook_tailor", 4 ], [ "manual_tailor", 5 ], [ "tailor_portfolio", 4 ] ],
"using": [ [ "sewing_standard", 100 ], [ "cordage", 2 ] ],
"components": [ [ [ "leather", 30 ], [ "tanned_hide", 5 ], [ "fur", 30 ], [ "tanned_pelt", 5 ] ] ]
"components": [ [ [ "leather", 30 ], [ "tanned_hide", 5 ], [ "fur", 30 ], [ "tanned_pelt", 5 ] ], [ [ "wire", 2 ] ] ]
},
{
"result": "jack",
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ List of known flags, used in both `terrain.json` and `furniture.json`.
- ```REQUIRES_TINDER``` ... Requires tinder to be present on the tile this item tries to start a fire on.
- ```SLEEP_AID``` ... This item helps in sleeping.
- ```SLOW_WIELD``` ... Has an additional time penalty upon wielding. For melee weapons and guns this is offset by the relevant skill. Stacks with "NEEDS_UNFOLD".
- ```TACK``` ... Item can be used as tack for a mount.
- ```TIE_UP``` ... Item can be used to tie up a creature.
- ```TINDER``` ... This item can be used as tinder for lighting a fire with a REQUIRES_TINDER flagged firestarter.
- ```TRADER_AVOID``` ... NPCs will not start with this item. Use this for active items (e.g. flashlight (on)), dangerous items (e.g. active bomb), fake item or unusual items (e.g. unique quest item).
Expand Down
22 changes: 7 additions & 15 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,17 @@ static void pass_to_ownership_handling( item obj, player *p )

static void stash_on_pet( const std::list<item> &items, monster &pet, player *p )
{
// Add volume of the bag itself since it is going to be subtracted later in the for-each loop.
units::volume remaining_volume = pet.inv.empty() ? 0_ml :
pet.inv.front().get_storage() + pet.inv.front().volume();
units::mass remaining_weight = pet.weight_capacity();
units::volume remaining_volume = pet.storage_item->get_storage() - pet.get_carried_volume();
units::mass remaining_weight = pet.weight_capacity() - pet.get_carried_weight();

for( const auto &it : pet.inv ) {
remaining_volume -= it.volume();
remaining_weight -= it.weight();
}

for( auto &it : items ) {
pet.add_effect( effect_controlled, 5_turns );
for( const item &it : items ) {
if( it.volume() > remaining_volume ) {
add_msg( m_bad, _( "%1$s did not fit and fell to the %2$s." ),
it.display_name(), g->m.name( pet.pos() ) );
add_msg( m_bad, _( "%1$s did not fit and fell to the %2$s." ), it.display_name(),
g->m.name( pet.pos() ) );
g->m.add_item_or_charges( pet.pos(), it );
} else if( it.weight() > remaining_weight ) {
add_msg( m_bad, _( "%1$s is too heavy and fell to the %2$s." ),
it.display_name(), g->m.name( pet.pos() ) );
add_msg( m_bad, _( "%1$s is too heavy and fell to the %2$s." ), it.display_name(),
g->m.name( pet.pos() ) );
g->m.add_item_or_charges( pet.pos(), it );
} else {
pet.add_item( it );
Expand Down
2 changes: 1 addition & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ void Character::mount_creature( monster &z )
z.remove_effect( effect_tied );
if( z.tied_item ) {
i_add( *z.tied_item );
z.tied_item = cata::nullopt;
z.tied_item.reset();
}
}
z.mounted_player_id = getID();
Expand Down
3 changes: 2 additions & 1 deletion src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,8 @@ void Creature::deal_projectile_attack( Creature *source, dealt_projectile_attack
if( z ) {
if( !proj.get_drop().is_null() ) {
z->add_effect( effect_tied, 1_turns, num_bp, true );
z->tied_item = proj.get_drop();
item drop_item = proj.get_drop();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop_item is not used at all (see #37053)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably got lost in the refactor for value pointers.

z->tied_item = cata::make_value<item>( proj.get_drop() );
} else {
add_msg( m_debug, "projectile with TANGLE effect, but no drop item specified" );
}
Expand Down
Loading