-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 013221f
Showing
12 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Hooks:PostHook(CopDamage, "damage_melee", "meleeinstakillonhostages", function(self,attack_data) | ||
if immdomcops.settings.meleekill == true and immdomcops.hostages[self._unit:id()] == true and attack_data.damage > 0 then | ||
attack_data.damage = 999999 | ||
self._unit:character_damage():set_invulnerable(false) | ||
self._unit:character_damage():set_immortal(false) | ||
self._unit:network():send("set_unit_invulnerable", false, false) | ||
self:damage_melee(attack_data) | ||
|
||
immdomcops.hostages[self._unit:id()] = nil | ||
managers.money:civilian_killed() -- thats what you get for killing prisoners of war lmao | ||
end | ||
end ) | ||
|
||
Hooks:PostHook(CopDamage, "die", "postcopdeathcountourcleanup", function(self,attack_data) | ||
if immdomcops.settings.highlights == true then | ||
self._unit:contour():remove( "friendly" , true ) | ||
self._unit:contour():remove( "highlight_character" , true ) -- not really needed cuz we dont use this highlight, but this should help in case clients run intim. highlights or something | ||
end | ||
end ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Hooks:PostHook(CopMovement, "action_request", "postactionrequesttweakunitdata" , function(self,action_desc) | ||
|
||
if not Network:is_server() then | ||
return | ||
end | ||
|
||
if self._unit:base().mic_is_being_moved then -- idk, some check if unit is busy or something? ask Undeadsewer, thats his code | ||
return | ||
end | ||
|
||
if managers.enemy:is_civilian( self._unit ) then | ||
return | ||
end | ||
|
||
if self._unit:base():char_tweak().access == "teamAI4" then -- Check if 'cop' action is requested by an actuall cop and not by Hoxton or other friendly ai, who are supposed to be immortal | ||
return | ||
end | ||
|
||
-- Much better way to make sure that wrong 'enemies' dont get immortal/mortal is to only allow enemies from a list that we make ourselves to become mortal/immortal | ||
-- Pros: | ||
-- 1) less bugs | ||
-- Cons: | ||
-- 1) will take time a bit of time to figure out all enemy types that we need | ||
-- 2) will have to make updates if ovkl adds more units who can give up | ||
|
||
-- teamAI4 workaround seems to work fine since its used for every allied 'cop' as far as i know | ||
-- 1.3 update: everything works great for now, so unless ovkl patches a new ally who works differently we are good | ||
|
||
if managers.groupai:state():whisper_mode() and action_desc.variant == "tied_all_in_one" then -- Only add highlight in stealth | ||
if immdomcops.settings.highlights == true then | ||
self._unit:contour():add( "friendly" , true ) | ||
end | ||
elseif action_desc.variant == "hands_up" then -- If hands are up activate highlights and invulnerability, and sync that info to clients | ||
if immdomcops.settings.highlights == true then | ||
self._unit:contour():add( "friendly" , true ) | ||
end | ||
self._unit:network():send("set_unit_invulnerable", true, true) | ||
self._unit:character_damage():set_invulnerable(true) | ||
self._unit:character_damage():set_immortal(true) | ||
elseif action_desc.variant == "hands_back" then | ||
-- dont remove highlights if getting on knees | ||
elseif action_desc.variant == "tied" then | ||
-- dont remove highlights if cuffed | ||
immdomcops.hostages[self._unit:id()] = true -- add unit's id to our list of hostages for melee insta kill tracking | ||
else | ||
if immdomcops.hostages[self._unit:id()] then -- remove unit's id if they are no longer a hostage | ||
immdomcops.hostages[self._unit:id()] = nil | ||
end | ||
|
||
if immdomcops.settings.highlights == true then -- remove highlights | ||
self._unit:contour():remove( "friendly" , true ) | ||
end | ||
|
||
if managers.groupai:state():is_enemy_converted_to_criminal(self._unit) then -- but if enemy is converted add a highlight | ||
if immdomcops.settings.highlights == true then | ||
self._unit:contour():add( "friendly" , true ) | ||
end | ||
end | ||
|
||
if self._unit:character_damage().set_immortal then -- check that unit can be immortal | ||
if self._unit:character_damage()._immortal ~= false then -- check that unit is allready immortal, then remove immortality and sync that to clients | ||
self._unit:character_damage():set_invulnerable(false) | ||
self._unit:character_damage():set_immortal(false) | ||
self._unit:network():send("set_unit_invulnerable", false, false) | ||
end | ||
end | ||
end | ||
end ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
if not immdomcops then | ||
_G.immdomcops = {} | ||
immdomcops.modpath = ModPath | ||
immdomcops.hostages = {} | ||
immdomcops.settings = { | ||
highlights = true, | ||
meleekill = true | ||
} | ||
|
||
function immdomcops:Save() | ||
local file = io.open(SavePath .. 'IMMDOMCOP_save.txt', 'w+') | ||
if file then | ||
file:write(json.encode(immdomcops.settings)) | ||
file:close() | ||
end | ||
end | ||
|
||
function immdomcops:Load() | ||
local file = io.open(SavePath .. 'IMMDOMCOP_save.txt', 'r') | ||
if file then | ||
for k, v in pairs(json.decode(file:read('*all')) or {}) do | ||
immdomcops.settings[k] = v | ||
end | ||
file:close() | ||
end | ||
end | ||
|
||
immdomcops:Load() | ||
immdomcops:Save() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<mod name="Immortal Dominated Cops" author="irbizzelus" color="Color(0.85,0,0.85)"> | ||
<AssetUpdates id="39224" provider="modworkshop" version="1.41"/> | ||
</mod> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
dofile(ModPath .. "lua/menu.lua") | ||
|
||
Hooks:Add('LocalizationManagerPostInit', 'immdomcops_loc', function(loc) | ||
immdomcops:Load() | ||
|
||
local lang = "en" | ||
local file = io.open(SavePath .. 'blt_data.txt', 'r') | ||
if file then | ||
for k, v in pairs(json.decode(file:read('*all')) or {}) do | ||
if k == "language" then | ||
lang = v | ||
end | ||
end | ||
file:close() | ||
end | ||
|
||
if lang == "ru" then | ||
loc:load_localization_file(immdomcops.modpath .. 'menus/lang/immdomcopsmenu_ru.txt', false) | ||
elseif lang == "fr" then -- thanks Tardoss | ||
loc:load_localization_file(immdomcops.modpath .. 'menus/lang/immdomcopsmenu_fr.txt', false) | ||
elseif lang == "chs" then -- thanks Arknights | ||
loc:load_localization_file(immdomcops.modpath .. 'menus/lang/immdomcopsmenu_chs.txt', false) | ||
elseif lang == "es" then -- thanks MaxiAccess | ||
loc:load_localization_file(immdomcops.modpath .. 'menus/lang/immdomcopsmenu_es.txt', false) | ||
else | ||
loc:load_localization_file(immdomcops.modpath .. 'menus/lang/immdomcopsmenu_en.txt', false) | ||
end | ||
end) | ||
|
||
Hooks:Add('MenuManagerInitialize', 'immdomcops_init', function(menu_manager) | ||
MenuCallbackHandler.idc_immdomcopssave = function(this, item) | ||
immdomcops:Save() | ||
end | ||
|
||
MenuCallbackHandler.idc_donothing = function(this, item) | ||
-- do nothing | ||
end | ||
|
||
MenuCallbackHandler.idc_cb_highlights = function(this, item) | ||
immdomcops.settings[item:name()] = item:value() == 'on' | ||
immdomcops:Save() | ||
end | ||
|
||
MenuCallbackHandler.idc_cb_meleekill = function(this, item) | ||
immdomcops.settings[item:name()] = item:value() == 'on' | ||
immdomcops:Save() | ||
end | ||
|
||
immdomcops:Load() | ||
|
||
MenuHelper:LoadFromJsonFile(immdomcops.modpath .. 'menus/immdomcopsmenu.txt', immdomcops, immdomcops.settings) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"menu_id": "immdomcopsmenu", | ||
"parent_menu_id": "blt_options", | ||
"title": "immdomcops_title", | ||
"description": "immdomcops_desc", | ||
"back_callback": "idc_immdomcopssave", | ||
"items": | ||
[ | ||
{ | ||
"type" : "toggle", | ||
"id" : "highlights", | ||
"title" : "highlights", | ||
"description" : "highlights_desc", | ||
"callback" : "idc_cb_highlights", | ||
"value" : "highlights", | ||
"default_value" : true | ||
}, | ||
{ | ||
"type" : "toggle", | ||
"id" : "meleekill", | ||
"title" : "meleekill", | ||
"description" : "meleekill_desc", | ||
"callback" : "idc_cb_meleekill", | ||
"value" : "meleekill", | ||
"default_value" : true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"immdomcops_title": "Immortal dominated cops", | ||
"immdomcops_desc": "Immortal dominated cops(已被恐吓的警察无敌)模组设置", | ||
"highlights": "高亮轮廓", | ||
"highlights_desc": "勾选或取消勾选以决定是否高亮被恐吓的警察的轮廓", | ||
"meleekill": "近战一击必杀", | ||
"meleekill_desc": "勾选后主机近战攻击已经完全投降的敌人会直接将其击杀" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"immdomcops_title": "Immortal dominated cops", | ||
"immdomcops_desc": "", | ||
"highlights": "Highlights", | ||
"highlights_desc": "Enable or disable intimidated enemy highlighs", | ||
"meleekill": "Melee insta-kill", | ||
"meleekill_desc": "If enabled host can insta kill any cop who has given up completely with a melee attack" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"immdomcops_title": "Immortal dominated cops", | ||
"immdomcops_desc": "", | ||
"highlights": "Contornos", | ||
"highlights_desc": "Activa o desactiva los contornos de los enemigos dominados", | ||
"meleekill": "Insta-Muerte cuerpo a cuerpo", | ||
"meleekill_desc": "Si se activa el host puede matar instantáneamente a cualquier policía que se haya rendido completamente, con un ataque cuerpo a cuerpo" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"immdomcops_title": "Immortal dominated cops", | ||
"immdomcops_desc": "", | ||
"highlights": "Surbrillance", | ||
"highlights_desc": "Active ou désactive la surbrillance des ennemis dominés", | ||
"meleekill": "Meutre instantanée via mélée", | ||
"meleekill_desc": "Si activer, l'hôte peut tuer instantanément un flic qui s'est rendu avec une attaque de mêlée" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"immdomcops_title": "Immortal dominated cops", | ||
"immdomcops_desc": "", | ||
"highlights": "Подсветка", | ||
"highlights_desc": "Включить или выключить подсветку сдавшихся врагов.", | ||
"meleekill": "Убийство с рукопашного оружия", | ||
"meleekill_desc": "Позволяет лидеру лобби убивать полностью сдавшихся врагов оружием ближнего боя" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name" : "Immortal dominated cops", | ||
"description" : "Gives immportality and visual highlight to dominated enemies.", | ||
"author" : "irbizzelus\nBased on Undeadsewer's Intimidated Outlines", | ||
"contact" : "Steam profile link is on my modworkshop account\nUndeadsewer: [email protected]", | ||
"version" : "1.41", | ||
"hooks" : [ | ||
{ "hook_id" : "lib/units/enemies/cop/copmovement", "script_path" : "lua/copmovement.lua" }, | ||
{ "hook_id" : "lib/units/enemies/cop/copdamage", "script_path" : "lua/copdamage.lua" }, | ||
{ "hook_id": "lib/managers/menumanager", "script_path": "menus/immdomcopsmenu.lua"} | ||
], | ||
} |