Skip to content

Commit

Permalink
Merge branch 'cataclysmbnteam:upload' into teleporter_mod
Browse files Browse the repository at this point in the history
  • Loading branch information
borsek authored Sep 17, 2023
2 parents b186af4 + ec3eb07 commit 8e926c0
Show file tree
Hide file tree
Showing 19 changed files with 372 additions and 133 deletions.
2 changes: 1 addition & 1 deletion data/json/items/ammo/flintlock.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"color": "white",
"count": 30,
"stack_size": 10,
"ammo_type": "flintlock",
"ammo_type": "flintlockshot",
"range": 8,
"damage": { "damage_type": "bullet", "amount": 63 },
"dispersion": 20,
Expand Down
6 changes: 6 additions & 0 deletions data/json/items/ammo_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,12 @@
"name": "paper cartridge",
"default": "flintlock_ammo"
},
{
"type": "ammunition_type",
"id": "flintlockshot",
"name": "paper shot cartridge",
"default": "flintlock_shot"
},
{
"type": "ammunition_type",
"id": "papershot",
Expand Down
1 change: 1 addition & 0 deletions data/json/items/armor/ammo_pouch.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"32",
"762x25",
"flintlock",
"flintlockshot",
"36paper",
"44paper",
"762R",
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/armor/bandolier.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
"use_action": {
"type": "bandolier",
"capacity": 20,
"ammo": [ "flintlock", "36paper", "44paper", "blunderbuss", "shotcanister", "shotpaper" ],
"ammo": [ "flintlock", "flintlockshot", "36paper", "44paper", "blunderbuss", "shotcanister", "shotpaper" ],
"draw_cost": 20
},
"flags": [ "WATER_FRIENDLY", "WAIST", "OVERSIZE" ]
Expand Down
10 changes: 5 additions & 5 deletions data/json/items/gun/flintlock.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"bashing": 5,
"material": [ "iron", "wood" ],
"color": "brown",
"ammo": "flintlock",
"range": 2,
"ammo": [ "flintlock", "flintlockshot" ],
"ranged_damage": { "damage_type": "bullet", "amount": 2 },
"dispersion": 620,
"durability": 6,
Expand Down Expand Up @@ -80,8 +79,8 @@
"bashing": 15,
"material": [ "iron", "wood" ],
"color": "brown",
"ammo": "flintlock",
"range": 6,
"ammo": [ "flintlock", "flintlockshot" ],
"range": 4,
"ranged_damage": { "damage_type": "bullet", "amount": 10 },
"dispersion": 180,
"durability": 6,
Expand All @@ -107,7 +106,8 @@
"description": "Also called a Pennsylvania rifle, this long barreled rifled flintlock gun has signficantly increased accuracy at the cost of taking even longer to reload.",
"weight": "3700 g",
"volume": "1700 ml",
"relative": { "range": 2 },
"ammo": "flintlock",
"relative": { "range": 14 },
"proportional": { "dispersion": 0.5, "reload": 2.0 }
}
]
2 changes: 1 addition & 1 deletion data/json/mapgen/hospital.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
";": "t_door_locked",
"x": "t_wall_glass",
"4": "t_sidewalk",
"5": "t_elevator_control_off"
"5": "t_elevator_control"
},
"place_vehicles": [ { "vehicle": "helicopters", "x": 10, "y": 56, "chance": 80, "rotation": 270 } ]
}
Expand Down
16 changes: 8 additions & 8 deletions data/mods/Aftershock/maps/mapgen/municipal_microreactor.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@
"#########-% -##########",
"#########-% -##########",
"######-----55-----------",
"######-**%% ****2**2 ",
"######-** M 2 2 ",
"######- M ---- ",
"######-*** ** ****-``- ",
"######-*** ** ****-``- ",
"######-**%% ****2***2 ",
"######-** M 2 2 ",
"######- M ----- ",
"######-*** ** ****-```- ",
"######-*** ** ****-```- ",
"######------------------",
"########################"
],
Expand Down Expand Up @@ -224,9 +224,9 @@
"####- ^ 6-G55--l b l-#",
"####--2----- 2 l-#",
"####- -(22(-------#",
"####- d YYY 2eE-##",
"####- hd 2ee-##",
"####------------------##",
"####- d YYY 2eeE-#",
"####- hd 2eee-#",
"####-------------------#",
"########################"
],
"set": [
Expand Down
17 changes: 10 additions & 7 deletions src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,11 @@ void dig_activity_actor::finish( player_activity &act, Character &who )
calendar::turn ) );
}

const int helpersize = character_funcs::get_crafting_helpers( who, 3 ).size();
who.mod_stored_nutr( 5 - helpersize );
who.mod_thirst( 5 - helpersize );
who.mod_fatigue( 10 - ( helpersize * 2 ) );
const int act_exertion = act.moves_total;

who.mod_stored_kcal( std::min( -1, -act_exertion / to_moves<int>( 80_seconds ) ) );
who.mod_thirst( std::max( 1, act_exertion / to_moves<int>( 12_minutes ) ) );
who.mod_fatigue( std::max( 1, act_exertion / to_moves<int>( 6_minutes ) ) );
if( grave ) {
who.add_msg_if_player( m_good, _( "You finish exhuming a grave." ) );
} else {
Expand Down Expand Up @@ -526,9 +527,11 @@ void dig_channel_activity_actor::finish( player_activity &act, Character &who )
calendar::turn ) );
}

