static int CheckArmor(edict_t ent, float[] point, float[] normal, int damage, int te_sparks, int dflags) { gclient_t client; int save; int index; gitem_t armor; if (damage == 0) { return(0); } client = ent.client; if (client == null) { return(0); } if ((dflags & Defines.DAMAGE_NO_ARMOR) != 0) { return(0); } index = GameItems.ArmorIndex(ent); if (index == 0) { return(0); } armor = GameItems.GetItemByIndex(index); gitem_armor_t garmor = (gitem_armor_t)armor.info; if (0 != (dflags & Defines.DAMAGE_ENERGY)) { save = (int)Math.Ceiling(garmor.energy_protection * damage); } else { save = (int)Math.Ceiling(garmor.normal_protection * damage); } if (save >= client.pers.inventory[index]) { save = client.pers.inventory[index]; } if (save == 0) { return(0); } client.pers.inventory[index] -= save; SpawnDamage(te_sparks, point, normal, save); return(save); }
public gitem_t(string classname, EntInteractAdapter pickup, ItemUseAdapter use, ItemDropAdapter drop, EntThinkAdapter weaponthink, string pickup_sound, string world_model, int world_model_flags, string view_model, string icon, string pickup_name, int count_width, int quantity, string ammo, int flags, int weapmodel, gitem_armor_t info, int tag, string precaches) { this.classname = classname; this.pickup = pickup; this.use = use; this.drop = drop; this.weaponthink = weaponthink; this.pickup_sound = pickup_sound; this.world_model = world_model; this.world_model_flags = world_model_flags; this.view_model = view_model; this.icon = icon; this.pickup_name = pickup_name; this.count_width = count_width; this.quantity = quantity; this.ammo = ammo; this.flags = flags; this.weapmodel = weapmodel; this.info = info; this.tag = tag; this.precaches = precaches; this.index = id++; }