Skip to content

Commit

Permalink
Merge pull request #49499 from KorGgenT/fix-blood-powered-cbm
Browse files Browse the repository at this point in the history
make it possible for cbms to be fueled by non-fuel items
  • Loading branch information
kevingranade authored Jun 30, 2021
2 parents 8e3a8da + ef7e4f0 commit a4cf9e7
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion data/mods/Magiclysm/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": { "str": "Blood Power Generator CBM" },
"description": "Embedded into your back and connected to your bionic power supply is a powerfull spell focus able to consume blood from dead creatures to produce bionic power. It can store up to 100 mL of blood.",
"occupied_bodyparts": [ [ "torso", 8 ] ],
"fuel_options": [ "blood", "dragon_blood", "tainted_blood" ],
"fuel_options": [ "blood", "dragon_blood", "tainted_blood", "hblood" ],
"fuel_capacity": 100,
"fuel_efficiency": 0.6,
"exothermic_power_gen": true,
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Magiclysm/harvest.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
"//": "nothing much aside from big pile of meat and maybe demon blood in future. But for now, tainted will do.",
"type": "harvest",
"entries": [
{ "drop": "tainted_blood", "type": "blood", "mass_ratio": 0.1 },
{ "drop": "blood_tainted", "type": "blood", "mass_ratio": 0.1 },
{ "drop": "meat", "type": "flesh", "mass_ratio": 0.4 }
]
},
Expand Down
12 changes: 3 additions & 9 deletions data/mods/Magiclysm/items/fuel.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@
"effects": [ "FLAME", "STREAM", "INCENDIARY", "NEVER_MISFIRES" ]
},
{
"id": "blood_tainted",
"type": "AMMO",
"id": "tainted_blood",
"copy-from": "blood_tainted",
"name": { "str_sp": "tainted blood" },
"weight": "2 g",
"color": "magenta",
"container": "flask_glass",
"symbol": "~",
"description": "Blood from a blob corrupted creature. The surface of this black sludge undulates slowly as if agitated by a soft breeze.",
"price": 0,
"material": [ "tainted_blood" ],
"volume": "1 ml",
"phase": "liquid",
"material": "tainted_blood",
"category": "fuel",
"ammo_type": "tainted_blood"
},
Expand Down
16 changes: 16 additions & 0 deletions data/mods/Magiclysm/items/obsolete.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,21 @@
"item_restriction": [ "small_mana_crystal" ]
}
]
},
{
"type": "AMMO",
"id": "tainted_blood",
"name": { "str_sp": "tainted blood" },
"weight": "2 g",
"color": "magenta",
"container": "flask_glass",
"symbol": "~",
"description": "Blood from a blob corrupted creature. The surface of this black sludge undulates slowly as if agitated by a soft breeze.",
"price": 0,
"material": [ "tainted_blood" ],
"volume": "1 ml",
"phase": "liquid",
"category": "fuel",
"ammo_type": "tainted_blood"
}
]
2 changes: 1 addition & 1 deletion data/mods/Magiclysm/recipes/alchemy.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"qualities": [ { "id": "CONTAIN", "level": 1 }, { "id": "MANA_INFUSE", "level": 1 }, { "id": "MANA_FOCUS", "level": 1 } ],
"tools": [ [ [ "paint_brush", -1 ] ] ],
"components": [
[ [ "tainted_blood", 2000 ], [ "blood", 8 ], [ "dragon_blood", 2000 ] ],
[ [ "blood_tainted", 2000 ], [ "blood", 8 ], [ "dragon_blood", 2000 ] ],
[ [ "any_strong_acid", 4, "LIST" ] ],
[ [ "water", 2 ], [ "water_clean", 2 ] ]
],
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Magiclysm/requirements/spell_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"//": "Weapon materials and 1000 energy from blood suitable for the Decaying Boneclub spell",
"components": [
[ [ "bone", 3 ], [ "bone_demihuman", 3 ], [ "bone_human", 3 ], [ "bone_tainted", 6 ] ],
[ [ "blood", 4 ], [ "tainted_blood", 200 ], [ "dragon_blood", 20 ] ]
[ [ "blood", 4 ], [ "blood_tainted", 200 ], [ "dragon_blood", 20 ] ]
]
},
{
Expand Down
4 changes: 0 additions & 4 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2267,10 +2267,6 @@ bionic_id Character::get_remote_fueled_bionic() const

bool Character::can_fuel_bionic_with( const item &it ) const
{
if( ( !it.is_fuel() && !it.type->magazine && !it.flammable() ) || it.is_comestible() ) {
return false;
}

for( const bionic_id &bid : get_bionics() ) {
for( const material_id &fuel : bid->fuel_opts ) {
if( fuel == it.get_base_material().id ) {
Expand Down
5 changes: 3 additions & 2 deletions src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1717,8 +1717,9 @@ trinary player::consume( item &target, bool force )
return trinary::NONE;
}
if( consume_med( target, *this ) ||
eat( target, *this, force ) ||
fuel_bionic_with( target ) ) {
( has_max_power() && get_power_level() < get_max_power_level() &&
get_fuel_capacity( target.get_base_material().id ) > 0 && fuel_bionic_with( target ) ) ||
eat( target, *this, force ) ) {

get_event_bus().send<event_type::character_consumes_item>( getID(), target.typeId() );

Expand Down

0 comments on commit a4cf9e7

Please sign in to comment.