public void HealthPatchOnCollision(coItemData healthkit_datablock, coSceneObject healthkit_instance, coPlayer player) { if (player.getDamageLevel() <= 0.00 || player.getState() == "Dead") return; player.applyRepair(healthkit_datablock["repairAmount"].AsFloat()); healthkit_instance.call("schedulePop"); //coGameConnection client = player["client"]; //if (!client.isObject()) // return; //using (BackgroundWorker bwr = new BackgroundWorker()) // { // bwr.DoWork += bwr_UpdateHealth; // bwr.RunWorkerAsync(new HealthKitHelper(player, healthkit_instance)); // } AudioServerPlay3D("HealthUseSound", player.getTransform()); }
public void PlayerPlayCelAnimation(coPlayer player, string anim) { if (player.getState() != "Dead") player.setActionThread(string.Format("cel{0}", anim), false, true); }
public void ArmorDamage(coPlayerData datablock, coPlayer player, TransformF position, coPlayer sourceobject, float damage, string damageType) { if (!player.isObject()) return; if (player.getState() == "Dead") return; if (damage == 0.0) return; player.applyDamage(damage); const string location = "Body"; //PlayerUpdateHealth(player); coGameConnection client = player["client"]; //Only continue if it is a player, if it is an AI return. if (!client.isObject()) return; coGameConnection sourceClient = null; if (sourceobject != 0) sourceClient = sourceobject["client"]; if (player.getDamageLevel() >= 99) player.unmountImage(0); // Determine damage direction if (damageType != "Suicide") PlayerSetDamageDirection(player, sourceobject, position); if (player.getState() == "Dead") GameConnectionOnDeath(client, sourceobject, sourceClient, damageType, location); }
public void ArmorOnDamage(coPlayerData datablock, coPlayer player, float delta) { // This method is invoked by the ShapeBase code whenever the // object's damage level changes. if ((delta <= 0) || player.getState() == "Dead") return; // Apply a damage flash player.setDamageFlash(1); // If the pain is excessive, let's hear about it. if (delta > 10) PlayerPlayPain(player); }
public void ArmorOnCollision(coPlayerData datablock, coPlayer player, coShapeBase col) { if (player.getState() == "Dead") return; // Try and pickup all items if (col.getClassName() == "Item") { player.call("pickup", col); return; } //AI are not allowed to drive they are lousey drivers.... coGameConnection client = player["client"]; if (!client.isObject()) return; //Mount Vehicle. if ((console.getTypeMask(col) & (UInt32)SceneObjectTypesAsUint.GameBaseObjectType) != (UInt32)SceneObjectTypesAsUint.GameBaseObjectType) return; coVehicleData db = col.getDataBlock(); if (((db.getClassName() == "WheeledVehicleData") || player["mountVehicle"].AsBool() || player.getState() == "Move" || col["mountable"].AsBool())) return; // Only mount drivers for now. ((coGameConnection)player["client"]).setFirstPerson(false); // For this specific example, only one person can fit // into a vehicle int mount = col.getMountNodeObject(0); if (mount > 0) return; // For this specific FPS Example, always mount the player to node 0 col.mountObject(player, 0, new TransformF(true)); player["mVehicle"] = col; }