From 65cec4e2fa5becc8cafed72e192c3159f6a36bb1 Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Tue, 7 Jan 2020 15:30:07 -0600 Subject: [PATCH 1/5] Construction recipe for barred window with curtains --- data/json/construction.json | 11 ++++ .../terrain-windows.json | 55 +++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/data/json/construction.json b/data/json/construction.json index eb0efc5dc9345..306424fd9555c 100644 --- a/data/json/construction.json +++ b/data/json/construction.json @@ -1988,6 +1988,17 @@ "pre_terrain": "t_window_alarm", "post_terrain": "t_window_bars_alarm" }, + { + "type": "construction", + "description": "Install Bars Onto Window", + "category": "CONSTRUCT", + "required_skills": [ [ "fabrication", 2 ] ], + "time": "30 m", + "qualities": [ [ { "id": "SAW_W", "level": 1 } ], [ { "id": "HAMMER", "level": 2 } ] ], + "components": [ [ [ "nail", 4 ] ], [ [ "sheet", 2 ] ], [ [ "stick", 1 ] ], [ [ "string_36", 1 ] ] ], + "pre_terrain": "t_window_bars", + "post_terrain": "t_window_bars_curtains" + }, { "type": "construction", "description": "Build Large Metal Support", diff --git a/data/json/furniture_and_terrain/terrain-windows.json b/data/json/furniture_and_terrain/terrain-windows.json index 1452fec5999a0..28163b5260e7a 100644 --- a/data/json/furniture_and_terrain/terrain-windows.json +++ b/data/json/furniture_and_terrain/terrain-windows.json @@ -571,6 +571,61 @@ "items": [ { "item": "glass_shard", "count": [ 34, 50 ] } ] } }, + { + "type": "terrain", + "id": "t_window_bars_curtains", + "name": "window with metal bars and curtains.", + "description": "A barred window with fancy curtains that have been drawn shut, blocking sunlight and visibility. The curtains can only be opened on the inside. If you examined the curtains more closely, you could peek through the drapes or tear down everything.", + "symbol": "\"", + "looks_like": "t_curtains", + "color": "light_gray", + "move_cost": 0, + "coverage": 95, + "roof": "t_flat_roof", + "flags": [ "NOITEM", "OPENCLOSE_INSIDE", "BARRICADABLE_WINDOW_CURTAINS", "REDUCE_SCENT", "CONNECT_TO_WALL", "BLOCK_WIND" ], + "examine_action": "curtains", + "open": "t_window_bars_domestic", + "bash": { + "str_min": 3, + "str_max": 6, + "sound": "glass breaking!", + "sound_fail": "whack!", + "sound_vol": 16, + "sound_fail_vol": 10, + "ter_set": "t_window_bars", + "items": [ { "item": "glass_shard", "count": [ 34, 50 ] }, + { "item": "sheet", "count": 2 }, + { "item": "stick", "count": 1 }, + { "item": "string_36", "count": 1 } ] + } + }, + { + "type": "terrain", + "id": "t_window_bars_domestic", + "name": "window with metal bars and curtains.", + "description": "A giant sheet of glass inserted into a window with thick security grilles, making it impossible to crawl through. Typically installed for high-value stores, or at least stores in bad neighborhoods. This one has been retrofitted with curtains.", + "symbol": "#", + "looks_like": "t_window_bars", + "color": "light_gray", + "move_cost": 0, + "roof": "t_flat_roof", + "flags": [ "TRANSPARENT", "NOITEM", "OPENCLOSE_INSIDE", "BARRICADABLE_WINDOW_CURTAINS", "REDUCE_SCENT", "CONNECT_TO_WALL" ], + "examine_action": "curtains", + "close": "t_window_bars_curtains", + "bash": { + "str_min": 3, + "str_max": 6, + "sound": "glass breaking!", + "sound_fail": "whack!", + "sound_vol": 16, + "sound_fail_vol": 10, + "ter_set": "t_window_bars", + "items": [ { "item": "glass_shard", "count": [ 34, 50 ] }, + { "item": "sheet", "count": 2 }, + { "item": "stick", "count": 1 }, + { "item": "string_36", "count": 1 } ] + } + }, { "type": "terrain", "id": "t_window_stained_green", From 6e8dff12a9df2414914a10e6b2901c8ff1e2a566 Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Tue, 7 Jan 2020 16:08:04 -0600 Subject: [PATCH 2/5] lint --- .../terrain-windows.json | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/data/json/furniture_and_terrain/terrain-windows.json b/data/json/furniture_and_terrain/terrain-windows.json index 28163b5260e7a..d8babe1300045 100644 --- a/data/json/furniture_and_terrain/terrain-windows.json +++ b/data/json/furniture_and_terrain/terrain-windows.json @@ -577,14 +577,14 @@ "name": "window with metal bars and curtains.", "description": "A barred window with fancy curtains that have been drawn shut, blocking sunlight and visibility. The curtains can only be opened on the inside. If you examined the curtains more closely, you could peek through the drapes or tear down everything.", "symbol": "\"", - "looks_like": "t_curtains", + "looks_like": "t_curtains", "color": "light_gray", "move_cost": 0, - "coverage": 95, + "coverage": 95, "roof": "t_flat_roof", "flags": [ "NOITEM", "OPENCLOSE_INSIDE", "BARRICADABLE_WINDOW_CURTAINS", "REDUCE_SCENT", "CONNECT_TO_WALL", "BLOCK_WIND" ], - "examine_action": "curtains", - "open": "t_window_bars_domestic", + "examine_action": "curtains", + "open": "t_window_bars_domestic", "bash": { "str_min": 3, "str_max": 6, @@ -593,10 +593,12 @@ "sound_vol": 16, "sound_fail_vol": 10, "ter_set": "t_window_bars", - "items": [ { "item": "glass_shard", "count": [ 34, 50 ] }, + "items": [ + { "item": "glass_shard", "count": [ 34, 50 ] }, { "item": "sheet", "count": 2 }, { "item": "stick", "count": 1 }, - { "item": "string_36", "count": 1 } ] + { "item": "string_36", "count": 1 } + ] } }, { @@ -605,13 +607,13 @@ "name": "window with metal bars and curtains.", "description": "A giant sheet of glass inserted into a window with thick security grilles, making it impossible to crawl through. Typically installed for high-value stores, or at least stores in bad neighborhoods. This one has been retrofitted with curtains.", "symbol": "#", - "looks_like": "t_window_bars", + "looks_like": "t_window_bars", "color": "light_gray", "move_cost": 0, "roof": "t_flat_roof", - "flags": [ "TRANSPARENT", "NOITEM", "OPENCLOSE_INSIDE", "BARRICADABLE_WINDOW_CURTAINS", "REDUCE_SCENT", "CONNECT_TO_WALL" ], - "examine_action": "curtains", - "close": "t_window_bars_curtains", + "flags": [ "TRANSPARENT", "NOITEM", "OPENCLOSE_INSIDE", "BARRICADABLE_WINDOW_CURTAINS", "REDUCE_SCENT", "CONNECT_TO_WALL" ], + "examine_action": "curtains", + "close": "t_window_bars_curtains", "bash": { "str_min": 3, "str_max": 6, @@ -620,10 +622,12 @@ "sound_vol": 16, "sound_fail_vol": 10, "ter_set": "t_window_bars", - "items": [ { "item": "glass_shard", "count": [ 34, 50 ] }, + "items": [ + { "item": "glass_shard", "count": [ 34, 50 ] }, { "item": "sheet", "count": 2 }, { "item": "stick", "count": 1 }, - { "item": "string_36", "count": 1 } ] + { "item": "string_36", "count": 1 } + ] } }, { From 761ae440f99d12f3af8bfecfc3d974859798f3a3 Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Tue, 7 Jan 2020 16:28:33 -0600 Subject: [PATCH 3/5] add conditional for tear down Add conditional handler for tearing down curtains from a barred window --- src/iexamine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/iexamine.cpp b/src/iexamine.cpp index 49e06d07ace1c..523663f6c22de 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -3753,6 +3753,8 @@ void iexamine::curtains( player &p, const tripoint &examp ) g->m.ter_set( examp, t_window_no_curtains_open ); } else if( ter == t_window_domestic_taped ) { g->m.ter_set( examp, t_window_no_curtains_taped ); + } else if( ter == t_window_bars_domestic || ter == t_window_bars_curtains ) { + g->m.ter_set( examp, t_window_bars ); } g->m.spawn_item( p.pos(), "nail", 1, 4, calendar::turn ); From 7b5ae9b1c931019a48cf2d832fe4c76a565a142b Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Tue, 7 Jan 2020 17:54:54 -0600 Subject: [PATCH 4/5] fix missing declaration No shortcuts... download a compiler, learn c++, and finish what I started. Game compiles, load save, no error, tear down curtain and they stayed down --- src/mapdata.cpp | 6 ++++-- src/mapdata.h | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mapdata.cpp b/src/mapdata.cpp index d9579265ff03f..fd734c83d2527 100644 --- a/src/mapdata.cpp +++ b/src/mapdata.cpp @@ -519,8 +519,8 @@ ter_id t_null, t_door_bar_c, t_door_bar_o, t_door_bar_locked, t_door_glass_c, t_door_glass_o, t_door_glass_frosted_c, t_door_glass_frosted_o, t_portcullis, - t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_open, - t_curtains, + t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_bars_domestic, t_window_open, + t_curtains, t_window_bars_curtains, t_window_alarm, t_window_alarm_taped, t_window_empty, t_window_frame, t_window_boarded, t_window_boarded_noglass, t_window_reinforced, t_window_reinforced_noglass, t_window_enhanced, t_window_enhanced_noglass, t_window_bars_alarm, t_window_bars, @@ -712,8 +712,10 @@ void set_ter_ids() t_window_taped = ter_id( "t_window_taped" ); t_window_domestic = ter_id( "t_window_domestic" ); t_window_domestic_taped = ter_id( "t_window_domestic_taped" ); + t_window_bars_domestic = ter_id( "t_window_bars_domestic" ); t_window_open = ter_id( "t_window_open" ); t_curtains = ter_id( "t_curtains" ); + t_window_bars_curtains = ter_id( "t_window_bars_curtains" ); t_window_alarm = ter_id( "t_window_alarm" ); t_window_alarm_taped = ter_id( "t_window_alarm_taped" ); t_window_empty = ter_id( "t_window_empty" ); diff --git a/src/mapdata.h b/src/mapdata.h index 864f5a17640e0..5c0b9123dace9 100644 --- a/src/mapdata.h +++ b/src/mapdata.h @@ -433,8 +433,8 @@ extern ter_id t_null, t_door_bar_c, t_door_bar_o, t_door_bar_locked, t_door_glass_c, t_door_glass_o, t_door_glass_frosted_c, t_door_glass_frosted_o, t_portcullis, - t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_open, - t_curtains, + t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_bars_domestic, t_window_open, + t_curtains, t_window_bars_curtains, t_window_alarm, t_window_alarm_taped, t_window_empty, t_window_frame, t_window_boarded, t_window_boarded_noglass, t_window_bars_alarm, t_window_bars, t_window_stained_green, t_window_stained_red, t_window_stained_blue, From 1b3a2cfd5a6c150036457308e25d77951a48e4d3 Mon Sep 17 00:00:00 2001 From: Kilvoctu Date: Wed, 8 Jan 2020 00:57:19 -0600 Subject: [PATCH 5/5] astyle learn what astyle is and attempt application. minor fix, remove unneeded "."'s --- data/json/furniture_and_terrain/terrain-windows.json | 4 ++-- src/mapdata.cpp | 8 ++++---- src/mapdata.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data/json/furniture_and_terrain/terrain-windows.json b/data/json/furniture_and_terrain/terrain-windows.json index d8babe1300045..3d5a9f3c42b92 100644 --- a/data/json/furniture_and_terrain/terrain-windows.json +++ b/data/json/furniture_and_terrain/terrain-windows.json @@ -574,7 +574,7 @@ { "type": "terrain", "id": "t_window_bars_curtains", - "name": "window with metal bars and curtains.", + "name": "window with metal bars and curtains", "description": "A barred window with fancy curtains that have been drawn shut, blocking sunlight and visibility. The curtains can only be opened on the inside. If you examined the curtains more closely, you could peek through the drapes or tear down everything.", "symbol": "\"", "looks_like": "t_curtains", @@ -604,7 +604,7 @@ { "type": "terrain", "id": "t_window_bars_domestic", - "name": "window with metal bars and curtains.", + "name": "window with metal bars and curtains", "description": "A giant sheet of glass inserted into a window with thick security grilles, making it impossible to crawl through. Typically installed for high-value stores, or at least stores in bad neighborhoods. This one has been retrofitted with curtains.", "symbol": "#", "looks_like": "t_window_bars", diff --git a/src/mapdata.cpp b/src/mapdata.cpp index fd734c83d2527..522a261cfe2bc 100644 --- a/src/mapdata.cpp +++ b/src/mapdata.cpp @@ -519,8 +519,8 @@ ter_id t_null, t_door_bar_c, t_door_bar_o, t_door_bar_locked, t_door_glass_c, t_door_glass_o, t_door_glass_frosted_c, t_door_glass_frosted_o, t_portcullis, - t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_bars_domestic, t_window_open, - t_curtains, t_window_bars_curtains, + t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_open, + t_curtains, t_window_bars_curtains, t_window_bars_domestic, t_window_alarm, t_window_alarm_taped, t_window_empty, t_window_frame, t_window_boarded, t_window_boarded_noglass, t_window_reinforced, t_window_reinforced_noglass, t_window_enhanced, t_window_enhanced_noglass, t_window_bars_alarm, t_window_bars, @@ -712,10 +712,10 @@ void set_ter_ids() t_window_taped = ter_id( "t_window_taped" ); t_window_domestic = ter_id( "t_window_domestic" ); t_window_domestic_taped = ter_id( "t_window_domestic_taped" ); - t_window_bars_domestic = ter_id( "t_window_bars_domestic" ); + t_window_bars_domestic = ter_id( "t_window_bars_domestic" ); t_window_open = ter_id( "t_window_open" ); t_curtains = ter_id( "t_curtains" ); - t_window_bars_curtains = ter_id( "t_window_bars_curtains" ); + t_window_bars_curtains = ter_id( "t_window_bars_curtains" ); t_window_alarm = ter_id( "t_window_alarm" ); t_window_alarm_taped = ter_id( "t_window_alarm_taped" ); t_window_empty = ter_id( "t_window_empty" ); diff --git a/src/mapdata.h b/src/mapdata.h index 5c0b9123dace9..bb1f1d138bad2 100644 --- a/src/mapdata.h +++ b/src/mapdata.h @@ -433,8 +433,8 @@ extern ter_id t_null, t_door_bar_c, t_door_bar_o, t_door_bar_locked, t_door_glass_c, t_door_glass_o, t_door_glass_frosted_c, t_door_glass_frosted_o, t_portcullis, - t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_bars_domestic, t_window_open, - t_curtains, t_window_bars_curtains, + t_recycler, t_window, t_window_taped, t_window_domestic, t_window_domestic_taped, t_window_open, + t_curtains, t_window_bars_curtains, t_window_bars_domestic, t_window_alarm, t_window_alarm_taped, t_window_empty, t_window_frame, t_window_boarded, t_window_boarded_noglass, t_window_bars_alarm, t_window_bars, t_window_stained_green, t_window_stained_red, t_window_stained_blue,