Skip to content

Commit

Permalink
Remove useless EMITTER flag from vehicles (#45723)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fris0uman authored Nov 30, 2020
1 parent 74ffcec commit 62f003f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
4 changes: 2 additions & 2 deletions data/json/vehicleparts/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@
"removal": { "skills": [ [ "mechanics", 1 ] ], "time": "1 m", "using": [ [ "vehicle_screw", 1 ] ] },
"repair": { "skills": [ [ "mechanics", 1 ] ], "time": "30 s", "using": [ [ "adhesive", 1 ] ] }
},
"flags": [ "CTRL_ELECTRONIC", "ENABLED_DRAINS_EPOWER", "SPACE_HEATER", "EMITTER" ],
"flags": [ "CTRL_ELECTRONIC", "ENABLED_DRAINS_EPOWER", "SPACE_HEATER" ],
"emissions": [ "emit_heater_vehicle" ],
"breaks_into": [ { "item": "steel_lump" }, { "item": "steel_chunk", "count": [ 1, 3 ] }, { "item": "scrap", "count": [ 1, 3 ] } ],
"damage_reduction": { "all": 15 }
Expand All @@ -1254,7 +1254,7 @@
"removal": { "skills": [ [ "mechanics", 1 ] ], "time": "1 m", "using": [ [ "vehicle_screw", 1 ] ] },
"repair": { "skills": [ [ "mechanics", 1 ] ], "time": "30 s", "using": [ [ "adhesive", 1 ] ] }
},
"flags": [ "CTRL_ELECTRONIC", "ENABLED_DRAINS_EPOWER", "COOLER", "EMITTER" ],
"flags": [ "CTRL_ELECTRONIC", "ENABLED_DRAINS_EPOWER", "COOLER" ],
"emissions": [ "emit_cooler_vehicle" ],
"exhaust": [ "emit_heater_vehicle" ],
"breaks_into": [ { "item": "steel_lump" }, { "item": "steel_chunk", "count": [ 1, 3 ] }, { "item": "scrap", "count": [ 1, 3 ] } ],
Expand Down
1 change: 0 additions & 1 deletion doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,6 @@ Those flags are added by the game code to specific items (for example, that spec
- ```E_HEATER``` Is an engine and has a heater to warm internal vehicle items when on.
- ```E_HIGHER_SKILL``` Is an engine that is more difficult to install as more engines are installed.
- ```E_STARTS_INSTANTLY``` Is an engine that starts instantly, like food pedals.
- ```EMITTER``` Is a part has emission (defined in ```emissions```).
- ```FLAT_SURF``` Part with a flat hard surface (e.g. table).
- ```FOLDABLE```
- ```FREEZER``` Can freeze items in below zero degrees Celsius temperature.
Expand Down
33 changes: 11 additions & 22 deletions src/veh_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,31 +730,20 @@ void vpart_info::check()
if( part.has_flag( "TURRET" ) && !base_item_type.gun ) {
debugmsg( "vehicle part %s has the TURRET flag, but is not made from a gun item", part.id.c_str() );
}
if( !part.emissions.empty() && !part.has_flag( "EMITTER" ) ) {
debugmsg( "vehicle part %s has emissions set, but the EMITTER flag is not set", part.id.c_str() );
}
if( !part.exhaust.empty() && !part.has_flag( "EMITTER" ) ) {
debugmsg( "vehicle part %s has exhaust set, but the EMITTER flag is not set", part.id.c_str() );

for( const emit_id &e : part.emissions ) {
if( !e.is_valid() ) {
debugmsg( "vehicle part %s has invalid emission %s was set",
part.id.c_str(), e.str().c_str() );
}
}
if( part.has_flag( "EMITTER" ) ) {
if( part.emissions.empty() && part.exhaust.empty() ) {
debugmsg( "vehicle part %s has the EMITTER flag, but no emissions or exhaust were set",
part.id.c_str() );
} else {
for( const emit_id &e : part.emissions ) {
if( !e.is_valid() ) {
debugmsg( "vehicle part %s has the EMITTER flag, but invalid emission %s was set",
part.id.c_str(), e.str().c_str() );
}
}
for( const emit_id &e : part.exhaust ) {
if( !e.is_valid() ) {
debugmsg( "vehicle part %s has the EMITTER flag, but invalid exhaust %s was set",
part.id.c_str(), e.str().c_str() );
}
}
for( const emit_id &e : part.exhaust ) {
if( !e.is_valid() ) {
debugmsg( "vehicle part %s has invalid exhaust %s was set",
part.id.c_str(), e.str().c_str() );
}
}

if( part.has_flag( "WHEEL" ) && !base_item_type.wheel ) {
debugmsg( "vehicle part %s has the WHEEL flag, but base item %s is not a wheel. "
"THIS WILL CRASH!", part.id.str(), part.base_item.str() );
Expand Down
2 changes: 1 addition & 1 deletion src/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5805,7 +5805,7 @@ void vehicle::refresh()
if( vpi.has_flag( "UNMOUNT_ON_MOVE" ) ) {
loose_parts.push_back( p );
}
if( vpi.has_flag( "EMITTER" ) ) {
if( !vpi.emissions.empty() || !vpi.exhaust.empty() ) {
emitters.push_back( p );
}
if( vpi.has_flag( VPFLAG_WHEEL ) ) {
Expand Down

0 comments on commit 62f003f

Please sign in to comment.