who.mod_stored_kcal( -40 );
who.mod_thirst( 5 );
who.mod_fatigue( 10 );
const int act_exertion = act.moves_total;

who.mod_stored_kcal( std::min( -1, -act_exertion / to_moves<int>( 80_seconds ) ) );
who.mod_thirst( std::max( 1, act_exertion / to_moves<int>( 12_minutes ) ) );
who.mod_fatigue( std::max( 1, act_exertion / to_moves<int>( 6_minutes ) ) );
who.add_msg_if_player( m_good, _( "You finish digging up %s." ),
here.ter( location ).obj().name() );

Expand Down
14 changes: 10 additions & 4 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4421,12 +4421,18 @@ void activity_handlers::fill_pit_finish( player_activity *act, player *p )
} else {
here.ter_set( pos, t_dirt );
}
int act_exertion = to_moves<int>( time_duration::from_minutes( 15 ) );
if( old_ter == t_pit_shallow ) {
act_exertion = to_moves<int>( time_duration::from_minutes( 10 ) );
} else if( old_ter == t_dirtmound ) {
act_exertion = to_moves<int>( time_duration::from_minutes( 5 ) );
}
const int helpersize = character_funcs::get_crafting_helpers( *p, 3 ).size();
p->mod_stored_nutr( 5 - helpersize );
p->mod_thirst( 5 - helpersize );
p->mod_fatigue( 10 - ( helpersize * 2 ) );
act_exertion = act_exertion * ( 10 - helpersize ) / 10;
p->mod_stored_kcal( std::min( -1, -act_exertion / to_moves<int>( 20_seconds ) ) );
p->mod_thirst( std::max( 1, act_exertion / to_moves<int>( 3_minutes ) ) );
p->mod_fatigue( std::max( 1, act_exertion / to_moves<int>( 90_seconds ) ) );
p->add_msg_if_player( m_good, _( "You finish filling up %s." ), old_ter.obj().name() );

act->set_to_null();
}

Expand Down
86 changes: 0 additions & 86 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ static const std::string flag_SPLINT( "SPLINT" );
static const std::string flag_VARSIZE( "VARSIZE" );
static const std::string flag_WALL( "WALL" );
static const std::string flag_WRITE_MESSAGE( "WRITE_MESSAGE" );
static const std::string flag_ELEVATOR( "ELEVATOR" );

// @TODO maybe make this a property of the item (depend on volume/type)
static const time_duration milling_time = 6_hours;
Expand Down Expand Up @@ -879,91 +878,6 @@ void iexamine::toilet( player &p, const tripoint &examp )
}
}

/**
* If underground, move 2 levels up else move 2 levels down. Stable movement between levels 0 and -2.
*/
void iexamine::elevator( player &p, const tripoint &examp )
{
map &here = get_map();
if( !query_yn( _( "Use the %s?" ), here.tername( examp ) ) ) {
return;
}
int movez = ( examp.z < 0 ? 2 : -2 );

tripoint original_floor_omt = ms_to_omt_copy( here.getabs( examp ) );
tripoint new_floor_omt = original_floor_omt + tripoint( point_zero, movez );


// first find critters in the destination elevator and move them out of the way
for( Creature &critter : g->all_creatures() ) {
if( critter.is_player() ) {
continue;
} else if( here.has_flag( flag_ELEVATOR, critter.pos() ) ) {
tripoint critter_omt = ms_to_omt_copy( here.getabs( critter.pos() ) );
if( critter_omt == new_floor_omt ) {
for( const tripoint &candidate : closest_points_first( critter.pos(), 10 ) ) {
if( !here.has_flag( flag_ELEVATOR, candidate ) &&
here.passable( candidate ) &&
!g->critter_at( candidate ) ) {
critter.setpos( candidate );
break;
}
}
}
}
}

// TODO: do we have struct or pair to indicate from -> to?
const auto move_item = [&]( map_stack & items, const tripoint & src, const tripoint & dest ) {
for( auto it = items.begin(); it != items.end(); ) {
here.add_item_or_charges( dest, *it );
it = here.i_rem( src, it );
}
};

const auto first_elevator_tile = [&]( const tripoint & pos ) -> tripoint {
for( const tripoint &candidate : closest_points_first( pos, 10 ) )
{
if( here.has_flag( flag_ELEVATOR, candidate ) ) {
return candidate;
}
}
return pos;
};

// move along every item in the elevator
for( const tripoint &pos : closest_points_first( p.pos(), 10 ) ) {
if( here.has_flag( flag_ELEVATOR, pos ) ) {
map_stack items = here.i_at( pos );
tripoint dest = first_elevator_tile( pos + tripoint( 0, 0, movez ) );
move_item( items, pos, dest );
}
}

// move the player
g->vertical_move( movez, false );

// finally, bring along everyone who was in the elevator with the player
for( Creature &critter : g->all_creatures() ) {
if( critter.is_player() ) {
continue;
} else if( here.has_flag( flag_ELEVATOR, critter.pos() ) ) {
tripoint critter_omt = ms_to_omt_copy( here.getabs( critter.pos() ) );

if( critter_omt == original_floor_omt ) {
for( const tripoint &candidate : closest_points_first( p.pos(), 10 ) ) {
if( here.has_flag( flag_ELEVATOR, candidate ) &&
candidate != p.pos() &&
!g->critter_at( candidate ) ) {
critter.setpos( candidate );
break;
}
}
}
}
}
}

/**
* Open or close gate.
*/
Expand Down
Loading

0 comments on commit 8e926c0

Please sign in to comment.