Skip to content

Commit

Permalink
Merge branch 'CleverRaven:master' into rad-mage-fissile
Browse files Browse the repository at this point in the history
  • Loading branch information
Standing-Storm authored Dec 20, 2024
2 parents 70aeebf + a9416b4 commit 3194d17
Show file tree
Hide file tree
Showing 32 changed files with 535 additions and 155 deletions.
124 changes: 124 additions & 0 deletions data/mods/TEST_DATA/npc_behavior_arenas/arena_maps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
[
{
"type": "palette",
"id": "npc_behavior_test_palette",
"furniture": { "a": "f_chair" },
"terrain": {
".": "t_thconc_floor",
"X": "t_concrete_wall",
"C": "t_door_c",
"O": "t_door_o",
"u": "t_door_frame",
"W": "t_door_locked"
}
},
{
"type": "mapgen",
"method": "json",
"update_mapgen_id": "debug_npc_rules_test_avoid_doors",
"object": {
"rows": [
"XXXXXXXXXXXXXXXXXXXXXXXX",
"X......................X",
"X......................X",
"X......................X",
"X..........a...........X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"XC.CCCCCCCCCCCCCCCCCCCCX",
"X......................X",
"X......................X",
"XOOOOOOOOOOOOOOOOOOOO.OX",
"X......................X",
"X......................X",
"XXXXXXXXXXXuXXXXXXXXXXXX",
"X......................X",
"X......................X",
"XXXXXXXXXXX.XXXXXXXXXXXX",
"........................",
"........................"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "npc_behavior_test_palette" ]
}
},
{
"type": "mapgen",
"method": "json",
"update_mapgen_id": "debug_npc_rules_test_close_doors",
"object": {
"rows": [
"XXXXXXXXXXXXXXXXXXXXXXXX",
"X......................X",
"X......................X",
"X......................X",
"X..........a...........X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"X......................X",
"XXXXXXXXXXXOXXXXXXXXXXXX",
"X......................X",
"X......................X",
"XXXXXXXXXXXCXXXXXXXXXXXX",
"X......................X",
"X......................X",
"XXXXXXXXXXXWXXXXXXXXXXXX",
"X......................X",
"X......................X",
"XXXXXXXXXXX.XXXXXXXXXXXX",
"........................",
"........................"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"palettes": [ "npc_behavior_test_palette" ]
}
},
{
"id": "locked_as_hell_car",
"type": "vehicle",
"name": "DEBUG locked car DEBUG",
"blueprint": [
[ "BBDBB" ],
[ "B===B" ],
[ "B===B" ],
[ "B===B" ],
[ "BBBBB" ]
],
"parts": [
{ "x": -1, "y": -1, "parts": [ "frame", "aisle", "roof" ] },
{ "x": 0, "y": -1, "parts": [ "frame", "aisle", "roof" ] },
{ "x": 1, "y": -1, "parts": [ "frame", "aisle", "roof" ] },
{ "x": -1, "y": 0, "parts": [ "frame", "aisle", "roof" ] },
{ "x": 0, "y": 0, "parts": [ "frame", "aisle", "roof" ] },
{ "x": 1, "y": 0, "parts": [ "frame", "aisle", "roof" ] },
{ "x": -1, "y": 1, "parts": [ "frame", "aisle", "roof" ] },
{ "x": 0, "y": 1, "parts": [ "frame", "aisle", "roof" ] },
{ "x": 1, "y": 1, "parts": [ "frame", "aisle", "roof" ] },
{ "x": -1, "y": 2, "parts": [ "frame", "board", "roof" ] },
{ "x": 0, "y": 2, "parts": [ "frame", "board", "roof" ] },
{ "x": 1, "y": 2, "parts": [ "frame", "board", "roof" ] },
{ "x": 2, "y": 2, "parts": [ "frame", "board", "roof" ] },
{ "x": 0, "y": -2, "parts": [ "frame", "door", "door_lock", "roof" ] },
{ "x": 1, "y": -2, "parts": [ "frame", "board", "roof" ] },
{ "x": 2, "y": -1, "parts": [ "frame", "board", "roof" ] },
{ "x": 2, "y": 0, "parts": [ "frame", "board", "roof" ] },
{ "x": 2, "y": 1, "parts": [ "frame", "board", "roof" ] },
{ "x": -2, "y": -1, "parts": [ "frame", "board", "roof" ] },
{ "x": -2, "y": 0, "parts": [ "frame", "board", "roof" ] },
{ "x": -2, "y": -2, "parts": [ "frame", "board", "roof" ] },
{ "x": -1, "y": -2, "parts": [ "frame", "board", "roof" ] },
{ "x": 2, "y": -2, "parts": [ "frame", "board", "roof" ] },
{ "x": -2, "y": 2, "parts": [ "frame", "board", "roof" ] },
{ "x": -2, "y": 1, "parts": [ "frame", "board", "roof" ] }
]
}
]
9 changes: 0 additions & 9 deletions src/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,20 +302,11 @@ void explosion_handler::draw_explosion( const tripoint_bub_ms &p, const int r, c
}
}

