def VelocityForDamage(dm, *qwp_extra): v = Vector(0, 0, 0) if defs.damage_inflictor.velocity.length() > 0: v = 0.5 * defs.damage_inflictor.velocity v += 25 * qc.normalize(qc.self.origin - defs.damage_inflictor.origin) v %= Vector(None, None, 100 + 240 * random.random()) v %= Vector(v.x + (200 * weapons.crandom()), None, None) v %= Vector(None, v.y + (200 * weapons.crandom()), None) # dprint ("Velocity gib\n"); else: v %= Vector(100 * weapons.crandom(), None, None) v %= Vector(None, 100 * weapons.crandom(), None) v %= Vector(None, None, 200 + 100 * random.random()) # v_x = 100 * crandom(); # v_y = 100 * crandom(); # v_z = 200 + 100 * random(); if dm > -50: # dprint ("level 1\n"); v *= 0.7 elif dm > -200: # dprint ("level 3\n"); v *= 2 else: v *= 10 return v
def VelocityForDamage(dm, *qwp_extra): v = Vector(100 * weapons.crandom(), 100 * weapons.crandom(), 200 + 100 * random.random()) if dm > -50: # dprint ("level 1\n"); v *= 0.7 elif dm > -200: # dprint ("level 3\n"); v *= 2 else: v *= 10 return v
def ThrowHead(gibname, dm, *qwp_extra): qc.self.setmodel(gibname) qc.self.frame = 0 qc.self.nextthink = -1 qc.self.movetype = defs.MOVETYPE_BOUNCE qc.self.takedamage = defs.DAMAGE_NO qc.self.solid = defs.SOLID_NOT qc.self.view_ofs = Vector(0, 0, 8) qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) qc.self.velocity = VelocityForDamage(dm) qc.self.origin %= Vector(None, None, qc.self.origin.z - 24) qc.self.flags -= qc.self.flags & defs.FL_ONGROUND qc.self.avelocity = weapons.crandom() * Vector(0, 600, 0)