def on_client_shoot(self, client, shot_id, gun, fx, fy, fz, tx, ty, tz, hits): if client.state.lastshot == -1: wait = time.time() - client.state.lastshot else: wait = client.state.gunwait pfrom = vec(fx, fy, fz).div(DMF) pto = vec(tx, ty, tz).div(DMF) if not client.state.alive or wait < client.state.gunwait: return if gun < weapon_types.GUN_FIST or gun > weapon_types.GUN_PISTOL: return if client.state.ammo[gun] <= 0: return if guns[gun].range and (pfrom.dist(pto) > guns[gun].range + 1): return if gun != weapon_types.GUN_FIST: client.state.ammo[gun] -= 1 client.state.lastshot = time.time() client.state.gunwait = float(guns[gun].attackdelay)/1000.0 with self.broadcastbuffer(1, True, [client]) as cds: swh.put_shotfx(cds, client, gun, shot_id, fx, fy, fz, tx, ty, tz) if gun == weapon_types.GUN_RL: client.state.rockets[shot_id] = gun elif gun == weapon_types.GUN_GL: client.state.grenades[shot_id] = gun else: for hit in hits: self.on_client_hit(client, gun, **hit)