107 // XXX: only tell the client itself? |
107 // XXX: only tell the client itself? |
108 obj.send_all(NETMSG_PLAYER_WEAPON_CHANGE, pkt, true); |
108 obj.send_all(NETMSG_PLAYER_WEAPON_CHANGE, pkt, true); |
109 |
109 |
110 // pass through |
110 // pass through |
111 Player::handleChangeWeapon(weaponIndex); |
111 Player::handleChangeWeapon(weaponIndex); |
|
112 } |
|
113 |
|
114 void NetworkServerPlayer::handleRopeState (RopeState state) { |
|
115 NetworkPacket pkt; |
|
116 |
|
117 Engine::log(INFO, "server_player.rope_state") << "state=" << rope.getState() << ", position=" << rope.getPosition() << ", velocity=" << rope.getVelocity() << ", length=" << rope.getLength(); |
|
118 |
|
119 switch (state) { |
|
120 case ROPE_FLYING: |
|
121 pkt.write_vector(rope.getPosition()); |
|
122 pkt.write_vector(rope.getVelocity()); |
|
123 pkt.write_float32(rope.getLength()); |
|
124 |
|
125 obj.send_all(NETMSG_PLAYER_ROPE_THROW, pkt, true); |
|
126 |
|
127 break; |
|
128 |
|
129 case ROPE_FIXED: |
|
130 pkt.write_vector(rope.getPosition()); |
|
131 pkt.write_float32(rope.getLength()); |
|
132 |
|
133 obj.send_all(NETMSG_PLAYER_ROPE_FIXED, pkt, true); |
|
134 |
|
135 break; |
|
136 |
|
137 case ROPE_FOLDED: |
|
138 obj.send_all(NETMSG_PLAYER_ROPE_RELEASED, pkt, true); |
|
139 |
|
140 break; |
|
141 } |
|
142 } |
|
143 |
|
144 void NetworkServerPlayer::handleRopeLength (float length) { |
|
145 NetworkPacket pkt; |
|
146 |
|
147 pkt.write_float32(length); |
|
148 |
|
149 obj.send_all(NETMSG_PLAYER_ROPE_LENGTH, pkt, true); |
112 } |
150 } |
113 |
151 |
114 void NetworkServerPlayer::on_disconnected (void) { |
152 void NetworkServerPlayer::on_disconnected (void) { |
115 NetworkPacket pkt; |
153 NetworkPacket pkt; |
116 |
154 |