// amputation will remove a limb, but also open bleeders (assuming creature can bleed)
// if a tourniquet is not used, very likely to bleed out due to extreme bleeding rates
// a tourniquet restricts flow down by 95% assuming that you didn't cut off a head or something.
// if amputating a head/neck, it is still technically alive for 4 minutes
void CreatureHealth::amputate(BODY_LOCATION limbloc){
    double _bleedrate=0;

    Limb* l = getLimb(limbloc);
    if(limbloc == BL_TORSO){
        // remove all limbs below with torso (essentially just leaving neck and head)
    }else if(limbloc == BL_ABDOMEN){
        // remove all limbs below with abdomen (keeps torso+head+wings+arms)
    }else if(limbloc == BL_NECK){
        // remove all limbs below with neck (keeps head)
    }else if(limbloc == BL_HEAD){
        // remove all but head, since you kinda need a head to live.
    }else if(limbloc == BL_LLEG){
        // remove all below Left Leg
    }

    limbs.freeze();
    for(int i=0;i<limbs.frozenlen;i++){
        if(limbs.frozen[i]->location == limbloc){
            Limb* limb = limbs.frozen[i];

            // remove limb & give a bleeder
            limbs.remove(i);
            missinglimbs.add(limb);
            injure(new Injury(IT_AMPUTATE, limb->location, IS_CRIPPLING, limb->bloodrate));
        }
    }
}
Esempio n. 2
0
void PhysicsRegion::setChassisCoord(chassis_id id, point_t coord) {
	assert(id != NO_CHASSIS);
	chassis[id].pin=coord;
	for (int p=0;p<getPlaneCount();p++) {
		limb_id lid = getLimb(id,1<<p);
		if (lid==NO_LIMB)
			continue;
		point_t coord_l = coord+limbs[lid].offset;
		limbs[lid].bounds->setPosition(coord_l.getX(),coord_l.getY());
	}
}
void CreatureHealth::bleed(double seconds){
    blood *= getBleedRate() * (seconds/60);

    checkHeart();

    // if heart is stopped, damage head!
    if(!heartbeating){
        Limb* head = getLimb(BL_HEAD);
        if(head != 0x0){
            double dmg = head->HPMax * (seconds/(4*60));
            head->HP -= dmg; // brain cells slowly dying.
        }
    }
}
Esempio n. 4
0
chassis_id PhysicsRegion::moveAttemptRelative(chassis_id id,
		vector2F offset, flag_plane src, flag_plane collision) {
	for (byte p = 0;p<getPlaneCount();p++) {
		flag_plane p_it = 1<<p;
		if (!(p_it&src))
			continue;
		limb_id lid = getLimb(id,p_it);
		if (lid==NO_LIMB)
			continue;
		rectangleF rect = getLimbBounds(lid)+offset;
		chassis_id obs = queryFirstRectangle(rect,collision);
		if (obs!=NO_CHASSIS)
			return obs;
	}
	setChassisCoord(id,getChassisCoord(id)+offset);
	return NO_CHASSIS;
}
Esempio n. 5
0
rectangleF PhysicsRegion::getAbsoluteLimbBounds(chassis_id id,
		flag_plane p) const {
	assert(id < chassis.size());
	return getAbsoluteLimbBounds(getLimb(id,p));
}
Esempio n. 6
0
rectangleF PhysicsRegion::getLimbBounds(chassis_id id,
		flag_plane p) const {
	assert(id != NO_CHASSIS);
	return getLimbBounds(getLimb(id,p));
}