didn't commit everything ops

This commit is contained in:
Pao
2023-02-26 22:16:47 +01:00
parent b195c92466
commit 6f59311fd0
15 changed files with 81 additions and 72 deletions

View File

@@ -0,0 +1,49 @@
------------------------------------------
------------- JUST CUT IT OFF ------------
------------------------------------------
------------- LOCAL ACTIONS --------------
--Used to handle SP scenarios
if JCIO_LocalActions == nil then
JCIO_LocalActions = {}
end
function JCIO_LocalActions.Cut(_, player, partName)
if JCIO_Common.GetSawInInventory(player) ~= nil then
ISTimedActionQueue.add(JCIO_CutLimbAction:new(player, player, partName))
else
player:Say("I don't have a saw on me")
end
end
function JCIO_LocalActions.Operate(_, player, partName, useOven)
if useOven then
ISTimedActionQueue.add(JCIO_OperateLimbAction:new(player, player, _, partName, useOven));
else
local kit = TocGetKitInInventory(player)
if kit ~= nil then
ISTimedActionQueue.add(JCIO_OperateLimbAction:new(player, player, kit, partName, false))
else
player:Say("I don't have a kit on me")
end
end
end
function JCIO_LocalActions.EquipProsthesis(_, player, partName)
local surgeonInv = player:getInventory()
local prosthesisToEquip = surgeonInv:getItemFromType('TOC.MetalHand') or
surgeonInv:getItemFromType('TOC.MetalHook') or
surgeonInv:getItemFromType('TOC.WoodenHook')
if prosthesisToEquip then
ISTimedActionQueue.add(JCIO_InstallProsthesisAction:new(player, player, prosthesisToEquip, partName))
else
player:Say("I need a prosthesis")
end
end
function JCIO_LocalActions.UnequipProsthesis(_, player, partName)
ISTimedActionQueue.add(JCIO_UninstallProsthesisAction:new(player, player, partName))
end

View File

@@ -19,7 +19,7 @@ function JCIO.EquipProsthesis(partName, prosthesisItem, prosthesisBaseName)
local equippedProsthesis = GenerateEquippedProsthesis(prosthesisItem, player:getInventory(), "Hand")
--print("TOC: Test durability new item " .. added_prosthesis_mod_data.TOC.durability)
--print("JCIO: Test durability new item " .. added_prosthesis_mod_data.TOC.durability)
-- TODO equippedProsthesis must have something like the ProsthesisFactor from before!!!

View File

@@ -1,44 +0,0 @@
------------------------------------------
-------- JUST CUT IT OFF --------
------------------------------------------
------------- LOCAL ACTIONS --------------
function TocCutLocal(_, player, part_name)
if JCIO_Common.GetSawInInventory(player) ~= nil then
ISTimedActionQueue.add(JCIO_CutLimbAction:new(player, player, part_name))
else
player:Say("I don't have a saw on me")
end
end
function TocOperateLocal(_, player, part_name, use_oven)
if use_oven then
ISTimedActionQueue.add(JCIO_OperateLimbAction:new(player, player, _, part_name, use_oven));
else
local kit = TocGetKitInInventory(player)
if kit ~= nil then
ISTimedActionQueue.add(JCIO_OperateLimbAction:new(player, player, kit, part_name, false))
else
player:Say("I don't have a kit on me")
end
end
end
function TocEquipProsthesisLocal(_, player, part_name)
local surgeon_inventory = player:getInventory()
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
surgeon_inventory:getItemFromType('TOC.MetalHook') or
surgeon_inventory:getItemFromType('TOC.WoodenHook')
if prosthesis_to_equip then
ISTimedActionQueue.add(JCIO_InstallProsthesisAction:new(player, player, prosthesis_to_equip, part_name))
else
player:Say("I need a prosthesis")
end
end
function TocUnequipProsthesisLocal(_, player, part_name)
ISTimedActionQueue.add(JCIO_UninstallProsthesisAction:new(player, player, part_name))
end

View File

