Java Code Examples for skadistats.clarity.model.Entity#getHandle()

The following examples show how to use skadistats.clarity.model.Entity#getHandle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Parse.java    From parser with MIT License 6 votes vote down vote up
private Entry buildWardEntry(Context ctx, Entity e) { 
    Entry entry = new Entry(time); 
        boolean isObserver = !e.getDtClass().getDtName().contains("TrueSight"); 
    Integer x = getEntityProperty(e, "CBodyComponent.m_cellX", null); 
    Integer y = getEntityProperty(e, "CBodyComponent.m_cellY", null); 
    Integer z = getEntityProperty(e, "CBodyComponent.m_cellZ", null); 
    Integer life_state = getEntityProperty(e, "m_lifeState", null); 
    Integer[] pos = {x, y}; 
    entry.x = x; 
    entry.y = y; 
    entry.z = z; 
    entry.type = isObserver ? "obs" : "sen"; 
    entry.entityleft = life_state == 1; 
    entry.key = Arrays.toString(pos); 
    entry.ehandle = e.getHandle(); 
 
    if (entry.entityleft) { 
        entry.type += "_left"; 
    }
    
    Integer owner = getEntityProperty(e, "m_hOwnerEntity", null); 
    Entity ownerEntity = ctx.getProcessor(Entities.class).getByHandle(owner); 
    entry.slot = ownerEntity != null ? (Integer) getEntityProperty(ownerEntity, "m_iPlayerID", null) : null; 
    
    return entry; 
}
 
Example 2
Source File: ClientFrame.java    From clarity with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Capsule(ClientFrame frame) {
    int size = frame.getSize();
    handle = new int[size];
    active = new boolean[size];
    for (int i = 0; i < size; i++) {
        Entity e = frame.entity[i];
        handle[i] = e != null ? e.getHandle() : -1;
        active[i] = e != null && e.isActive();
    }
}
 
Example 3
Source File: ClientFrame.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void setEntity(Entity e) {
    int eIdx = e.getIndex();
    this.entity[eIdx] = e;
    this.lastHandle[eIdx] = e.getHandle();
}
 
Example 4
Source File: Entities.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@OnReset
public void onReset(Demo.CDemoStringTables packet, ResetPhase phase) {
    switch (phase) {
        case START:
            resetInProgress = true;
            resetCapsule = entities.createCapsule();
            break;

        case CLEAR:
            entities = new ClientFrame(entityCount);
            for (int i = 0; i < classBaselines.length; i++) {
                classBaselines[i].reset();
            }
            for (int i = 0; i < entityBaselines.length; i++) {
                entityBaselines[i][0].reset();
                entityBaselines[i][1].reset();
            }
            break;

        case COMPLETE:
            resetInProgress = false;

            //updateEventDebug = true;

            Entity entity;
            for (int eIdx = 0; eIdx < entityCount; eIdx++) {
                entity = entities.getEntity(eIdx);
                if (resetCapsule.isExistent(eIdx)) {
                    if (entity == null || entity.getHandle() != resetCapsule.getHandle(eIdx)) {
                        Entity deletedEntity = entityRegistry.get(resetCapsule.getHandle(eIdx));
                        if (resetCapsule.isActive(eIdx)) {
                            emitLeftEvent(deletedEntity);
                        }
                        emitDeletedEvent(deletedEntity);
                    }
                }
                if (entity != null) {
                    if (!resetCapsule.isExistent(eIdx) || entity.getHandle() != resetCapsule.getHandle(eIdx)) {
                        emitCreatedEvent(entity);
                        if (entity.isActive()) {
                            emitEnteredEvent(entity);
                        }
                    } else {
                        Iterator<FieldPath> iter = entity.getState().fieldPathIterator();
                        int n = 0;
                        while (iter.hasNext()) {
                            updatedFieldPaths[n++] = iter.next();
                        }
                        emitUpdatedEvent(entity, n);
                    }
                }
            }

            resetCapsule = null;

            //updateEventDebug = false;

            evUpdatesCompleted.raise();
            break;
    }
}
 
Example 5
Source File: Entities.java    From clarity with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public Entity getByHandle(int handle) {
    Entity e = getByIndex(engineType.indexForHandle(handle));
    return e == null || e.getHandle() != handle ? null : e;
}