Follow-up Comment #1, bug #10667 (project wormux):

A partial solution to solve the problem of position but sadly not the weapon
state (aka : the parachute remain closed on client or server ...) :

in grapple.cpp :
...
void Parachute::Refresh()
{
  double speed;
  double angle;

  ActiveCharacter().GetSpeed(speed, angle);

  if(ActiveCharacter().FootsInVacuum() && speed != 0.0) { // We are falling
    if(!open && (speed > GameMode::GetInstance()->safe_fall)) { // with a
sufficient speed
      if(EnoughAmmo()) { // We have enough ammo => start opening the
parachute
        UseAmmo();
        ActiveCharacter().SetAirResistFactor(cfg().air_resist_factor);
        ActiveCharacter().SetWindFactor(cfg().wind_factor);
        open = true;
        image->animation.SetPlayBackward(false);
        image->Start();
        ActiveCharacter().SetSpeedXY(Point2d(0,0));
        ActiveCharacter().SetMovement("parachute");
        Camera::GetInstance()->FollowObject(&ActiveCharacter(), true);
      }
    }
  } else { // We are on the ground
    ActiveCharacter().SetMovement("walk");
    if(open) { // The parachute is opened
      if (!closing) { // We have just hit the ground. Start closing
animation
        image->animation.SetPlayBackward(true);
        image->animation.SetShowOnFinish(SpriteAnimation::show_blank);
        image->Start();
        closing = true;
        return;
      } else { // The parachute is closing
        if(image->IsFinished()) {
          // The animation is finished... We are done with the parachute
          open = false;
          closing = false;
          UseAmmoUnit();
          if(Network::GetInstance()->IsTurnMaster()) {
            // sync attributes across network
            Action a_characters_info(Action::ACTION_CHARACTER_SET_PHYSICS);
            a_characters_info.StoreActiveCharacter();
            Network::GetInstance()->SendAction(&a_characters_info);
          }
        }
      }
    }
  }
  // If parachute is open => character can move a little to the left or to
the right
  if(open) {
    ActiveCharacter().SetExternForce(m_x_extern, 0.0);
    if(Network::GetInstance()->IsTurnMaster()) {
      static int sync_time = 0;
      // sync attributes across network every 10 refresh
      if((sync_time++ % 10) == 0) {
        Action a_characters_info(Action::ACTION_CHARACTER_SET_PHYSICS);
        a_characters_info.StoreActiveCharacter();
        Network::GetInstance()->SendAction(&a_characters_info);
        sync_time = 0;
      }
    }
  }
}
...


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?10667>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna

Reply via email to