Tests with amputating legs

This commit is contained in:
Pao
2023-02-06 19:40:36 +01:00
parent cb2fe5e36d
commit ff7915abbd
12 changed files with 299 additions and 14 deletions

View File

@@ -0,0 +1,24 @@
-- Thanks to Glytcher and Matías N. Salas for helping out with this
function SetMissingFootAnimation(check)
local player = getPlayer()
if check then
player:setVariable("IsCrawling", "true")
else
player:setVariable("IsCrawling", "false")
end
-- if isClient() then
-- sendClientCommand("TOC", "SetCrawlAnimation", {})
-- end
end

View File

@@ -208,6 +208,26 @@ end
-- ANIMATIONS
-----------------------
Commands["SetCrawlAnimation"] = function(args)
local source = getPlayer()
local player = getPlayerByOnlineID(args.id)
if source ~= player then
if args.hasInjury then
player:setVariable('SetCrawlAnimation', 'true');
else
player:setVariable('SetCrawlAnimation', 'false');
end
end
end
-- Base stuff
local function OnTocServerCommand(module, command, args)

View File

@@ -76,14 +76,18 @@ function ISInventoryPane:onMouseDoubleClick(x, y)
local item_to_check = self.items[self.mouseOverOption]
local player_inventory = getPlayerInventory(self.player).inventory
if instanceof(item_to_check, "InventoryItem") then
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsInstalledProsthesis(item_to_check.items[1]) then
--print("TOC: Can't double click this item")
else
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
-----------------------------------------------------------------------------------
-- TODO THIS IS DISABLED ONLY FOR TEST!!!!! REMEMBER TO RESTORE IT
-----------------------------------------------------------------------------------
end
-- if instanceof(item_to_check, "InventoryItem") then
-- og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
-- elseif CheckIfItemIsAmputatedLimb(item_to_check.items[1]) or CheckIfItemIsInstalledProsthesis(item_to_check.items[1]) then
-- --print("TOC: Can't double click this item")
-- else
-- end
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
@@ -96,13 +100,17 @@ function ISInventoryPane.getActualItems(items)
local ret = og_ISInventoryPaneGetActualItems(items)
-- This is gonna be slower than just overriding the function but hey it's more compatible
-----------------------------------------------------------------------------------
-- TODO THIS IS DISABLED ONLY FOR TEST!!!!! REMEMBER TO RESTORE IT
-----------------------------------------------------------------------------------
for i = 1, #ret do
local item_full_type = ret[i]:getFullType()
if string.find(item_full_type, "Amputation_") or string.find(item_full_type, "Prost_") then
table.remove(ret, i)
end
end
-- for i = 1, #ret do
-- local item_full_type = ret[i]:getFullType()
-- if string.find(item_full_type, "Amputation_") or string.find(item_full_type, "Prost_") then
-- table.remove(ret, i)
-- end
-- end
return ret
end

View File

@@ -176,12 +176,29 @@ end
-- MAIN UPDATE FUNCTIONS
local testOnAnimEvent = IsoGameCharacter.OnAnimEvent
function IsoGameCharacter.OnAnimEvent(animLayer, animEvent)
print("ENTERING ON ANIM EVENT!!!")
end
local function TocUpdateOnTick()
local player = getPlayer()
if player == nil then
return
end
local toc_data = player:getModData().TOC
if toc_data ~= nil then
CheckIfPlayerIsInfected(player, toc_data)

View File

@@ -24,6 +24,14 @@ TOC_Commands["AskDamageOtherPlayer"] = function(_, arg)
end
-------- ANIMATIONS
TOC_Commands["SetCrawlAnimation"] = function(player, args)
local player_id = player:getOnlineID()
sendServerCommand(player, "TOC", "SetCrawlAnimation", {})
end

View File

@@ -18,7 +18,7 @@ local function addBodyLocationBefore(newLocation, movetoLocation)
list:remove(list:size()-1)
list:remove(newItem)
local i = group:indexOf(movetoLocation)
list:add(i, newItem)
end
@@ -70,6 +70,7 @@ local group = BodyLocations.getGroup("Human")
addBodyLocationBefore("TOC_ArmRight", "Shoes")
addBodyLocationBefore("TOC_ArmLeft", "Shoes")
addBodyLocationBefore("TOC_LegLeft", "Shoes")
addBodyLocationBefore("TOC_ArmRightProsthesis", "Shoes")
addBodyLocationBefore("TOC_ArmLeftProsthesis", "Shoes")