diff --git a/data/json/emit.json b/data/json/emit.json index 6fb5cc798f6d9..4535dd117a07b 100644 --- a/data/json/emit.json +++ b/data/json/emit.json @@ -314,5 +314,10 @@ "field": "fd_fog", "intensity": 2, "qty": 200 + }, + { + "id": "emit_wind_chimes", + "type": "emit", + "field": "fd_wind_chimes" } ] diff --git a/data/json/field_type.json b/data/json/field_type.json index c4eaec74e8863..0cb82400d232a 100644 --- a/data/json/field_type.json +++ b/data/json/field_type.json @@ -1256,5 +1256,15 @@ "phase": "gas", "display_items": false, "display_field": true + }, + { + "id": "fd_wind_chimes", + "type": "field_type", + "intensity_levels": [ { "name": "wind chime music", "dangerous": false, "transparent": true } ], + "decay_amount_factor": 0, + "priority": 8, + "phase": "gas", + "display_items": true, + "display_field": false } ] diff --git a/data/json/furniture_and_terrain/furniture-emitters.json b/data/json/furniture_and_terrain/furniture-emitters.json index 695dcd7112ce7..80e1f3af5b5b8 100644 --- a/data/json/furniture_and_terrain/furniture-emitters.json +++ b/data/json/furniture_and_terrain/furniture-emitters.json @@ -28,5 +28,32 @@ "required_str": -1, "flags": [ "TRANSPARENT", "EMITTER" ], "emissions": [ "emit_fog_plume" ] + }, + { + "type": "furniture", + "id": "f_wind_chimes", + "name": "wind chimes", + "description": "This is a wind chime that has been set up. It'll produce some pleasant notes if it's windy enough.", + "symbol": "P", + "looks_like": "cow_bell", + "color": "light_gray", + "move_cost_mod": 2, + "coverage": 15, + "required_str": 4, + "flags": [ "PLACE_ITEM", "TRANSPARENT", "EMITTER", "EASY_DECONSTRUCT" ], + "emissions": [ "emit_wind_chimes" ], + "deployed_item": "wind_chimes", + "examine_action": "deployed_furniture", + "bash": { + "str_min": 8, + "str_max": 30, + "sound": "metal screeching!", + "sound_fail": "clang!", + "items": [ + { "item": "scrap", "count": [ 5, 10 ] }, + { "item": "string_6", "count": [ 3, 6 ] }, + { "item": "pipe", "count": [ 0, 1 ] } + ] + } } ] diff --git a/data/json/items/tool/deployable.json b/data/json/items/tool/deployable.json index bc74b04e9482b..dc6bb5c402fd1 100644 --- a/data/json/items/tool/deployable.json +++ b/data/json/items/tool/deployable.json @@ -178,5 +178,23 @@ "color": "light_gray", "use_action": { "type": "deploy_furn", "furn_type": "f_butter_churn" }, "qualities": [ [ "CONTAIN", 1 ], [ "CHURN", 1 ] ] + }, + { + "id": "wind_chimes", + "type": "TOOL", + "name": "wind chimes", + "name_plural": "wind chimes", + "description": "A set of windchimes, complete with a post to place them.", + "weight": "1750 g", + "volume": "2 L", + "to_hit": -1, + "bashing": 10, + "price": 25000, + "price_postapoc": 45000, + "material": [ "steel" ], + "symbol": "P", + "looks_like": "cow_bell", + "color": "light_gray", + "use_action": { "type": "deploy_furn", "furn_type": "f_wind_chimes" } } ] diff --git a/src/field_type.cpp b/src/field_type.cpp index cde0d93f26d4f..ea4445bb854b1 100644 --- a/src/field_type.cpp +++ b/src/field_type.cpp @@ -347,7 +347,8 @@ field_type_id fd_null, fd_fungicidal_gas, fd_insecticidal_gas, fd_smoke_vent, - fd_tindalos_rift + fd_tindalos_rift, + fd_wind_chimes ; void field_types::set_field_type_ids() @@ -405,7 +406,7 @@ void field_types::set_field_type_ids() fd_insecticidal_gas = field_type_id( "fd_insecticidal_gas" ); fd_smoke_vent = field_type_id( "fd_smoke_vent" ); fd_tindalos_rift = field_type_id( "fd_tindalos_rift" ); - + fd_wind_chimes = field_type_id( "fd_wind_chimes" ); } field_type field_types::get_field_type_by_legacy_enum( int legacy_enum_id ) diff --git a/src/field_type.h b/src/field_type.h index bc11a7d4e9e40..6a80c8c437806 100644 --- a/src/field_type.h +++ b/src/field_type.h @@ -309,7 +309,8 @@ extern field_type_id fd_null, fd_fungicidal_gas, fd_insecticidal_gas, fd_smoke_vent, - fd_tindalos_rift + fd_tindalos_rift, + fd_wind_chimes ; #endif diff --git a/src/map_field.cpp b/src/map_field.cpp index 15981304877e3..bf3c7c6778934 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -1286,6 +1286,32 @@ bool map::process_fields_in_submap( submap *const current_submap, furn_set( p, f_null ); } } + if( curtype == fd_wind_chimes ) { + const furn_t &frn = map_tile.get_furn_t(); + if( !frn.has_flag( "EMITTER" ) ) { + cur.set_field_intensity(0); + } else if( int wind_amount = get_local_windpower( g->weather.windspeed, + overmap_buffer.ter( p ), p, g->weather.winddirection, + g->is_sheltered( p ) ) ) { + int volume = std::min( 30, wind_amount ); + static const efftype_id effect_music( "music" ); + + // TODO NPCs listening to wind chimes + if( g->u.can_hear( p, volume ) ) { + if( calendar::once_every( 5_minutes ) ) { + // descriptions aren't printed for sounds at our position + if( g->u.pos() == p ) { + add_msg( _( "You listen to the wind chimes." ) ); + } + } + if( !g->u.has_effect( effect_music ) ) { + g->u.add_effect( effect_music, 1_turns ); + g->u.add_morale( morale_type( "morale_music" ), 1, 10, 5_minutes, 2_minutes, true ); + sounds::ambient_sound( p, volume, sounds::sound_t::music, _( "wind chimes" ) ); + } + } + } + } cur.set_field_age( cur.get_field_age() + 1_turns ); auto &fdata = cur.get_field_type().obj();