Cleaning stuff
This commit is contained in:
@@ -102,46 +102,15 @@ ItemsController.Zombie = {}
|
|||||||
|
|
||||||
---Set an amputation to a zombie
|
---Set an amputation to a zombie
|
||||||
---@param zombie IsoZombie
|
---@param zombie IsoZombie
|
||||||
function ItemsController.Zombie.SpawnAmputationItem(zombie)
|
---@param amputationFullType string Full Type
|
||||||
-- TODO Set texture ID
|
function ItemsController.Zombie.SpawnAmputationItem(zombie, amputationFullType)
|
||||||
local itemVisualsList = zombie:getItemVisuals()
|
|
||||||
local ignoredLimbs = {}
|
|
||||||
|
|
||||||
if itemVisualsList == nil then return end
|
|
||||||
|
|
||||||
for i=0, itemVisualsList:size() - 1 do
|
|
||||||
local itemVisual = itemVisualsList:get(i)
|
|
||||||
|
|
||||||
-- TODO Check body location of item and deletes potential amputation to apply
|
|
||||||
local clothingName = itemVisual:getClothingItemName()
|
|
||||||
--print(clothingName)
|
|
||||||
|
|
||||||
if clothingName and luautils.stringStarts(clothingName, StaticData.AMPUTATION_CLOTHING_ITEM_BASE) then
|
|
||||||
TOC_DEBUG.print("added " .. clothingName .. " to ignoredLimbs")
|
|
||||||
ignoredLimbs[clothingName] = clothingName
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
-- TODO Consider highest amputation
|
|
||||||
local usableClothingAmputations = {}
|
|
||||||
|
|
||||||
for i=1, #StaticData.LIMBS_STR do
|
|
||||||
local limbName = StaticData.LIMBS_STR[i]
|
|
||||||
local clothingName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
|
|
||||||
if ignoredLimbs[clothingName] == nil then
|
|
||||||
table.insert(usableClothingAmputations, clothingName)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- TODO Random index
|
|
||||||
local index = ZombRand(1, #usableClothingAmputations)
|
|
||||||
|
|
||||||
local itemVisual = ItemVisual:new()
|
|
||||||
itemVisual:setItemType(usableClothingAmputations[index])
|
|
||||||
|
|
||||||
local texId = ItemsController.Zombie.GetAmputationTexturesIndex(zombie)
|
local texId = ItemsController.Zombie.GetAmputationTexturesIndex(zombie)
|
||||||
|
local itemVisual = ItemVisual:new()
|
||||||
|
itemVisual:setItemType(amputationFullType)
|
||||||
itemVisual:setTextureChoice(texId)
|
itemVisual:setTextureChoice(texId)
|
||||||
|
|
||||||
|
local clothingItem = zombie:getInventory():AddItem(amputationFullType)
|
||||||
|
zombie:setWornItem(clothingItem:getBodyLocation(), clothingItem)
|
||||||
zombie:getItemVisuals():add(itemVisual)
|
zombie:getItemVisuals():add(itemVisual)
|
||||||
zombie:resetModelNextFrame()
|
zombie:resetModelNextFrame()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ function CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
|||||||
|
|
||||||
for k, _ in pairs(amputatedLimbs) do
|
for k, _ in pairs(amputatedLimbs) do
|
||||||
local limbName = k
|
local limbName = k
|
||||||
local index = CommonMethods.GetSide(limbName)
|
local side = CommonMethods.GetSide(limbName)
|
||||||
if dcInst:getIsCut(limbName) and dcInst:getIsVisible(limbName) then
|
if dcInst:getIsCut(limbName) and dcInst:getIsVisible(limbName) then
|
||||||
TOC_DEBUG.print("Added Highest Amputation: " .. limbName)
|
TOC_DEBUG.print("Added Highest Amputation: " .. limbName)
|
||||||
CachedDataHandler.highestAmputatedLimbs[username][index] = limbName
|
CachedDataHandler.highestAmputatedLimbs[username][side] = limbName
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,33 +1,99 @@
|
|||||||
local ItemsController = require("TOC/Controllers/ItemsController")
|
-- local ItemsController = require("TOC/Controllers/ItemsController")
|
||||||
|
-- local StaticData = require("TOC/StaticData")
|
||||||
|
|
||||||
--------------------
|
-- --------------------
|
||||||
|
|
||||||
-- TODO This is low priority, work on it AFTER everything else is ok
|
-- This is low priority, work on it AFTER everything else is ok
|
||||||
|
|
||||||
|
-- I doubt I can get this working, too many limitations
|
||||||
|
|
||||||
|
-- -------------------
|
||||||
|
|
||||||
|
|
||||||
-------------------
|
-- ---@param zombie IsoZombie
|
||||||
|
-- ---@param character IsoPlayer
|
||||||
|
-- ---@param bodyPartType any
|
||||||
|
-- ---@param handWeapon any
|
||||||
|
-- local function test(zombie, character, bodyPartType, handWeapon)
|
||||||
|
|
||||||
local function test(zombie, character, bodyPartType, handWeapon)
|
-- -- LOCAL ONLY!!!
|
||||||
|
-- if character ~= getPlayer() then return end
|
||||||
|
|
||||||
-- LOCAL ONLY!!!
|
-- -- For now, if there's a single TOC item on it don't go any further
|
||||||
if character ~= getPlayer() then return end
|
-- local zombieVisuals = zombie:getItemVisuals()
|
||||||
|
-- if zombieVisuals == nil then return end
|
||||||
|
-- local zombieInv = zombie:getInventory()
|
||||||
|
|
||||||
|
-- local function predicate(item)
|
||||||
|
-- return (item:getType():contains("Amputation_"))
|
||||||
|
-- end
|
||||||
|
-- local foundItem = zombieInv:containsEvalRecurse(predicate)
|
||||||
|
|
||||||
|
-- if foundItem then
|
||||||
|
-- print("Item already in")
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
|
||||||
|
|
||||||
-- TODO Check damage and weapon type
|
|
||||||
|
|
||||||
|
|
||||||
--ItemsController.Zombie.GetAmputationTexturesIndex(zombie)
|
-- local clothingItemFullTypes = {}
|
||||||
ItemsController.Zombie.SpawnAmputationItem(zombie)
|
-- -- Common function?
|
||||||
end
|
-- for i=1, #StaticData.LIMBS_STR do
|
||||||
|
-- local limbName = StaticData.LIMBS_STR[i]
|
||||||
|
-- local clothingName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
|
||||||
|
-- table.insert(clothingItemFullTypes, clothingName)
|
||||||
|
-- end
|
||||||
|
|
||||||
Events.OnHitZombie.Add(test)
|
-- local index = ZombRand(1, #clothingItemFullTypes)
|
||||||
|
-- local randomFullType = clothingItemFullTypes[index]
|
||||||
|
|
||||||
|
|
||||||
-- local function test2(zombie, player, handWeapon, damage)
|
-- local texId = ItemsController.Zombie.GetAmputationTexturesIndex(zombie)
|
||||||
-- if not instanceof(zombie, "IsoZombie") then return end
|
|
||||||
|
|
||||||
|
-- local clothingInventoryItem = zombieInv:AddItem(randomFullType)
|
||||||
|
-- ---@cast clothingInventoryItem InventoryItem
|
||||||
|
|
||||||
|
-- clothingInventoryItem:getVisual():setTextureChoice(texId)
|
||||||
|
-- zombie:setWornItem(clothingInventoryItem:getBodyLocation(), clothingInventoryItem)
|
||||||
|
|
||||||
-- print(zombie)
|
|
||||||
|
|
||||||
|
|
||||||
|
-- local itemVisual = ItemVisual:new()
|
||||||
|
-- itemVisual:setItemType(randomFullType)
|
||||||
|
-- itemVisual:setTextureChoice(texId)
|
||||||
|
-- zombieVisuals:add(itemVisual)
|
||||||
|
-- zombie:resetModelNextFrame()
|
||||||
|
|
||||||
|
-- --zombieInv = zombie:getInventory():add
|
||||||
|
-- -- foundItem = zombieInv:containsEvalRecurse(predicate)
|
||||||
|
|
||||||
|
-- -- print(foundItem)
|
||||||
|
|
||||||
|
|
||||||
|
-- -- zombieInv = zombie:getInventory()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- --ItemsController.Zombie.SpawnAmputationItem(zombie, randomFullType)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- -- local usableClothingAmputations = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- -- local index = ZombRand(1, #usableClothingAmputations)
|
||||||
|
-- -- local amputationFullType = usableClothingAmputations[index]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- Events.OnWeaponHitCharacter.Add(test2)
|
-- Events.OnHitZombie.Add(test)
|
||||||
@@ -13,10 +13,10 @@ end
|
|||||||
---Print debug
|
---Print debug
|
||||||
---@param string string
|
---@param string string
|
||||||
function TOC_DEBUG.print(string)
|
function TOC_DEBUG.print(string)
|
||||||
if isDebugEnabled() then
|
--if isDebugEnabled() then
|
||||||
local runningFile = TOC_DEBUG.getRunningFile()
|
local runningFile = TOC_DEBUG.getRunningFile()
|
||||||
print("[TOC]" .. "[" .. runningFile .. "] " .. tostring(string))
|
print("[TOC]" .. "[" .. runningFile .. "] " .. tostring(string))
|
||||||
end
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
---Horrendous but I don't really care about performance for this
|
---Horrendous but I don't really care about performance for this
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ StaticData.TRAITS_BP = {
|
|||||||
--* Visuals and clothing
|
--* Visuals and clothing
|
||||||
|
|
||||||
--- Textures
|
--- Textures
|
||||||
-- TODO We need male variations
|
|
||||||
StaticData.HEALTH_PANEL_TEXTURES = {
|
StaticData.HEALTH_PANEL_TEXTURES = {
|
||||||
|
|
||||||
Female = {
|
Female = {
|
||||||
|
|||||||
Reference in New Issue
Block a user