+void vehicles_regen_resource(entity this, float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale, int resource)
+{
+ float resource_amount = GetResource(this, resource);
+
+ if(resource_amount < field_max)
+ if(timer + rpause < time)
+ {
+ if(_healthscale)
+ regen = regen * (resource_amount / this.max_health);
+
+ SetResource(this, resource, min(resource_amount + regen * delta_time, field_max));
+
+ if(this.owner)
+ this.owner.(regen_field) = (GetResource(this, resource) / field_max) * 100;
+ }
+}
+