예제 #1
0
void emit::check_consistency()
{
    for( auto &e : emits_all ) {
        e.second.field_ = field_from_ident( e.second.field_name );

        if( e.second.density_ > MAX_FIELD_DENSITY || e.second.density_ < 1 ) {
            debugmsg( "emission density of %s out of range", e.second.id_.c_str() );
            e.second.density_ = std::max( std::min( e.second.density_, MAX_FIELD_DENSITY ), 1 );
        }
        if( e.second.qty_ <= 0 ) {
            debugmsg( "emission qty of %s out of range", e.second.id_.c_str() );
        }
        if( e.second.chance_ > 100 || e.second.chance_ <= 0 ) {
            e.second.density_ = std::max( std::min( e.second.chance_, 100 ), 1 );
            debugmsg( "emission chance of %s out of range", e.second.id_.c_str() );
        }
    }
}
예제 #2
0
void explosion_iuse::load( JsonObject &obj )
{
    obj.read( "explosion_power", explosion_power );
    obj.read( "explosion_shrapnel", explosion_shrapnel );
    obj.read( "explosion_fire", explosion_fire );
    obj.read( "explosion_blast", explosion_blast );
    obj.read( "draw_explosion_radius", draw_explosion_radius );
    if( obj.has_member( "draw_explosion_color" ) ) {
        draw_explosion_color = color_from_string( obj.get_string( "draw_explosion_color" ) );
    }
    obj.read( "do_flashbang", do_flashbang );
    obj.read( "flashbang_player_immune", flashbang_player_immune );
    obj.read( "fields_radius", fields_radius );
    if( obj.has_member( "fields_type" ) || fields_radius > 0 ) {
        fields_type = field_from_ident( obj.get_string( "fields_type" ) );
    }
    obj.read( "fields_min_density", fields_min_density );
    obj.read( "fields_max_density", fields_max_density );
    obj.read( "emp_blast_radius", emp_blast_radius );
    obj.read( "scrambler_blast_radius", scrambler_blast_radius );
    obj.read( "sound_volume", sound_volume );
    obj.read( "sound_msg", sound_msg );
    obj.read( "no_deactivate_msg", no_deactivate_msg );
}