30 {
32 Class.CastTo(entity,item);
33
34 if (entity != null)
35 {
36 entity.SetAllowDamage(true);
37 }
38
39 int health_levels_count = item.GetNumberOfHealthLevels(damage_zone);
40 float kit_repair_cost_adjusted;
41 float new_quantity;
42
43 int target_level = Math.Clamp(item.GetHealthLevel(damage_zone) - 1, 0, health_levels_count - 1);
44 float health_coef;
46 {
47 target_level = Math.Clamp(target_level, GameConstants.STATE_WORN, health_levels_count - 1);
48 }
49 health_coef = item.GetHealthLevelValue(target_level,damage_zone);
50
51
52 if (kit && kit.ConfigGetInt("repairKitType"))
53 {
54 bool kit_has_quantity = kit.HasQuantity();
55 float cur_kit_quantity = kit.GetQuantity();
57
58 if (cur_kit_quantity > kit_repair_cost_per_level)
59 {
60 kit_repair_cost_adjusted = kit_repair_cost_per_level;
61
62 kit_repair_cost_adjusted = Math.Clamp(kit_repair_cost_adjusted, 0, 100);
63 if (use_kit_qty)
64 {
65 new_quantity = kit.GetQuantity() - kit_repair_cost_adjusted;
67 }
68 }
69 else if (!kit_has_quantity)
70 {
71 }
72 else
73 {
74 if (use_kit_qty)
75 {
77 }
78 }
79 }
80
81 if (item.GetHealth01(damage_zone,"Health") < health_coef)
82 {
83 item.SetHealth01(damage_zone,"Health",health_coef);
84 }
85
86 if (entity != null)
87 {
88 entity.ProcessInvulnerabilityCheck(entity.GetInvulnerabilityTypeString());
89 }
90 }
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
bool CanRepairToPristine(PlayerBase player)
Player can repair items to 100%; currently unused.
float GetKitRepairCost(ItemBase repair_kit, Object item)
bool CanBeRepairedToPristine(Object item)
Item can be repaired to 100%.