void explosion_handler::draw_explosion( const tripoint &p, const int r, const nc_color &col )
{
explosion_handler::draw_explosion( tripoint_bub_ms( p ), r, col );
}
#else
void explosion_handler::draw_explosion( const tripoint_bub_ms &p, const int r, const nc_color &col )
{
draw_explosion_curses( *g, p, r, col );
}

void explosion_handler::draw_explosion( const tripoint &p, const int r, const nc_color &col )
{
draw_explosion_curses( *g, tripoint_bub_ms( p ), r, col );
}
#endif

void explosion_handler::draw_custom_explosion(
Expand Down
2 changes: 1 addition & 1 deletion src/ballistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ dealt_projectile_attack projectile_attack( const projectile &proj_arg,
apply_ammo_effects( null_source ? nullptr : origin, tp, proj.proj_effects, dealt_damage );
const explosion_data &expl = proj.get_custom_explosion();
if( expl.power > 0.0f ) {
explosion_handler::explosion( null_source ? nullptr : origin, tp.raw(),
explosion_handler::explosion( null_source ? nullptr : origin, tp,
proj.get_custom_explosion() );
}

Expand Down
7 changes: 4 additions & 3 deletions src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,8 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics
set_rad( 0 );
}
} else if( bio.id == bio_emp ) {
if( const std::optional<tripoint> pnt = choose_adjacent( _( "Create an EMP where?" ) ) ) {
if( const std::optional<tripoint_bub_ms> pnt = choose_adjacent_bub(
_( "Create an EMP where?" ) ) ) {
add_msg_activate();
explosion_handler::emp_blast( *pnt );
mod_moves( -100 );
Expand Down Expand Up @@ -1049,11 +1050,11 @@ bool Character::activate_bionic( bionic &bio, bool eff_only, bool *close_bionics
}
} else if( bio.id == bio_flashbang ) {
add_msg_activate();
explosion_handler::flashbang( pos(), true );
explosion_handler::flashbang( pos_bub(), true );
mod_moves( -100 );
} else if( bio.id == bio_shockwave ) {
add_msg_activate();
explosion_handler::shockwave( pos(), 3, 4, 2, 8, true );
explosion_handler::shockwave( pos_bub(), 3, 4, 2, 8, true );
add_msg_if_player( m_neutral, _( "You unleash a powerful shockwave!" ) );
mod_moves( -100 );
} else if( bio.id == bio_meteorologist ) {
Expand Down
10 changes: 4 additions & 6 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,14 +1101,14 @@ double Character::aim_factor_from_volume( const item &gun ) const
return std::max( factor, 0.2 ) ;
}

static bool is_obstacle( tripoint pos )
static bool is_obstacle( tripoint_bub_ms pos )
{
return get_map().coverage( pos ) >= 50;
}

double Character::aim_factor_from_length( const item &gun ) const
{
tripoint cur_pos = pos();
tripoint_bub_ms cur_pos = pos_bub();
bool nw_to_se = is_obstacle( cur_pos + tripoint::south_east ) &&
is_obstacle( cur_pos + tripoint::north_west );
bool w_to_e = is_obstacle( cur_pos + tripoint::west ) &&
Expand Down Expand Up @@ -10474,7 +10474,7 @@ void Character::echo_pulse()
sounds::sound( origin, 5, sounds::sound_t::sensory, _( "clack." ), true,
"none", "none" );
// This only counts obstacles which can be moved through, so the echo is pretty quiet.
} else if( is_obstacle( origin.raw() ) && here.sees( pos_bub(), origin, pulse_range, false ) ) {
} else if( is_obstacle( origin ) && here.sees( pos_bub(), origin, pulse_range, false ) ) {
sounds::sound( origin, 1, sounds::sound_t::sensory, _( "click." ), true,
"none", "none" );
}
Expand Down Expand Up @@ -11433,12 +11433,10 @@ bool Character::defer_move( const tripoint_bub_ms &next )
return false;
}
// next must be adjacent to subsequent move in any preexisting automove route
// TODO: fix point types
if( has_destination() && square_dist( auto_move_route.front(), next ) != 1 ) {
return false;
}
// TODO: fix point types
auto_move_route.insert( auto_move_route.begin(), tripoint_bub_ms( next ) );
auto_move_route.insert( auto_move_route.begin(), next );
next_expected_position = pos_bub();
return true;
}
Expand Down
22 changes: 12 additions & 10 deletions src/computer_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,13 +626,13 @@ void computer_session::action_cascade()
get_event_bus().send<event_type::causes_resonance_cascade>();
tripoint_bub_ms player_pos = get_player_character().pos_bub();
map &here = get_map();
std::vector<tripoint> cascade_points;
std::vector<tripoint_bub_ms> cascade_points;
for( const tripoint_bub_ms &dest : here.points_in_radius( player_pos, 10 ) ) {
if( here.ter( dest ) == ter_t_radio_tower ) {
cascade_points.push_back( dest.raw() );
cascade_points.push_back( dest );
}
}
explosion_handler::resonance_cascade( random_entry( cascade_points, player_pos.raw() ) );
explosion_handler::resonance_cascade( random_entry( cascade_points, player_pos ) );
}

