@@ -179,6 +179,7 @@ static const activity_id ACT_UNLOAD( "ACT_UNLOAD" );
179
179
static const activity_id ACT_UNLOAD_LOOT ( " ACT_UNLOAD_LOOT" );
180
180
static const activity_id ACT_VEHICLE_FOLD ( " ACT_VEHICLE_FOLD" );
181
181
static const activity_id ACT_VEHICLE_UNFOLD ( " ACT_VEHICLE_UNFOLD" );
182
+ static const activity_id ACT_WAIT_FOLLOWERS ( " ACT_WAIT_FOLLOWERS" );
182
183
static const activity_id ACT_WAIT_STAMINA ( " ACT_WAIT_STAMINA" );
183
184
static const activity_id ACT_WASH ( " ACT_WASH" );
184
185
static const activity_id ACT_WEAR ( " ACT_WEAR" );
@@ -9246,6 +9247,48 @@ std::unique_ptr<activity_actor> wait_stamina_activity_actor::deserialize( JsonVa
9246
9247
return wait_stamina_activity_actor ().clone ();
9247
9248
}
9248
9249
9250
+ void wait_followers_activity_actor::start ( player_activity &act, Character & )
9251
+ {
9252
+ act.moves_total = calendar::INDEFINITELY_LONG;
9253
+ act.moves_left = calendar::INDEFINITELY_LONG;
9254
+ }
9255
+
9256
+ std::vector<npc *> wait_followers_activity_actor::get_absent_followers ( Character &you )
9257
+ {
9258
+ return g->get_npcs_if ( [&you]( const npc & n ) -> bool {
9259
+ const npc_attitude att = n.get_attitude ();
9260
+ return ( att == NPCATT_FOLLOW || att == NPCATT_ACTIVITY ) && rl_dist ( n.pos_bub (), you.pos_bub () ) > n.follow_distance ();
9261
+ } );
9262
+ }
9263
+
9264
+
9265
+ void wait_followers_activity_actor::do_turn ( player_activity &act, Character &you )
9266
+ {
9267
+ if ( get_absent_followers ( you ).empty () ) {
9268
+ finish ( act, you );
9269
+ }
9270
+ }
9271
+
9272
+ void wait_followers_activity_actor::finish ( player_activity &act, Character &you )
9273
+ {
9274
+ if ( !get_absent_followers ( you ).empty () ) {
9275
+ you.add_msg_if_player ( _ ( " You are bored of waiting, so you stop." ) );
9276
+ } else {
9277
+ you.add_msg_if_player ( _ ( " All present and accounted for." ) );
9278
+ }
9279
+ act.set_to_null ();
9280
+ }
9281
+
9282
+ void wait_followers_activity_actor::serialize ( JsonOut &jsout ) const
9283
+ {
9284
+ jsout.write_null ();
9285
+ }
9286
+
9287
+ std::unique_ptr<activity_actor> wait_followers_activity_actor::deserialize ( JsonValue & )
9288
+ {
9289
+ return wait_stamina_activity_actor ().clone ();
9290
+ }
9291
+
9249
9292
namespace activity_actors
9250
9293
{
9251
9294
@@ -9319,6 +9362,7 @@ deserialize_functions = {
9319
9362
{ ACT_UNLOAD_LOOT, &unload_loot_activity_actor::deserialize },
9320
9363
{ ACT_VEHICLE_FOLD, &vehicle_folding_activity_actor::deserialize },
9321
9364
{ ACT_VEHICLE_UNFOLD, &vehicle_unfolding_activity_actor::deserialize },
9365
+ { ACT_WAIT_FOLLOWERS, &wait_followers_activity_actor::deserialize },
9322
9366
{ ACT_WAIT_STAMINA, &wait_stamina_activity_actor::deserialize },
9323
9367
{ ACT_WASH, &wash_activity_actor::deserialize },
9324
9368
{ ACT_WEAR, &wear_activity_actor::deserialize },
0 commit comments