Skip to content

Commit

Permalink
Flag ACTIVE_GENERATOR and "active generator" furniture to replace mos…
Browse files Browse the repository at this point in the history
…t ASRGs (#62459)

* implement flag ACTIVE_GENERATOR
add active generator furniture

* update generator parts

* documentation

* replace hardcoded ASRGs with new furniture active generators

* update all the non-military/lab stuff to active generators
update some obsolete ASRGs to the new standards (aftershock, microlab reactor)

* remove ASRGs from vanilla irradiation plant
  • Loading branch information
RenechCDDA authored Dec 6, 2022
1 parent 41cc871 commit c58154a
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 14 deletions.
39 changes: 38 additions & 1 deletion data/json/furniture_and_terrain/furniture-industrial.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"coverage": 80,
"required_str": -1,
"examine_action": { "type": "appliance_convert", "furn_set": "f_null", "item": "compact_ASRG_containment" },
"flags": [ "NOITEM", "SEALED", "REDUCE_SCENT", "PERMEABLE", "EASY_DECONSTRUCT" ],
"flags": [ "NOITEM", "SEALED", "REDUCE_SCENT", "PERMEABLE", "EASY_DECONSTRUCT", "ACTIVE_GENERATOR" ],
"bash": {
"str_min": 70,
"str_max": 400,
Expand Down Expand Up @@ -566,5 +566,42 @@
{ "item": "lead", "charges": [ 12, 18 ] }
]
}
},
{
"type": "furniture",
"id": "f_active_backup_generator",
"name": "active backup generator",
"looks_like": "t_plut_generator",
"description": "A ubiquitous piece of compact machinery meant for running anything from the bathroom lights to electric stoves and other necessities when grid electricity is unavailable. This one is currently running. You can hear it humming slightly when you are very close.",
"symbol": "0",
"color": "green_white",
"move_cost_mod": -1,
"coverage": 80,
"required_str": 8,
"flags": [ "NOITEM", "SEALED", "REDUCE_SCENT", "PERMEABLE", "ACTIVE_GENERATOR" ],
"bash": {
"str_min": 5,
"str_max": 40,
"explosive": 10,
"sound": "metal screeching!",
"sound_fail": "clang!",
"items": [
{ "item": "scrap", "count": [ 8, 38 ] },
{ "item": "steel_chunk", "count": [ 1, 6 ] },
{ "item": "sheet_metal", "count": [ 1, 4 ] },
{ "item": "jp8", "charges": [ 1000, 10000 ], "container-item": "jerrycan_big", "prob": 25 },
{ "item": "i4_diesel", "prob": 10 },
{ "item": "bearing", "charges": [ 5, 60 ] }
]
},
"deconstruct": {
"items": [
{ "item": "scrap", "count": [ 5, 15 ] },
{ "item": "sheet_metal", "count": [ 4, 6 ] },
{ "item": "jp8", "charges": [ 1000, 10000 ], "container-item": "jerrycan_big" },
{ "item": "i4_diesel" },
{ "item": "bearing", "charges": [ 5, 40 ] }
]
}
}
]
2 changes: 1 addition & 1 deletion data/json/mapgen/irradiator_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
},
"furniture": {
"#": [ "f_bench" ],
"/": [ "f_compact_ASRG_containment" ],
"/": [ "f_active_backup_generator" ],
"0": [ "f_console" ],
"5": [ "f_console" ],
"6": [ "f_console" ],
Expand Down
2 changes: 1 addition & 1 deletion data/json/mapgen/microlab/microlab_reactor.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"palettes": [ "microlab" ],
"items": { "d": { "item": "cop_armory", "chance": 5 }, "l": { "item": "decontamination_room", "chance": 70 } },
"terrain": { "-": "t_wall_metal", "`": "t_hole", "#": "t_rock", "G": "t_card_science", "g": "t_bridge", "A": "t_bridge" },
"furniture": { "A": "f_compact_ASRG" }
"furniture": { "A": "f_compact_ASRG_containment" }
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions data/json/mapgen/outpost.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"L": "f_locker",
"b": "f_bunkbed",
"T": "f_trashcan",
"p": "f_compact_ASRG_containment"
"p": "f_active_backup_generator"
},
"items": {
"b": { "item": "army_bed", "chance": 60 },
Expand Down Expand Up @@ -186,7 +186,7 @@
"d": "f_desk",
"f": "f_fridge",
"T": "f_trashcan",
"p": "f_compact_ASRG_containment"
"p": "f_active_backup_generator"
},
"items": {
"b": { "item": "army_bed", "chance": 60 },
Expand Down
2 changes: 1 addition & 1 deletion data/json/mapgen/prison_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@
"Y": [ "f_rack_coat" ],
"А": [ "f_speaker_cabinet" ],
"а": [ "f_fridge" ],
"Ё": [ "f_compact_ASRG_containment" ],
"Ё": [ "f_active_backup_generator" ],
"Ж": [ "f_locker" ],
"З": [ "f_bookcase" ],
"И": [ "f_counter" ],
Expand Down
2 changes: 1 addition & 1 deletion data/json/mapgen/river_shipwreck.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"6": "f_machinery_light",
"e": "f_machinery_heavy",
"r": "f_console_broken",
"R": "f_compact_ASRG_containment",
"R": "f_active_backup_generator",
"#": "f_wreckage",
"9": "f_locker",
"A": "f_standing_tank"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@
],
"flags": [ "ALLOW_TERRAIN_UNDER_OTHER_DATA" ],
"terrain": { "6": "t_metal_floor", "C": "t_metal_floor", "W": "t_metal_floor" },
"furniture": { "6": "f_console_broken", "C": "f_compact_ASRG", "W": "f_workbench" },
"furniture": { "6": "f_console_broken", "C": "f_compact_ASRG_containment", "W": "f_workbench" },
"items": {
"W": [
{ "item": "tools_robotics", "chance": 80, "repeat": [ 1, 3 ] },
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ List of known flags, used in both `terrain.json` and `furniture.json`.
### Furniture Only
- ```ACTIVE_GENERATOR``` This furniture is considered to be an active power source for the purpose of certain monster special attacks (e.g. milspec searchlight's SEARCHLIGHT)
- ```AUTODOC``` This furniture can be an Autodoc console, it also needs the `autodoc` examine action.
- ```AUTODOC_COUCH``` This furniture can be a couch for a furniture with the `autodoc` examine action.
- ```BLOCKSDOOR``` This will boost map terrain's resistance to bashing if `str_*_blocked` is set (see `map_bash_info`).
Expand Down
1 change: 1 addition & 0 deletions src/flag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const flag_id flag_ACID( "ACID" );
const flag_id flag_ACID_IMMUNE( "ACID_IMMUNE" );
const flag_id flag_ACTIVATE_ON_PLACE( "ACTIVATE_ON_PLACE" );
const flag_id flag_ACTIVE_CLOAKING( "ACTIVE_CLOAKING" );
const flag_id flag_ACTIVE_GENERATOR( "ACTIVE_GENERATOR" );
const flag_id flag_ACT_IN_FIRE( "ACT_IN_FIRE" );
const flag_id flag_ACT_ON_RANGED_HIT( "ACT_ON_RANGED_HIT" );
const flag_id flag_ALARMCLOCK( "ALARMCLOCK" );
Expand Down
1 change: 1 addition & 0 deletions src/flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern const flag_id flag_ACID;
extern const flag_id flag_ACID_IMMUNE;
extern const flag_id flag_ACTIVATE_ON_PLACE;
extern const flag_id flag_ACTIVE_CLOAKING;
extern const flag_id flag_ACTIVE_GENERATOR;
extern const flag_id flag_ACT_IN_FIRE;
extern const flag_id flag_ACT_ON_RANGED_HIT;
extern const flag_id flag_ALARMCLOCK;
Expand Down
6 changes: 3 additions & 3 deletions src/map_extras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

static const flag_id json_flag_FILTHY( "FILTHY" );

static const furn_str_id furn_f_compact_ASRG_containment( "f_compact_ASRG_containment" );
static const furn_str_id furn_f_active_backup_generator( "f_active_backup_generator" );
static const furn_str_id furn_f_sign_warning( "f_sign_warning" );

static const item_group_id Item_spawn_data_ammo_casings( "ammo_casings" );
Expand Down Expand Up @@ -600,7 +600,7 @@ static bool mx_roadblock( map &m, const tripoint &abs_sub )

line_furn( &m, f_sandbag_half, point( 12, 7 ), point( 15, 7 ) );
m.add_spawn( mon_turret_searchlight, 1, { 13, 8, abs_sub.z } );
m.furn_set( point( 14, 8 ), furn_f_compact_ASRG_containment );
m.furn_set( point( 14, 8 ), furn_f_active_backup_generator );
line_furn( &m, f_sandbag_half, point( 12, 9 ), point( 15, 9 ) );

int num_bodies = dice( 2, 5 );
Expand Down Expand Up @@ -659,7 +659,7 @@ static bool mx_roadblock( map &m, const tripoint &abs_sub )

line_furn( &m, f_sandbag_half, point( 6, 10 ), point( 9, 10 ) );
m.add_spawn( mon_turret_searchlight, 1, { 7, 11, abs_sub.z } );
m.furn_set( point( 8, 11 ), furn_f_compact_ASRG_containment );
m.furn_set( point( 8, 11 ), furn_f_active_backup_generator );
line_furn( &m, f_sandbag_half, point( 6, 12 ), point( 9, 12 ) );

int num_bodies = dice( 1, 6 );
Expand Down
1 change: 1 addition & 0 deletions src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ std::string enum_to_string<ter_furn_flag>( ter_furn_flag data )
case ter_furn_flag::TFLAG_TRANSPARENT_FLOOR: return "TRANSPARENT_FLOOR";
case ter_furn_flag::TFLAG_TOILET_WATER: return "TOILET_WATER";
case ter_furn_flag::TFLAG_ELEVATOR: return "ELEVATOR";
case ter_furn_flag::TFLAG_ACTIVE_GENERATOR: return "ACTIVE_GENERATOR";

// *INDENT-ON*
case ter_furn_flag::NUM_TFLAG_FLAGS:
Expand Down
1 change: 1 addition & 0 deletions src/mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ enum class ter_furn_flag : int {
TFLAG_TRANSPARENT_FLOOR,
TFLAG_TOILET_WATER,
TFLAG_ELEVATOR,
TFLAG_ACTIVE_GENERATOR,

NUM_TFLAG_FLAGS
};
Expand Down
4 changes: 1 addition & 3 deletions src/monattack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ static const efftype_id effect_targeted( "targeted" );
static const efftype_id effect_tindrift( "tindrift" );
static const efftype_id effect_under_operation( "under_operation" );

static const furn_str_id furn_f_compact_ASRG_containment( "f_compact_ASRG_containment" );

static const gun_mode_id gun_mode_AUTO( "AUTO" );

static const itype_id itype_120mm_HEAT( "120mm_HEAT" );
Expand Down Expand Up @@ -3825,7 +3823,7 @@ bool mattack::searchlight( monster *z )
for( int x = zpos.x - 24; x < zpos.x + 24; x++ ) {
for( int y = zpos.y - 24; y < zpos.y + 24; y++ ) {
tripoint dest( x, y, z->posz() );
if( here.furn( dest ) == furn_f_compact_ASRG_containment ) {
if( here.has_flag( ter_furn_flag::TFLAG_ACTIVE_GENERATOR, dest ) ) {
generator_ok = true;
}
}
Expand Down

0 comments on commit c58154a

Please sign in to comment.