void computer_session::action_research()
Expand Down Expand Up @@ -771,7 +771,7 @@ void computer_session::action_miss_launch()
}

//Only explode once. But make it large.
explosion_handler::explosion( &get_player_character(), nuke_location.raw(), 2000, 0.7, true );
explosion_handler::explosion( &get_player_character(), nuke_location, 2000, 0.7, true );

//...ERASE MISSILE, OPEN SILO, DISABLE COMPUTER
// For each level between here and the surface, remove the missile
Expand Down Expand Up @@ -1234,13 +1234,13 @@ void computer_session::action_srcf_seal()
const ter_id &t = here.ter( p );
if( t == ter_t_elevator || t == ter_t_vat ) {
here.make_rubble( p, furn_f_rubble_rock, true );
explosion_handler::explosion( &get_player_character(), p.raw(), 40, 0.7, true );
explosion_handler::explosion( &get_player_character(), p, 40, 0.7, true );
} else if( t == ter_t_wall_glass || t == ter_t_sewage_pipe ||
t == ter_t_sewage || t == ter_t_grate ) {
here.make_rubble( p, furn_f_rubble_rock, true );
} else if( t == ter_t_sewage_pump ) {
here.make_rubble( p, furn_f_rubble_rock, true );
explosion_handler::explosion( &get_player_character(), p.raw(), 50, 0.7, true );
explosion_handler::explosion( &get_player_character(), p, 50, 0.7, true );
}
}
comp.options.clear(); // Disable the terminal.
Expand Down Expand Up @@ -1340,7 +1340,7 @@ void computer_session::action_irradiator()
// critical failure - radiation spike sets off electronic detonators
if( it->typeId() == itype_mininuke || it->typeId() == itype_mininuke_act ||
it->typeId() == itype_c4 ) {
explosion_handler::explosion( &get_player_character(), dest.raw(), 40 );
explosion_handler::explosion( &get_player_character(), dest, 40 );
reset_terminal();
print_error( _( "WARNING [409]: Primary sensors offline!" ) );
print_error( _( " >> Initialize secondary sensors: Geiger profiling…" ) );
Expand Down Expand Up @@ -1664,7 +1664,7 @@ void computer_session::failure_pump_explode()
for( const tripoint_bub_ms &p : here.points_on_zlevel() ) {
if( here.ter( p ) == ter_t_sewage_pump ) {
here.make_rubble( p );
explosion_handler::explosion( &get_player_character(), p.raw(), 10 );
explosion_handler::explosion( &get_player_character(), p, 10 );
}
}
}
Expand Down Expand Up @@ -1706,9 +1706,11 @@ void computer_session::failure_amigara()
get_player_character().add_effect( effect_amigara, 2_minutes );
map &here = get_map();
explosion_handler::explosion( &get_player_character(),
tripoint( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false, 10 );
tripoint_bub_ms( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false,
10 );
explosion_handler::explosion( &get_player_character(),
tripoint( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false, 10 );
tripoint_bub_ms( rng( 0, MAPSIZE_X ), rng( 0, MAPSIZE_Y ), here.get_abs_sub().z() ), 10, 0.7, false,
10 );
comp.remove_option( COMPACT_AMIGARA_START );
}

Expand Down
10 changes: 5 additions & 5 deletions src/debug_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,12 +697,12 @@ static int creature_uilist()

static void monster_edit_menu()
{
std::vector<tripoint> locations;
std::vector<tripoint_bub_ms> locations;
uilist monster_menu;
int charnum = 0;
for( const monster &mon : g->all_monsters() ) {
monster_menu.addentry( charnum++, true, MENU_AUTOASSIGN, mon.disp_name() );
locations.emplace_back( mon.pos() );
locations.emplace_back( mon.pos_bub() );
}

if( locations.empty() ) {
Expand Down Expand Up @@ -2284,16 +2284,16 @@ static faction *select_faction()

static void character_edit_menu()
{
std::vector< tripoint > locations;
std::vector< tripoint_bub_ms > locations;
uilist charmenu;
charmenu.title = _( "Edit which character?" );
int charnum = 0;
avatar &player_character = get_avatar();
charmenu.addentry( charnum++, true, MENU_AUTOASSIGN, "%s", _( "You" ) );
locations.emplace_back( player_character.pos() );
locations.emplace_back( player_character.pos_bub() );
for( const npc &guy : g->all_npcs() ) {
charmenu.addentry( charnum++, true, MENU_AUTOASSIGN, guy.get_name() );
locations.emplace_back( guy.pos() );
locations.emplace_back( guy.pos_bub() );
}

pointmenu_cb callback( locations );
Expand Down
Loading

0 comments on commit 3194d17

Please sign in to comment.