public void hitByExplosion( CollisionParticipant source, LocalObject obj, DecalManager decal, CollisionEvent ce) { if (shield.getVisibility()) { // If the shield is visible, we are invincible... return; } Event event = new Event(Event.EXPLOSION_HIT, -99, obj.getObjectID(), obj.getClientID()); source.getEventQueue().add(event); }
/** * Gets a local object stored on the server identified by the clientID and the objectID. The * actual client don't know a thing about which local object ID their objects will get on the * server which is why they can't transmit them. All they know is, how THEY identify their * objects. This method maps between those two worlds. * * @param objID the objectID * @param clientID the clientID * @return LocalObject the corresponding local object */ public LocalObject getLocalObjectToIDs(int objID, int clientID) { for (Iterator<LocalObjectList> itty = client2LocalObj.values().iterator(); itty.hasNext(); ) { LocalObjectList entry = itty.next(); for (Iterator<LocalObject> itty2 = entry.iterator(); itty2.hasNext(); ) { LocalObject lo = itty2.next(); if (lo.getClientID() == clientID) { if (lo.getObjectID() == objID) { return lo; } } else { break; // Wrong client! } } } return null; }