Fooksie

autocams

Jan 29th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. # lib/states/ingameaccesscamera
  2.  
  3. local index=1
  4. local _enter=IngameAccessCamera.at_enter
  5. local _update=IngameAccessCamera.update
  6.  
  7. function IngameAccessCamera:at_enter(...)
  8.     _enter(self, ...)
  9.     for i, cam in ipairs(self._cameras) do
  10.         if i~=self._camera_data.index then
  11.             self:vis_on_cam(cam.access_camera)
  12.             end
  13.         end
  14.     end
  15.  
  16. function IngameAccessCamera:update(...)
  17.     _update(self, ...)
  18.     index=index >= #self._cameras and 1 or index+1
  19.     if index~=self._camera_data.index then
  20.         self:vis_on_cam(self._cameras[index].access_camera)
  21.         end
  22.     end
  23.  
  24. function IngameAccessCamera:vis_on_cam(cam)
  25.     if cam and cam:has_camera_unit() and not cam:value("destroyed") then
  26.         local units=World:find_units_quick("all", 3, 16, 21, managers.slot:get_mask("enemies"))
  27.         self._cam_unit:set_position(cam:camera_position())
  28.         for i, unit in ipairs(units) do
  29.             if not self._cam_unit:raycast("ray", unit:movement():m_head_pos(), cam:camera_position(), "ray_type", "ai_vision", "slot_mask", managers.slot:get_mask("world_geometry"), "report") then
  30.                 if managers.player:upgrade_value("player", "sec_camera_highlight", false) and unit:base()._tweak_table and (managers.groupai:state():whisper_mode() and tweak_data.character[unit:base()._tweak_table].silent_priority_shout or tweak_data.character[unit:base()._tweak_table].priority_shout) then
  31.                     managers.game_play_central:auto_highlight_enemy(unit, true)
  32.                     end
  33.                 end
  34.             end
  35.         self._cam_unit:set_position(self._last_access_camera:camera_position())
  36.         end
  37.     end
Advertisement
Add Comment
Please, Sign In to add comment