Advertisement
edisleado

Untitled

Aug 25th, 2015
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.26 KB | None | 0 0
  1. --local mark_civilians = true -- Allow marking of civilians
  2. --local mark_civilians_vocal = false -- Allow vocals while marking civilians
  3. --local prioritize_inspire_shout = false -- Prioritize inspire revive over other shouts
  4. --local stealth_inspire = false -- Allow inspire to be used in stealth
  5.  
  6. if string.lower(RequiredScript) == "lib/units/beings/player/states/playerstandard" then
  7.  
  8. PlayerStandard.MARK_CIVILIANS_VOCAL = false
  9.  
  10. local _get_interaction_target_original = PlayerStandard._get_interaction_target
  11. local _get_intimidation_action_original = PlayerStandard._get_intimidation_action
  12.  
  13. function PlayerStandard:_get_interaction_target(char_table, my_head_pos, cam_fwd, ...)
  14. local range = tweak_data.player.long_dis_interaction.highlight_range * managers.player:upgrade_value("player", "intimidate_range_mul", 1) * managers.player:upgrade_value("player", "passive_intimidate_range_mul", 1)
  15.  
  16. for u_key, u_data in pairs(managers.enemy:all_civilians()) do
  17. if u_data.unit:movement():cool() then
  18. self:_add_unit_to_char_table(char_table, u_data.unit, 1, range, false, false, 0.001, my_head_pos, cam_fwd)
  19. end
  20. end
  21.  
  22. return _get_interaction_target_original(self, char_table, my_head_pos, cam_fwd, ...)
  23. end
  24.  
  25. function PlayerStandard:_get_intimidation_action(prime_target, ...)
  26. if prime_target and prime_target.unit_type == 1 and prime_target.unit:movement():cool() then
  27. if not PlayerStandard.MARK_CIVILIANS_VOCAL then
  28. prime_target.unit:contour():add(managers.player:has_category_upgrade("player", "marked_enemy_extra_damage") and "mark_enemy_damage_bonus" or "mark_enemy", true, managers.player:upgrade_value("player", "mark_enemy_time_multiplier", 1))
  29. end
  30.  
  31. return PlayerStandard.MARK_CIVILIANS_VOCAL and "mark_cop_quiet" or nil, false, prime_target
  32. end
  33.  
  34. return _get_intimidation_action_original(self, prime_target, ...)
  35. end
  36.  
  37. local _get_unit_intimidation_action_original = PlayerStandard._get_unit_intimidation_action
  38.  
  39. function PlayerStandard:_get_unit_intimidation_action(intimidate_enemies, intimidate_civilians, intimidate_teammates, only_special_enemies, intimidate_escorts, intimidation_amount, primary_only, detect_only, ...)
  40. _get_unit_intimidation_action_original(self, intimidate_enemies, intimidate_civilians, intimidate_teammates, only_special_enemies, intimidate_escorts, intimidation_amount, primary_only, detect_only, ...)
  41. local char_table = {}
  42. local unit_type_enemy = 0
  43. local unit_type_civilian = 1
  44. local unit_type_teammate = 2
  45. local unit_type_camera = 3
  46. local unit_type_turret = 4
  47. local cam_fwd = self._ext_camera:forward()
  48. local my_head_pos = self._ext_movement:m_head_pos()
  49. local range_mul = managers.player:upgrade_value("player", "intimidate_range_mul", 1) * managers.player:upgrade_value("player", "passive_intimidate_range_mul", 1)
  50. local intimidate_range_civ = tweak_data.player.long_dis_interaction.intimidate_range_civilians * range_mul
  51. local intimidate_range_ene = tweak_data.player.long_dis_interaction.intimidate_range_enemies * range_mul
  52. local highlight_range = tweak_data.player.long_dis_interaction.highlight_range * range_mul
  53. if intimidate_enemies then
  54. local enemies = managers.enemy:all_enemies()
  55. for u_key, u_data in pairs(enemies) do
  56. if u_data.unit:movement():team() ~= self._unit:movement():team() and not u_data.unit:anim_data().hands_tied and (u_data.char_tweak.priority_shout or not only_special_enemies) then
  57. if managers.groupai:state():whisper_mode() then
  58. if u_data.char_tweak.silent_priority_shout and u_data.unit:movement():cool() then
  59. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_enemy, highlight_range, false, false, 0.01, my_head_pos, cam_fwd)
  60. elseif not u_data.unit:movement():cool() then
  61. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_enemy, intimidate_range_ene, false, false, 100, my_head_pos, cam_fwd)
  62. end
  63. elseif u_data.char_tweak.priority_shout then
  64. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_enemy, highlight_range, false, false, 0.01, my_head_pos, cam_fwd)
  65. else
  66. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_enemy, intimidate_range_ene, false, false, 100, my_head_pos, cam_fwd)
  67. end
  68. end
  69. end
  70. end
  71. if intimidate_civilians then
  72. local civilians = managers.enemy:all_civilians()
  73. for u_key, u_data in pairs(civilians) do
  74. if u_data.unit:in_slot(21) and not u_data.unit:movement():cool() then
  75. local is_escort = u_data.char_tweak.is_escort
  76. if not is_escort or intimidate_escorts then
  77. local dist = is_escort and 300 or intimidate_range_civ
  78. local prio = is_escort and 100000 or 0.001
  79. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_civilian, dist, false, false, prio, my_head_pos, cam_fwd)
  80. end
  81. elseif u_data.unit:movement():cool() and mark_civilians then
  82. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_civilian, highlight_range, false, false, 0.001, my_head_pos, cam_fwd)
  83. end
  84. end
  85. end
  86. if intimidate_teammates then
  87. if not managers.groupai:state():whisper_mode() then
  88. local criminals = managers.groupai:state():all_char_criminals()
  89. for u_key, u_data in pairs(criminals) do
  90. local added
  91. if u_key ~= self._unit:key() then
  92. local rally_skill_data = self._ext_movement:rally_skill_data()
  93. if rally_skill_data and rally_skill_data.long_dis_revive and rally_skill_data.range_sq > mvector3.distance_sq(self._pos, u_data.m_pos) then
  94. local needs_revive
  95. if u_data.unit:base().is_husk_player then
  96. needs_revive = u_data.unit:interaction():active() and u_data.unit:movement():need_revive() and u_data.unit:movement():current_state_name() ~= "arrested"
  97. else
  98. needs_revive = u_data.unit:character_damage():need_revive()
  99. end
  100. if needs_revive then
  101. if prioritize_inspire_shout then
  102. intimidate_enemies = false
  103. intimidate_civilians = false
  104. end
  105. added = true
  106. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_teammate, 100000, true, true, 5000, my_head_pos, cam_fwd)
  107. end
  108. end
  109. end
  110. if not added and not u_data.is_deployable and not u_data.unit:movement():downed() and not u_data.unit:base().is_local_player then
  111. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_teammate, 100000, true, true, 0.01, my_head_pos, cam_fwd)
  112. end
  113. end
  114. elseif stealth_inspire then
  115. local criminals = managers.groupai:state():all_player_criminals()
  116. for u_key, u_data in pairs(criminals) do
  117. local added
  118. if u_key ~= self._unit:key() then
  119. local rally_skill_data = self._ext_movement:rally_skill_data()
  120. if rally_skill_data and rally_skill_data.long_dis_revive and rally_skill_data.range_sq > mvector3.distance_sq(self._pos, u_data.m_pos) then
  121. local needs_revive
  122. if u_data.unit:base().is_husk_player then
  123. needs_revive = u_data.unit:interaction():active() and u_data.unit:movement():need_revive() and u_data.unit:movement():current_state_name() ~= "arrested"
  124. else
  125. needs_revive = u_data.unit:character_damage():need_revive()
  126. end
  127. if needs_revive then
  128. if prioritize_inspire_shout then
  129. intimidate_enemies = false
  130. intimidate_civilians = false
  131. end
  132. added = true
  133. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_teammate, 100000, true, true, 5000, my_head_pos, cam_fwd)
  134. end
  135. end
  136. end
  137. if not added and not u_data.is_deployable and not u_data.unit:movement():downed() and not u_data.unit:base().is_local_player then
  138. self:_add_unit_to_char_table(char_table, u_data.unit, unit_type_teammate, 100000, true, true, 0.01, my_head_pos, cam_fwd)
  139. end
  140. end
  141. end
  142. end
  143. if intimidate_enemies then
  144. if managers.groupai:state():whisper_mode() then
  145. for _, unit in ipairs(SecurityCamera.cameras) do
  146. if alive(unit) and unit:enabled() and not unit:base():destroyed() then
  147. local dist = 2000
  148. local prio = 0.001
  149. self:_add_unit_to_char_table(char_table, unit, unit_type_camera, dist, false, false, prio, my_head_pos, cam_fwd, {unit})
  150. end
  151. end
  152. end
  153. local turret_units = managers.groupai:state():turrets()
  154. if turret_units then
  155. for _, unit in pairs(turret_units) do
  156. if alive(unit) and unit:movement():team().foes[self._ext_movement:team().id] then
  157. self:_add_unit_to_char_table(char_table, unit, unit_type_turret, 2000, false, false, 0.01, my_head_pos, cam_fwd, {unit})
  158. end
  159. end
  160. end
  161. end
  162. local prime_target = self:_get_interaction_target(char_table, my_head_pos, cam_fwd)
  163. return self:_get_intimidation_action(prime_target, char_table, intimidation_amount, primary_only, detect_only)
  164. end
  165.  
  166. end
  167.  
  168. if string.lower(RequiredScript) == "lib/tweak_data/charactertweakdata" and mark_civilians then
  169.  
  170. local _init_civilian_original = CharacterTweakData._init_civilian
  171.  
  172. function CharacterTweakData:_init_civilian(...)
  173. _init_civilian_original(self, ...)
  174. self.civilian.silent_priority_shout = "f37"
  175. self.civilian_female.silent_priority_shout = "f37"
  176. self.bank_manager.silent_priority_shout = "f37"
  177. end
  178.  
  179. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement