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

Fixes for active transforming ter/furn, add grid-powered space heaters #1204

Merged
Merged
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
28 changes: 28 additions & 0 deletions data/json/construction.json
Original file line number Diff line number Diff line change
Expand Up @@ -4441,6 +4441,34 @@
"pre_special": "check_empty",
"post_furniture": "f_gridsolderingiron"
},
{
"type": "construction",
"id": "constr_gridspaceheater",
"group": "place_small_space_heater",
"category": "WORKSHOP",
"required_skills": [ [ "electronics", 1 ] ],
"time": "30 m",
"qualities": [ [ { "id": "SCREW", "level": 1 } ] ],
"tools": [ [ [ "soldering_iron", 20 ] ] ],
"components": [ [ [ "small_space_heater", 1 ] ], [ [ "cable", 5 ] ], [ [ "power_supply", 1 ] ], [ [ "solder_wire", 5 ] ] ],
"pre_note": "Will only work if constructed in/on a building that has an electric grid with a mounted battery.",
"pre_special": "check_empty",
"post_furniture": "f_space_heater_off"
},
{
"type": "construction",
"id": "constr_gridlargespaceheater",
"group": "place_large_space_heater",
"category": "WORKSHOP",
"required_skills": [ [ "electronics", 1 ] ],
"time": "30 m",
"qualities": [ [ { "id": "SCREW", "level": 1 } ] ],
"tools": [ [ [ "soldering_iron", 20 ] ] ],
"components": [ [ [ "large_space_heater", 1 ] ], [ [ "cable", 5 ] ], [ [ "power_supply", 1 ] ], [ [ "solder_wire", 5 ] ] ],
"pre_note": "Will only work if constructed in/on a building that has an electric grid with a mounted battery.",
"pre_special": "check_empty",
"post_furniture": "f_space_heater_large_off"
},
{
"type": "construction",
"id": "constr_t_gates_mech_control",
Expand Down
10 changes: 10 additions & 0 deletions data/json/construction_group.json
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,16 @@
"id": "install_refrigerator",
"name": "Install Refrigerator"
},
{
"type": "construction_group",
"id": "place_small_space_heater",
"name": "Place Small Space Heater"
},
{
"type": "construction_group",
"id": "place_large_space_heater",
"name": "Place Large Space Heater"
},
{
"type": "construction_group",
"id": "install_solar_panel",
Expand Down
6 changes: 4 additions & 2 deletions data/json/emit.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,16 @@
"type": "emit",
"field": "fd_hot_air2",
"intensity": 3,
"qty": 50
"qty": 50,
"chance": 100
},
{
"id": "emit_hot_air2_blast",
"type": "emit",
"field": "fd_hot_air2",
"intensity": 3,
"qty": 100
"qty": 100,
"chance": 100
},
{
"id": "emit_hot_air4_blast",
Expand Down
156 changes: 156 additions & 0 deletions data/json/furniture_and_terrain/furniture-appliances.json
Original file line number Diff line number Diff line change
Expand Up @@ -1214,5 +1214,161 @@
{ "item": "cable", "charges": [ 1, 1 ] }
]
}
},
{
"type": "furniture",
"abstract": "f_space_heater_base",
"looks_like": "small_space_heater",
"symbol": ";",
"color": "light_gray",
"name": "-",
"description": "-",
"move_cost_mod": 2,
"required_str": 1,
"flags": [ "TRANSPARENT", "EASY_DECONSTRUCT" ],
"deconstruct": {
"items": [
{ "item": "small_space_heater", "count": 1 },
{ "item": "cable", "charges": 5 },
{ "item": "power_supply", "count": 1 }
]
},
"bash": {
"str_min": 8,
"str_max": 30,
"sound": "metal screeching!",
"sound_fail": "clang!",
"items": [
{ "item": "power_supply", "count": [ 1, 4 ] },
{ "item": "scrap", "count": [ 0, 2 ] },
{ "item": "cable", "charges": [ 1, 4 ] },
{ "item": "element", "count": [ 2, 6 ] }
]
}
},
{
"type": "furniture",
"id": "f_space_heater",
"copy-from": "f_space_heater_base",
"symbol": ";",
"color": "light_gray",
"name": "space heater (no power)",
"description": "A small portable electric heater, plugged into a wall. This one has no power.",
"examine_action": "transform",
"transforms_into": "f_space_heater_off",
"message": "You turn the heater off.",
"active": [
"charge_watcher",
{ "min_power": 5, "transform": { "id": "f_space_heater_on", "msg": "The space heater warms up." } }
]
},
{
"type": "furniture",
"id": "f_space_heater_off",
"copy-from": "f_space_heater_base",
"symbol": ";",
"color": "light_gray",
"name": "space heater (off)",
"description": "A small portable electric heater, plugged into a wall. This one is currently turned off.",
"examine_action": "transform",
"transforms_into": "f_space_heater",
"message": "You turn the heater on."
},
{
"type": "furniture",
"id": "f_space_heater_on",
"copy-from": "f_space_heater_base",
"looks_like": "small_space_heater_on",
"symbol": ";",
"color": "light_gray",
"name": "space heater (on)",
"description": "A small portable electric heater, plugged into a wall. This one is running and providing warmth.",
"examine_action": "transform",
"transforms_into": "f_space_heater_off",
"message": "You turn the heater off.",
"light_emitted": 2,
"active": [
"steady_consumer",
{
"power": 1,
"consume_every": "2 s",
"transform": { "id": "f_space_heater", "msg": "The heater runs out of power and cools off." }
}
],
"flags": [ "TRANSPARENT", "EASY_DECONSTRUCT", "EMITTER" ],
"emissions": [ "emit_hot_air2_stream" ]
},
{
"type": "furniture",
"id": "f_space_heater_large",
"copy-from": "f_space_heater_base",
"symbol": ";",
"color": "light_gray",
"name": "large space heater (no power)",
"description": "A large portable electric heater, plugged into a wall. This one has no power.",
"examine_action": "transform",
"transforms_into": "f_space_heater_large_off",
"message": "You turn the heater off.",
"active": [
"charge_watcher",
{ "min_power": 5, "transform": { "id": "f_space_heater_large_on", "msg": "The space heater warms up." } }
],
"deconstruct": {
"items": [
{ "item": "large_space_heater", "count": 1 },
{ "item": "cable", "charges": 5 },
{ "item": "power_supply", "count": 1 }
]
}
},
{
"type": "furniture",
"id": "f_space_heater_large_off",
"copy-from": "f_space_heater_base",
"symbol": ";",
"color": "light_gray",
"name": "large space heater (off)",
"description": "A large portable electric heater, plugged into a wall. This one is currently turned off.",
"examine_action": "transform",
"transforms_into": "f_space_heater_large",
"message": "You turn the heater on.",
"deconstruct": {
"items": [
{ "item": "large_space_heater", "count": 1 },
{ "item": "cable", "charges": 5 },
{ "item": "power_supply", "count": 1 }
]
}
},
{
"type": "furniture",
"id": "f_space_heater_large_on",
"copy-from": "f_space_heater_base",
"looks_like": "large_space_heater_on",
"symbol": ";",
"color": "light_gray",
"name": "large space heater (on)",
"description": "A large portable electric heater, plugged into a wall. This one is running and providing warmth.",
"examine_action": "transform",
"transforms_into": "f_space_heater_large_off",
"message": "You turn the heater off.",
"light_emitted": 2,
"active": [
"steady_consumer",
{
"power": 1,
"consume_every": "2 s",
"transform": { "id": "f_space_heater_large", "msg": "The heater runs out of power and cools off." }
}
],
"flags": [ "TRANSPARENT", "EASY_DECONSTRUCT", "EMITTER" ],
"emissions": [ "emit_hot_air2_blast" ],
"deconstruct": {
"items": [
{ "item": "large_space_heater", "count": 1 },
{ "item": "cable", "charges": 5 },
{ "item": "power_supply", "count": 1 }
]
}
}
]
8 changes: 6 additions & 2 deletions src/distribution_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,15 @@ void grid_furn_transform_queue::apply( mapbuffer &mb, distribution_grid_tracker

const furn_t &old_t = sm->get_furn( p_within_sm.raw() ).obj();
const furn_t &new_t = qt.id.obj();
const tripoint pos_local = m.getlocal( qt.p.raw() );

sm->set_furn( p_within_sm.raw(), qt.id );
if( m.inbounds( pos_local ) ) {
m.furn_set( pos_local, qt.id );
} else {
sm->set_furn( p_within_sm.raw(), qt.id );
}

if( !qt.msg.empty() ) {
const tripoint pos_local = m.getlocal( qt.p.raw() );
if( u.sees( pos_local ) ) {
add_msg( "%s", _( qt.msg ) );
}
Expand Down