@@ -88,7 +88,7 @@ JCIO_ContextMenu.CreateOperateWithOvenMenu = function(playerId, context, worldOb
context:addSubMenu(rootMenu, subMenu)
isMainMenuAlreadyCreated = true
end
subMenu:addOption(getText('UI_ContextMenu_' .. partName), worldObjects, TocOperateLocal,
subMenu:addOption(getText('UI_ContextMenu_' .. partName), worldObjects, JCIO_LocalActions.Operate,
getSpecificPlayer(playerId), partName,true)
end
end

View File

@@ -305,13 +305,13 @@ local function TryTocAction(_, part_name, action, surgeon, patient)
if not isServer() and not isClient() then
if action == "Cut" then
TocCutLocal(_, surgeon, part_name)
JCIO_LocalActions.Cut(_, surgeon, part_name)
elseif action == "Operate" then
TocOperateLocal(_, surgeon, part_name, false)
JCIO_LocalActions.Operate(_, surgeon, part_name, false)
elseif action == "Equip" then
TocEquipProsthesisLocal(_, surgeon, part_name)
JCIO_LocalActions.EquipProsthesis(_, surgeon, part_name)
elseif action == "Unequip" then
TocUnequipProsthesisLocal(_, surgeon, part_name)
JCIO_LocalActions.UnequipProsthesis(_, surgeon, part_name)
end
else
local ui = GetConfirmUIMP()

View File

@@ -74,7 +74,7 @@ JCIO.InitPart = function(limbs_data, part_name)
end
JCIO.SetInitData = function(modData, player)
print("TOC: Creating mod_data.TOC")
print("JCIO: Creating mod_data.TOC")
--------
-- NEW NAMING SCHEME

View File

@@ -35,7 +35,7 @@ JCIO_Visuals.SetTextureForAmputation = function(item, player, cicatrized)
end
end
--print("TOC: Setting texture " .. matched_index)
--print("JCIO: Setting texture " .. matched_index)
item:getVisual():setTextureChoice(tonumber(matchedIndex - 1)) -- it counts from 0, so we have to subtract 1
end
@@ -85,7 +85,7 @@ function TocSetCorrectTextureForAmputation(item, player, cicatrized)
end
end
--print("TOC: Setting texture " .. matched_index)
--print("JCIO: Setting texture " .. matched_index)
item:getVisual():setTextureChoice(tonumber(matched_index - 1)) -- it counts from 0, so we have to subtract 1
end
@@ -104,7 +104,7 @@ function TocSetBloodOnAmputation(player, body_part)
end
--print("TOC: Adding blood based on " .. tostring(body_part_type))
--print("JCIO: Adding blood based on " .. tostring(body_part_type))
player:addBlood(blood_body_part_type, false, true, false)
player:addBlood(BloodBodyPartType.Torso_Lower, false, true, false)

View File

@@ -8,7 +8,7 @@ local ServerCommands = {}
ServerCommands.ResponseCanAct = function(arg)
print("TOC: ResponseCanAct")
print("JCIO: ResponseCanAct")
local ui = GetConfirmUIMP()
ui.responseReceive = true
ui.responseAction = arg["toSend"][2]
@@ -146,7 +146,7 @@ end
local function OnTocServerCommand(module, command, args)
if module == 'TOC' then
print("TOC: On Toc Server Command " .. command)
print("JCIO: On Toc Server Command " .. command)
if ServerCommands[command] then
print("Found command, executing it now")
args = args or {}

View File

@@ -34,7 +34,7 @@ local function SetCompatibilityFancyHandwork()
equip = false
end
if mod then
--print("TOC: Fancy Handwork modifier")
--print("JCIO: Fancy Handwork modifier")
-- If we still have something equipped in secondary, unequip
if secondary and equip and can_be_held["Left"] then
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
@@ -110,7 +110,7 @@ local function SetCompatibilityFancyHandWorkAndSwapIt()
equip = false
end
if mod then
--print("TOC: Fancy Handwork modifier")
--print("JCIO: Fancy Handwork modifier")
-- If we still have something equipped in secondary, unequip
if secondary and equip and can_be_held["Left"] then
ISTimedActionQueue.add(ISUnequipAction:new(self.chr, secondary, 20))
@@ -160,23 +160,23 @@ end
local function CheckModCompatibility()
local activated_mods = getActivatedMods()
print("TOC: Checking mods")
print("JCIO: Checking mods")
if activated_mods:contains("FancyHandwork") then
if activated_mods:contains("SwapIt") then
require "SwapIt Main"
print("TOC: Overriding FancyHandwork and SwapIt methods")
print("JCIO: Overriding FancyHandwork and SwapIt methods")
SetCompatibilityFancyHandWorkAndSwapIt()
else
print("TOC: Overriding FancyHandwork methods")
print("JCIO: Overriding FancyHandwork methods")
require "TimedActions/FHSwapHandsAction"
SetCompatibilityFancyHandwork()
end
end
end
print("TOC: Starting CheckModCompatibility")
print("JCIO: Starting CheckModCompatibility")
Events.OnGameStart.Add(CheckModCompatibility)

View File

@@ -77,7 +77,7 @@ function ISInventoryPane:onMouseDoubleClick(x, y)
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")
--print("JCIO: Can't double click this item")
end
og_ISInventoryPaneOnMouseDoubleClick(self, x, y)
@@ -108,7 +108,7 @@ ISInventoryPaneContextMenu.onInspectClothing = function(playerObj, cloth
-- Inspect menu bypasses getActualItems, so we need to add that workaround here too
local clothing_full_type = clothing:getFullType()
if CheckIfItemIsAmputatedLimb(clothing) or CheckIfItemIsInstalledProsthesis(clothing) then
--print("TOC: Can't inspect this!")
--print("JCIO: Can't inspect this!")
else
og_ISInventoryPaneContextMenuOnInspectClothing(playerObj, clothing)

View File

@@ -155,7 +155,7 @@ function ProsthesisRecipes.OnDisassembleProsthesis(item, result_items, player, s
local base_name = GetProsthesisPartName(base_table, prosthesis_item_name)
local top_name = GetProsthesisPartName(top_table, prosthesis_item_name)
print("TOC: " .. base_name .. " and " .. top_name)
print("JCIO: " .. base_name .. " and " .. top_name)
local player_inv = player:getInventory()

View File

@@ -83,7 +83,7 @@ local function SetHealthStatusForBodyPart(partData, partName, player)
if partData[partName].isCut then
--print("TOC: Check update for " .. part_name)
--print("JCIO: Check update for " .. part_name)
-- if the player gets attacked and damaged in a cut area we have to reset it here since it doesn't make any sense
-- this is using map 1:1, so it doesn't affect the wound caused by the amputation
@@ -202,9 +202,9 @@ JCIO.UpdateEveryTenMinutes = function()
local modifier = SandboxVars.JCIO.CicatrizationSpeedMultiplier - itemBloodyness - itemDirtyness
--print("TOC: Type " .. amputated_limb_item:getFullType())
--print("TOC: Dirtyness " .. item_dirtyness)
--print("TOC: Bloodyness " .. item_bloodyness)
--print("JCIO: Type " .. amputated_limb_item:getFullType())
--print("JCIO: Dirtyness " .. item_dirtyness)
--print("JCIO: Bloodyness " .. item_bloodyness)
partData[partName].cicatrizationTime = partData[partName].cicatrizationTime - modifier

View File

@@ -1,3 +1,7 @@
------------------------------------------
------------- JUST CUT IT OFF ------------
------------------------------------------
require "TimedActions/ISBaseTimedAction"
JCIO_CutLimbAction = ISBaseTimedAction:derive("JCIO_CutLimbAction")

View File

@@ -24,7 +24,7 @@ end
ClientCommands.AskStopAmputationSound = function(_, args)
print("TOC: We're in AskStopAmputationSound")
print("JCIO: We're in AskStopAmputationSound")
sendServerCommand("TOC", "StopAmputationSound", {surgeon_id = args.surgeon_id})