Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local color_standard = Color('197FFF') -- Blue (Standard)
- local color_ap = Color('19FF19') -- Green (AP)
- local color_broken = Color('FF1919') -- Blue (Standard)
- Hooks:PostHook(SentryGunWeapon, "init", "SentryGunWeapon_init", function(self, unit)
- self._laser_align = self._laser_align or self._unit:get_object(Idstring("fire"))
- end)
- Hooks:PostHook(SentryGunWeapon, "setup", "SentryGunWeapon_setup", function(self, setup_data, damage_multiplier)
- if self._laser_unit and self._laser_align and self._unit:movement():team().id == "criminal1" then
- self._laser_unit:base():set_color(color_standard) -- Blue (Standard)
- elseif not self._laser_unit then
- -- log("Sentry Lasers: No <self._laser_unit> found for setup!")
- self._laser_align = self._laser_align or self._unit:get_object(Idstring("fire"))
- end
- end)
- Hooks:PostHook(SentryGunWeapon, "_set_fire_mode", "SentryGunWeapon__set_fire_mode", function(self, use_armor_piercing)
- if self._laser_unit and self._laser_align then
- if use_armor_piercing then
- self._laser_unit:base():set_color(color_ap) -- Green (AP)
- else
- self._laser_unit:base():set_color(color_standard) -- Blue (Standard)
- end
- elseif not self._laser_unit then
- -- log("Sentry Lasers: No <self._laser_unit> found for setfiremode!")
- self._laser_align = self._laser_align or self._unit:get_object(Idstring("fire"))
- end
- end)
- Hooks:PostHook(SentryGunWeapon, "stop_autofire", "SentryGunWeapon_stop_autofire", function(self)
- if self._laser_unit and self._laser_align and self:out_of_ammo() then
- self._laser_unit:base():set_color(color_broken) -- Red (No ammo)
- elseif not self._laser_unit then
- -- log("Sentry Lasers: No <self._laser_unit> found for stopautofire!")
- self._laser_align = self._laser_align or self._unit:get_object(Idstring("fire"))
- end
- end)
- --from offy with love <3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement