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

Add wind chimes #36625

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions data/json/emit.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,5 +314,10 @@
"field": "fd_fog",
"intensity": 2,
"qty": 200
},
{
"id": "emit_wind_chimes",
"type": "emit",
"field": "fd_wind_chimes"
}
]
10 changes: 10 additions & 0 deletions data/json/field_type.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
27 changes: 27 additions & 0 deletions data/json/furniture_and_terrain/furniture-emitters.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] }
]
}
}
]
18 changes: 18 additions & 0 deletions data/json/items/tool/deployable.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
}
]
5 changes: 3 additions & 2 deletions src/field_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 )
Expand Down
3 changes: 2 additions & 1 deletion src/field_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 26 additions & 0 deletions src/map_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down