From 08427d467834e76ea64ff27c8bc08a0b159ae247 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 02:33:07 -0700 Subject: [PATCH 01/14] add error sprite --- objects/kheAA/kheAA_repeater/repeater.frames | 4 ++-- objects/kheAA/kheAA_repeater/repeater.png | Bin 193 -> 229 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/objects/kheAA/kheAA_repeater/repeater.frames b/objects/kheAA/kheAA_repeater/repeater.frames index 9fcdd115df6..01e092dddd5 100644 --- a/objects/kheAA/kheAA_repeater/repeater.frames +++ b/objects/kheAA/kheAA_repeater/repeater.frames @@ -2,9 +2,9 @@ "frameGrid" : { "size" : [8, 8], - "dimensions" : [2, 1], + "dimensions" : [3, 1], "names" : [ - [ "default.off", "default.on" ] + [ "default.off", "default.on", "default.error" ] ] } } diff --git a/objects/kheAA/kheAA_repeater/repeater.png b/objects/kheAA/kheAA_repeater/repeater.png index 29e0184a067e58dbb508875feb60e15f8375c143..e45d95c39a7ff723f767ab5b6cbc377cf0772d06 100644 GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^5srCZv`8 b{LVIW4~t%%#KHGKTNpfD{an^LB{Ts5WI0-@ literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~c!3HEhl+{lMQXQTyjv*Ddre4_2%j78F_E58- zs;_4?(`|OW=pKe~O9k@-$W5&qXG!+noRW*diV8gO{I1 zE#Gl?=f?_**KJqRq&hzAs9M#sIKTBoedD3GmI3Rpn<_TkxIA+WpK^S4IOD~bYOCMc t4Zjb(ov)T4U!{-`&-n1V! Date: Sat, 4 Nov 2023 02:33:14 -0700 Subject: [PATCH 02/14] Update repeater.animation --- .../kheAA/kheAA_repeater/repeater.animation | 88 +++++++++++-------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/objects/kheAA/kheAA_repeater/repeater.animation b/objects/kheAA/kheAA_repeater/repeater.animation index 9deb603ac5c..e3e98463690 100644 --- a/objects/kheAA/kheAA_repeater/repeater.animation +++ b/objects/kheAA/kheAA_repeater/repeater.animation @@ -1,41 +1,51 @@ { - "animatedParts" : { - "stateTypes" : { - "repeaterState" : { - "default" : "off", - "states" : { - "off" : { - "frames" : 1 - }, - "on" : { - "frames" : 1 - } - } - } - }, - - "parts" : { - "repeater" : { - "properties" : { - "centered" : false - }, - - "partStates" : { - "repeaterState" : { - "off" : { - "properties" : { - "image" : ":.off" - } - }, - - "on" : { - "properties" : { - "image" : ":.on" - } - } - } - } - } - } - } + "animatedParts": { + "stateTypes": { + "repeaterState": { + "default": "off", + "states": { + "off": { + "frames": 1 + }, + "on": { + "frames": 1 + }, + "error": { + "frames": 1 + } + } + } + }, + "parts": { + "repeater": { + "properties": { + "centered": false + }, + "partStates": { + "repeaterState": { + "off": { + "properties": { + "image": ":.off" + } + }, + "on": { + "properties": { + "image": ":.on" + } + }, + "error": { + "properties": { + "image": ":.error" + } + } + } + } + } + } + }, + "sounds": { + "alarm": [ + "/sfx/objects/redalert.ogg" + ] + } } From c986ea833b7bd9e7082f19058111a96c35446e94 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 02:36:40 -0700 Subject: [PATCH 03/14] no looping allowed, add function returns for whether input list updates failed --- scripts/kheAA/transferUtil.lua | 121 +++++++++++++++++++++++++++------ 1 file changed, 99 insertions(+), 22 deletions(-) diff --git a/scripts/kheAA/transferUtil.lua b/scripts/kheAA/transferUtil.lua index 8d0bff609de..727fbe376e3 100644 --- a/scripts/kheAA/transferUtil.lua +++ b/scripts/kheAA/transferUtil.lua @@ -30,8 +30,8 @@ function transferUtil.init() storage.position=storage.position or entity.position() transferUtil.vars={} transferUtil.vars.logicNode=config.getParameter("kheAA_logicNode") - transferUtil.vars.inDataNode=config.getParameter("kheAA_inDataNode"); - transferUtil.vars.outDataNode=config.getParameter("kheAA_outDataNode"); + transferUtil.vars.inDataNode=config.getParameter("kheAA_inDataNode") + transferUtil.vars.outDataNode=config.getParameter("kheAA_outDataNode") transferUtil.vars.didInit=true end @@ -96,9 +96,18 @@ function transferUtil.zoneAwake(targetBox) end end +--probably not a good idea to use. should I add a triggered reset of node lists on node connection change? +--least likely to cause disruption except in cases of explicit external timers +--it's this, or...anti-loop. +-- function transferUtil.onNodeConnectionChange(args) -function transferUtil.throwItemsAt(target,targetPos,item,drop) +-- end + +-- function onNodeConnectionChange(args) + -- transferUtil.onNodeConnectionChange(args) +-- end +function transferUtil.throwItemsAt(target,targetPos,item,drop) if item.count~=math.floor(item.count) or item.count<=0 then return false end drop=drop or false @@ -148,64 +157,94 @@ function transferUtil.throwItemsAt(target,targetPos,item,drop) return true, item.count end +function transferUtil.updateNodeLists() + local uInP=transferUtil.updateInputs() + local uOutP=transferUtil.updateOutputs() + return uInP and uOutP +end + function transferUtil.updateInputs() if not transferUtil.vars or not transferUtil.vars.didInit then transferUtil.init() end - --transferUtil.vars.input={} + --later might find usefulness in knowing what prior data was? + --transferUtil.vars.inputOld=transferUtil.vars.input + transferUtil.vars.input={} + --transferUtil.vars.inContainersOld=transferUtil.vars.inContainers transferUtil.vars.inContainers={} + if self.disabled then return end if not transferUtil.vars.inDataNode then - return + return false end - --transferUtil.vars.input=copy(object.getInputNodeIds(transferUtil.vars.inDataNode)) + + transferUtil.vars.inputList=copy(object.getInputNodeIds(transferUtil.vars.inDataNode)) local buffer={} - --for inputSource in pairs(transferUtil.vars.input) do - for inputSource in pairs(copy(object.getInputNodeIds(transferUtil.vars.inDataNode))) do + for inputSource in pairs(transferUtil.vars.inputList) do local source=inputSource if source then local temp=world.callScriptedEntity(source,"transferUtil.sendContainerInputs") - --sb.logInfo("%s:%s reporting inputs %s",world.entityName(source),source,temp) if temp ~= nil then for entId,position in pairs(temp) do buffer[entId]=position end end - --else - --sb.logInfo("ITD %s found a nil in inputnodeids",entity.id()) end end transferUtil.vars.inContainers=buffer + return true end function transferUtil.updateOutputs() if not transferUtil.vars or not transferUtil.vars.didInit then transferUtil.init() end - --transferUtil.vars.output={} + --later might find usefulness in knowing what prior data was? + --transferUtil.vars.outputOld=transferUtil.vars.output + transferUtil.vars.output={} + --transferUtil.vars.outContainersOld=transferUtil.vars.outContainers transferUtil.vars.outContainers={} + transferUtil.vars.upstreamCount=0 + if self.disabled then return end if not transferUtil.vars.outDataNode then - return + return false end - --transferUtil.vars.output=copy(object.getOutputNodeIds(transferUtil.vars.outDataNode)) + + transferUtil.vars.outputList=copy(object.getOutputNodeIds(transferUtil.vars.outDataNode)) local buffer={} - --for outputSource in pairs(transferUtil.vars.output) do - for outputSource in pairs(copy(object.getOutputNodeIds(transferUtil.vars.outDataNode))) do + local loopCheck + for outputSource in pairs(transferUtil.vars.outputList) do local source=outputSource if source then + -- this is for loop prevention, if a repeater forms a loop with another repeater, both clear their object lists and refuse to hold any data. prevents fossilization. + if transferUtil.vars.inputList[source] and world.callScriptedEntity(source,"transferUtil.isRelayNode") then + transferUtil.vars.inputList={} + transferUtil.vars.outputList={} + transferUtil.vars.outContainers={} + transferUtil.vars.inContainers={} + transferUtil.vars.upstreamCount=0 + loopCheck=true + return false + end + + if world.callScriptedEntity(source,"transferUtil.checkUpstreamContainers") then + transferUtil.vars.upstreamCount=transferUtil.vars.upstreamCount+1 + end + local temp=world.callScriptedEntity(source,"transferUtil.sendContainerOutputs") - --sb.logInfo("%s:%s reporting outputs %s",world.entityName(source),source,temp) if temp ~= nil then for entId,position in pairs(temp) do buffer[entId]=position + transferUtil.vars.upstreamCount=transferUtil.vars.upstreamCount+1 end end - --else - --sb.logInfo("ITD %s found a nil in outputnodeids",entity.id()) end end - transferUtil.vars.outContainers=buffer + if not loopCheck then + transferUtil.vars.outContainers=buffer + end + return true end function transferUtil.findNearest(source,sourcePos,targetList) @@ -230,6 +269,28 @@ function transferUtil.findNearest(source,sourcePos,targetList) return target,targetPos end +function transferUtil.checkUpstreamContainers() + return (transferUtil.vars.upstreamCount or 0)>0 +end + +function transferUtil.hasUpstreamContainers() + return util.tableSize(transferUtil.vars.outContainers)>0 +end + +--idea of "just update upstream when an object is removed" +--too messy, too prone to hiccups that could cause issues with machines. +--what if we remove a machine that is on the network from a DIFFERENT repeater? +-- function transferUtil.removeAput(id,preStr) + -- for source in pairs(transferUtil.vars[preStr.."put"]) do + -- if world.callScriptedEntity(source,"transferUtil.isRelayNode") then + -- world.callScriptedEntity(source,"transferUtil.doRemoveAput",id,preStr) + -- end + -- end +-- end + +-- function transferUtil.doRemoveInput(id,preStr) + -- transferUtil.vars[preStr..""][id]=nil +-- end function transferUtil.pos2Rect(pos,size) if not size then size = 0 end @@ -283,11 +344,11 @@ function transferUtil.recvConfig(conf) end function transferUtil.sendContainerInputs() - return transferUtil and transferUtil.vars and (not transferUtil.vars.isRouter) and transferUtil.vars.inContainers or {} + return transferUtil and transferUtil.vars and (not transferUtil.isRouterNode()) and transferUtil.vars.inContainers or {} end function transferUtil.sendContainerOutputs() - return transferUtil and transferUtil.vars and (not transferUtil.vars.isRouter) and transferUtil.vars.outContainers or {} + return transferUtil and transferUtil.vars and (not transferUtil.isRouterNode()) and transferUtil.vars.outContainers or {} end function transferUtil.powerLevel(node,explicit) @@ -340,6 +401,14 @@ function transferUtil.getType(item) return "unhandled" end +function transferUtil.leftToList(input) + local buffer={} + for k in pairs(input) do + buffer[#buffer + 1]=k + end + return buffer +end + function transferUtil.getCategory(item) local itemCat=transferUtil.getType(item) return transferUtil.itemTypes[itemCat] or "unhandled" @@ -363,6 +432,14 @@ function transferUtil.unloadSelfContainer() transferUtil.vars.outContainers={} end +function transferUtil.isRelayNode() + return transferUtil.vars.isRelayNode +end + +function transferUtil.isRouterNode() + return transferUtil.vars.isRouter +end + function dbg(args) sb.logInfo(sb.printJson(args)) end From 89492f5cb54913da70edc1d02f3a61994a88da63 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 02:36:50 -0700 Subject: [PATCH 04/14] Update kheAA_router.lua --- objects/kheAA/kheAA_router/kheAA_router.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/objects/kheAA/kheAA_router/kheAA_router.lua b/objects/kheAA/kheAA_router/kheAA_router.lua index e02e0ea0eee..0d3c1d84e07 100644 --- a/objects/kheAA/kheAA_router/kheAA_router.lua +++ b/objects/kheAA/kheAA_router/kheAA_router.lua @@ -34,9 +34,10 @@ function update(dt) end deltatime = 0 self.routerItems=world.containerItems(entity.id()) - transferUtil.updateInputs() - transferUtil.updateOutputs() + -- local nodeUpdatePassed=transferUtil.updateNodeLists() + transferUtil.updateNodeLists() + -- if (not nodeUpdatePassed) and transferUtil.powerLevel(transferUtil.vars.logicNode) then if transferUtil.powerLevel(transferUtil.vars.logicNode) then backflowInstances=0 routeItems(dt) @@ -62,6 +63,7 @@ end function initVars() self.routerItems={} transferUtil.vars.isRouter=true + -- transferUtil.vars.isRelayNode=true transferUtil.vars.inContainers={} transferUtil.vars.outContainers={} if storage.inputSlots == nil then From 14862319c6b431c4ea6d5c57774d9c79fb65029b Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 03:31:12 -0700 Subject: [PATCH 05/14] extend tooltip, add warning --- objects/kheAA/kheAA_router/kheAA_router.object | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/objects/kheAA/kheAA_router/kheAA_router.object b/objects/kheAA/kheAA_router/kheAA_router.object index e0f89d1088f..7ac82851ea9 100644 --- a/objects/kheAA/kheAA_router/kheAA_router.object +++ b/objects/kheAA/kheAA_router/kheAA_router.object @@ -1,5 +1,6 @@ { "objectName" : "network_router", + "tooltipKind":"basenew", "colonyTags" : [], "printable" : false, "rarity" : "Common", @@ -9,7 +10,8 @@ "description" : "Moves items between containers. ^blue;Input^white;1^blue;: ^white;On/Off Switch ^blue;Input^white;2^blue;: ^white;item network -^red;Output: ^white;item network^reset;", +^red;Output: ^white;item network^reset; +^red;Will not work when chained.^reset;", "shortdescription" : "Item Transference Device", "race" : "generic", From 0de709dc3c53b84f9c2df4ee68f77812e0228642 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 03:31:35 -0700 Subject: [PATCH 06/14] update doc, short circuit and no repeating --- codex/documents/networkguide.codex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codex/documents/networkguide.codex b/codex/documents/networkguide.codex index 67b210bde3f..bfbc45190ab 100644 --- a/codex/documents/networkguide.codex +++ b/codex/documents/networkguide.codex @@ -24,7 +24,7 @@ "In order to set up a basic ITN network, connect the red output node for a container's storage bridge to the second blue input node for an ITD, and then connect the ITD's red output node to the blue input node of a second container's storage bridge. Now all items put into the first container will be automatically moved to the second one.", - "ITDs can be interacted with to bring up their configuration menu. Input slots indicate what slots in a container the ITD will pull from; output slots designate what inventory slots in a container the ITD will drop items into. You can press the red I button to invert the selected slots, telling the ITD to ignore those specific slots rather than use them specifically. Even splitting and slot splitting dictate whether the ITD sorts items into single stacks or splits items between every indicated output slot.", + "ITDs can be interacted with to bring up their configuration menu. Input slots indicate what slots in a container the ITD will pull from; output slots designate what inventory slots in a container the ITD will drop items into. You can press the red I button to invert the selected slots, telling the ITD to ignore those specific slots rather than use them specifically. Even splitting and slot splitting dictate whether the ITD sorts items into single stacks or splits items between every indicated output slot. ITDs may not be used as repeaters.", "You can place items in the empty item boxes in the top-right corner of an ITD's configuration screen to tell it to pull specific kinds of items and ignore others. You can further specify whether you want the ITD to pull that exact item, or else the same types or categories of that item. Furthermore, you can specify how many to move at a time by placing stacks of the desired quantity. Using the Inverted Logic setting tells the ITD to ignore that specific, type, or category of item.", @@ -52,7 +52,7 @@ "A common, useful storage setup is to have rows of containers and storage bridges all linked to a single terminal (or series of terminals) so you can pull from all of them, with a chest nearby and its storage bridge linked to multiple ITDs that will automatically sort any items you dump into it into specific containers in the network without you having to do anything else.", - "As you start making more sophisticated ITN setups, you may have trouble getting your wiring across large areas of space without vanishing, or else want to optimize the efficiency of your wiring. Repeaters can serve as wiring waypoints to extend your wiring range, while a single Repeater can be wired to all your containers so that you do not need to wire all of them individually between a dozen different terminals.", + "As you start making more sophisticated ITN setups, you may have trouble getting your wiring across large areas of space without vanishing, or else want to optimize the efficiency of your wiring. Repeaters can serve as wiring waypoints to extend your wiring range, while a single Repeater can be wired to all your containers so that you do not need to wire all of them individually between a dozen different terminals. It is important to note that if repeaters are looped, they will cease function.", "Dos & Don'ts: From 042e649b32d2c683cf5a9a26191478ceafd07653 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 03:32:01 -0700 Subject: [PATCH 07/14] animate, add loop alert --- .../kheAA/kheAA_repeater/kheAA_repeater.lua | 20 ++++++++++++++++--- .../kheAA_repeater/kheAA_repeater.object | 6 ++++-- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/objects/kheAA/kheAA_repeater/kheAA_repeater.lua b/objects/kheAA/kheAA_repeater/kheAA_repeater.lua index ae5a85b850a..9437d5ecc53 100644 --- a/objects/kheAA/kheAA_repeater/kheAA_repeater.lua +++ b/objects/kheAA/kheAA_repeater/kheAA_repeater.lua @@ -4,6 +4,9 @@ function init() transferUtil.init() transferUtil.vars.inContainers={} transferUtil.vars.outContainers={} + transferUtil.vars.upstreamCount=0 + transferUtil.vars.isRelayNode=true + animator.setAnimationState("repeaterState","off") end function update(dt) @@ -12,7 +15,18 @@ function update(dt) return end deltatime=0 - transferUtil.updateInputs() - transferUtil.updateOutputs() - object.setOutputNodeLevel(transferUtil.vars.inDataNode,util.tableSize(transferUtil.vars.outContainers)) + + local nodeUpdatePassed=transferUtil.updateNodeLists() + local hasUpstream=transferUtil.checkUpstreamContainers() + + if nodeUpdatePassed then + animator.setSoundVolume("alarm",0,0) + animator.setAnimationState("repeaterState",(hasUpstream and "on") or "off") + else + animator.setSoundVolume("alarm",1.0,0) + animator.playSound("alarm") + animator.setAnimationState("repeaterState","error") + end + + object.setOutputNodeLevel(transferUtil.vars.inDataNode,hasUpstream and 1 or 0) end diff --git a/objects/kheAA/kheAA_repeater/kheAA_repeater.object b/objects/kheAA/kheAA_repeater/kheAA_repeater.object index e33a3f47ee0..c485e081bd2 100644 --- a/objects/kheAA/kheAA_repeater/kheAA_repeater.object +++ b/objects/kheAA/kheAA_repeater/kheAA_repeater.object @@ -2,7 +2,7 @@ "objectName" : "network_repeater", "rarity" : "Common", "printable" : false, - "description" : "^green;Links^reset; together certain inventory network nodes.", + "description" : "^green;Links^reset; together certain inventory network nodes. ^red;Will not function if looped.^reset;", "shortdescription" : "Repeater", "race" : "generic", @@ -23,6 +23,8 @@ "repeater" : "repeater.png" }, "animationPosition" : [0, 0], + + "animation" : "/objects/kheAA/kheAA_repeater/repeater.animation", "scripts" : [ "/objects/kheAA/kheAA_repeater/kheAA_repeater.lua"], "inputNodes" : [ [0,0]], @@ -32,4 +34,4 @@ "kheAA_outDataNode":0, "scriptDelta" : 1 -} \ No newline at end of file +} From 090a46251c9c84d0be5fb1ad705f3ae1a8751e7e Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 03:32:21 -0700 Subject: [PATCH 08/14] extend tooltip, remove scanforinfo --- .../kheAA/kheAA_containerLink/kheAA_containerLink.lua | 10 +++++----- .../kheAA_containerLink/kheAA_containerLink.object | 4 +++- .../kheAA_containerLink/kheAA_containerLink2.object | 5 ++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/objects/kheAA/kheAA_containerLink/kheAA_containerLink.lua b/objects/kheAA/kheAA_containerLink/kheAA_containerLink.lua index 111692a9486..79deeac7ede 100644 --- a/objects/kheAA/kheAA_containerLink/kheAA_containerLink.lua +++ b/objects/kheAA/kheAA_containerLink/kheAA_containerLink.lua @@ -10,11 +10,11 @@ function init() self.outPartialFillNode=config.getParameter("kheAA_outPartialFillNode") self.outCompleteFillNode=config.getParameter("kheAA_outCompleteFillNode") - local desc="^blue;Input: ^white;item network^reset;\n^red;Output: ^white;item network^reset;" - if self.outPartialFillNode then - desc=desc.."\n^red;Lower output: ^white;item network^reset;\n^red;Upper outputs: ^white;Partial/Complete Fill^reset;" - end - object.setConfigParameter('description',desc) + -- local desc="^blue;Input: ^white;item network^reset;\n^red;Output: ^white;item network^reset;" + -- if self.outPartialFillNode then + -- desc=desc.."\n^red;Lower output: ^white;item network^reset;\n^red;Upper outputs: ^white;Partial/Complete Fill^reset;" + -- end + -- object.setConfigParameter('description',desc) end function update(dt) diff --git a/objects/kheAA/kheAA_containerLink/kheAA_containerLink.object b/objects/kheAA/kheAA_containerLink/kheAA_containerLink.object index 1e8f454e620..7b72abd1e3d 100644 --- a/objects/kheAA/kheAA_containerLink/kheAA_containerLink.object +++ b/objects/kheAA/kheAA_containerLink/kheAA_containerLink.object @@ -1,8 +1,10 @@ { "objectName" : "network_containerlink", + "tooltipKind":"basenew", "printable" : false, "rarity" : "Common", - "description" : "Marks containers for use by an item network. Place near object placement point. Scan for more info.", + "description" : "Marks containers for use by an item network. Place near object placement point. +^blue;Input: ^white;item network^reset;\n^red;Output: ^white;item network^reset;", "shortdescription" : "Storage Bridge", "race" : "generic", // "learnBlueprintsOnPickup":["network_containerlink2","network_pointsensor"], diff --git a/objects/kheAA/kheAA_containerLink/kheAA_containerLink2.object b/objects/kheAA/kheAA_containerLink/kheAA_containerLink2.object index d48db43d305..bf2bc83fe0c 100644 --- a/objects/kheAA/kheAA_containerLink/kheAA_containerLink2.object +++ b/objects/kheAA/kheAA_containerLink/kheAA_containerLink2.object @@ -1,8 +1,11 @@ { "objectName" : "network_containerlink2", + "tooltipKind":"basenew", "printable" : false, "rarity" : "Common", - "description" : "Marks containers for use by an item network. Place near object placement point. Scan for more info.", + "description" : "Marks containers for use by an item network. Place near object placement point. +^blue;Input: ^white;item network^reset;\n^red;Output: ^white;item network^reset; +^red;Lower output: ^white;item network^reset;\n^red;Upper outputs: ^white;Partial/Complete Fill^reset;", "shortdescription" : "Storage Bridge V2", "race" : "generic", From ea33a0ea3cdc24a0fef71ef4c3f89020da23f896 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 03:47:10 -0700 Subject: [PATCH 09/14] Update transferUtil.lua --- scripts/kheAA/transferUtil.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/kheAA/transferUtil.lua b/scripts/kheAA/transferUtil.lua index 727fbe376e3..55e7a173b4b 100644 --- a/scripts/kheAA/transferUtil.lua +++ b/scripts/kheAA/transferUtil.lua @@ -213,7 +213,7 @@ function transferUtil.updateOutputs() transferUtil.vars.outputList=copy(object.getOutputNodeIds(transferUtil.vars.outDataNode)) local buffer={} - local loopCheck + local loopCheck=false for outputSource in pairs(transferUtil.vars.outputList) do local source=outputSource if source then From 908f4520d2dcc6ec286c9d28bfbc7606cf327d27 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 03:49:12 -0700 Subject: [PATCH 10/14] Update transferUtil.lua --- scripts/kheAA/transferUtil.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/kheAA/transferUtil.lua b/scripts/kheAA/transferUtil.lua index 55e7a173b4b..b8007ea15ed 100644 --- a/scripts/kheAA/transferUtil.lua +++ b/scripts/kheAA/transferUtil.lua @@ -213,7 +213,6 @@ function transferUtil.updateOutputs() transferUtil.vars.outputList=copy(object.getOutputNodeIds(transferUtil.vars.outDataNode)) local buffer={} - local loopCheck=false for outputSource in pairs(transferUtil.vars.outputList) do local source=outputSource if source then @@ -224,7 +223,6 @@ function transferUtil.updateOutputs() transferUtil.vars.outContainers={} transferUtil.vars.inContainers={} transferUtil.vars.upstreamCount=0 - loopCheck=true return false end @@ -241,9 +239,7 @@ function transferUtil.updateOutputs() end end end - if not loopCheck then - transferUtil.vars.outContainers=buffer - end + transferUtil.vars.outContainers=buffer return true end From 1ff4206f0f53b306c13c05ede95375fb5db16305 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sat, 4 Nov 2023 14:56:05 -0700 Subject: [PATCH 11/14] pyrite weapons errneously using burning, changed to napalm --- items/active/weapons/melee/mace/pyreitemace.activeitem | 2 +- items/active/weapons/melee/rapier/pyreiterapier.activeitem | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/items/active/weapons/melee/mace/pyreitemace.activeitem b/items/active/weapons/melee/mace/pyreitemace.activeitem index bd9206397a6..c6186f8d6a4 100644 --- a/items/active/weapons/melee/mace/pyreitemace.activeitem +++ b/items/active/weapons/melee/mace/pyreitemace.activeitem @@ -32,7 +32,7 @@ "baseDps":7.7, "damageConfig" : { "damageSourceKind" : "hellfire", - "statusEffects" : [ "burning" ] + "statusEffects" : [ "burningnapalm" ] } }, "critChance" : 1, diff --git a/items/active/weapons/melee/rapier/pyreiterapier.activeitem b/items/active/weapons/melee/rapier/pyreiterapier.activeitem index 4d9414e674a..31411fd0b63 100644 --- a/items/active/weapons/melee/rapier/pyreiterapier.activeitem +++ b/items/active/weapons/melee/rapier/pyreiterapier.activeitem @@ -33,7 +33,7 @@ "baseDps" : 6.2, "damageConfig" : { "damageSourceKind":"hellfire", - "statusEffects":["burning"] + "statusEffects":["burningnapalm"] } }, From 06f772a5807c7132efd905bd17e80d532c84d178 Mon Sep 17 00:00:00 2001 From: Kherae Date: Sun, 19 Nov 2023 17:19:27 -0800 Subject: [PATCH 12/14] stat list crit bonus documentation update --- stats/__STAT_LIST.TXT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stats/__STAT_LIST.TXT b/stats/__STAT_LIST.TXT index b56971de76a..e42564441ef 100644 --- a/stats/__STAT_LIST.TXT +++ b/stats/__STAT_LIST.TXT @@ -155,7 +155,7 @@ OTHER: bowDrawTimeBonus [amount] [0-Relative] increases bow draw speed. critChance [amount] [0-relative. Default: 0] Chance for weapons to crit. value of 42 is 42% chance to crit. - critBonus [amount] [0-relative. Default: 0] Bonus Crit Damage. Flat amount added, does not scale with critDamage. Avoid using this stat. It should only be part of weapon config files. + critBonus [amount] [0-relative. Default: 0] AVOID USING THIS AS A STAT. Bonus Crit Damage. added to critDamage in calcs. functionally identical. It should only be part of weapon config files. critDamage [amount] [0-relative. Default: 0] Bonus to Crit Damage multiplier. This is added to a base value of 1.50, but the stat starts as 0. +0.1 will make the crit damage multiplier 1.6. stunChance [amount] [0-relative. Default: 0] Chance to stun. Requires a crit. value of 42 is 42% chance to stun on crit. so if you have 42% chance for both, that equates to about 17% chance to stun. From b32394b7c0a68a8882ae74559e166069bd6c63ea Mon Sep 17 00:00:00 2001 From: Kherae Date: Sun, 19 Nov 2023 17:19:42 -0800 Subject: [PATCH 13/14] replace critbonus with critdamage in these holdovers --- species/kyani.raceeffect | 12 ++++++------ .../fu_effects/critbonus/critbonus1.statuseffect | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/species/kyani.raceeffect b/species/kyani.raceeffect index 0332a6b6776..07c2421261a 100644 --- a/species/kyani.raceeffect +++ b/species/kyani.raceeffect @@ -120,8 +120,8 @@ "effectiveMultiplier": 1.2 }, { - "stat": "critBonus", - "effectiveMultiplier": 1.1 + "stat": "critDamage", + "amount": 0.1 } ] }, @@ -132,8 +132,8 @@ "effectiveMultiplier": 1.15 }, { - "stat": "critBonus", - "effectiveMultiplier": 1.07 + "stat": "critDamage", + "amount": 0.07 } ] }, @@ -144,8 +144,8 @@ "effectiveMultiplier": 1.07 }, { - "stat": "critBonus", - "effectiveMultiplier": 1.03 + "stat": "critDamage", + "amount": 0.03 } ] } diff --git a/stats/effects/fu_effects/critbonus/critbonus1.statuseffect b/stats/effects/fu_effects/critbonus/critbonus1.statuseffect index e1ec58d9ca5..1fa27299b8d 100644 --- a/stats/effects/fu_effects/critbonus/critbonus1.statuseffect +++ b/stats/effects/fu_effects/critbonus/critbonus1.statuseffect @@ -2,7 +2,7 @@ "name" : "critbonus1", "effectConfig": { "stats": [{ - "stat": "critBonus", + "stat": "critDamage", "amount": 0.1 } ] @@ -15,6 +15,6 @@ "animationConfig" : "critbonus.animation", - "label" : "Crit Bonus +10", + "label" : "Crit Damage +10%", "icon" : "/interface/statuses/rage.png" } From 9f7c6678f92ce3bd2e3cd539ca5a5770aacfb31e Mon Sep 17 00:00:00 2001 From: Kherae Date: Sun, 19 Nov 2023 17:20:04 -0800 Subject: [PATCH 14/14] rework critbonus to be additive with critdamage, to fix grinder et al --- items/active/weapons/crits.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/items/active/weapons/crits.lua b/items/active/weapons/crits.lua index 28b9f8fc076..2f322e4cff1 100644 --- a/items/active/weapons/crits.lua +++ b/items/active/weapons/crits.lua @@ -21,7 +21,7 @@ placing this in lua demo: --results in an output like this: - Pass R1 2.0105 Pass R2 0.9941 + Pass R1 2.0105 Pass R2 0.9941 --translated, this output means that when attempting to get a roll out of 100, the average roll will be these. --in other words, math.random(100)>=99 means 2% chance, not 1%. --changing the comparison from >= to > thus results in reducing the 'success' chance over an average of 1 million samples by ~1.0. @@ -29,7 +29,7 @@ placing this in lua demo: function Crits:setCritDamage(damage) local critChance = config.getParameter("critChance", 1) + status.stat("critChance") -- Integer % chance to activate crit - local critBonus = config.getParameter("critBonus", 0) + status.stat("critBonus") -- flat damage bonus to critical hits + local critBonus = config.getParameter("critBonus", 0) + status.stat("critBonus") -- it's just critDamage (below). should mostly phase out except for on weapon configs. local critDamage = status.stat("critDamage") -- % increase to crit damage multiplier (0.10 == +10% or 110% total additional damage) --status.stat ONLY accepts ONE argument. and returns 0.0 if it is not found @@ -42,7 +42,7 @@ function Crits:setCritDamage(damage) local crit = (math.random(100)<=critChance) -- Chance out of 100 -- Crit damage bonus is 50% + critDamage% - damage = crit and (damage * (1.5 + critDamage) + critBonus) or damage -- Inherent 50% damage boost further increased by critBonus + damage = crit and (damage * (1.5 + critDamage + (critBonus/100.0))) or damage -- Inherent 50% damage boost further increased by critBonus if crit then --sb.logInfo("sum.critChance:%s, config.critChance:%s stat.critChance:%s",config.getParameter("critChance", 1)+status.stat("critChance"),config.getParameter("critChance", 1),status.stat("critChance")) @@ -61,32 +61,32 @@ function Crits:setCritDamage(damage) -- ***************************************************************** local stunRoll = (math.random(100)) + status.stat("stunChance") + config.getParameter("stunChance",0) --local daggerChance = math.random(100) + status.stat("daggerChance") + config.getParameter("daggerChance",0)--unused - + local params={power=1,damageKind = "default"} if stunRoll > 99 and root.itemHasTag(heldItem, "dagger") then - params = { speed=14, power = 1, damageKind = "default"} + params.speed=14 world.spawnProjectile("daggerCrit",mcontroller.position(),activeItem.ownerEntityId(),Crits.aimVectorSpecial(self),true,params) end if stunRoll > 99 and root.itemHasTag(heldItem, "spear") then - params = { speed=55, power = 1, damageKind = "default"} + params.speed=55 world.spawnProjectile("spearCrit",mcontroller.position(),activeItem.ownerEntityId(),Crits.aimVectorSpecial(self),false,params) end if stunRoll > 99 and root.itemHasTag(heldItem, "shortspear") then - params = { speed=22, power = 1, damageKind = "default"} + params.speed=22 world.spawnProjectile("spearCrit",mcontroller.position(),activeItem.ownerEntityId(),Crits.aimVectorSpecial(self),false,params) end if stunRoll > 99 and root.itemHasTag(heldItem, "rapier") or root.itemHasTag(heldItem, "shortsword") then - params = { speed=30, power = 1, damageKind = "default"} + params.speed=30 world.spawnProjectile("rapierCrit",mcontroller.position(),activeItem.ownerEntityId(),Crits.aimVectorSpecial(self),false,params) end if stunRoll > 99 and (root.itemHasTag(heldItem, "fist") or root.itemHasTag(heldItem, "hammer") or root.itemHasTag(heldItem, "greataxe") or root.itemHasTag(heldItem, "quarterstaff") or root.itemHasTag(heldItem, "mace")) then -- Stun!!!! --sb.logInfo("sum.stunRoll:%s, random.stunRoll:%s, stat.stunChance:%s, config.stunChance:%s",stunRoll,stunRoll-(status.stat("stunChance") + config.getParameter("stunChance",0)),status.stat("stunChance"),config.getParameter("stunChance",0)) - params = { speed=35, power = 1, damageKind = "default"} + params.speed=35 world.spawnProjectile("shieldBashStunProjectile",mcontroller.position(),activeItem.ownerEntityId(),Crits.aimVectorSpecial(self),false,params) end end end end - + --sb.logInfo("crits.lua::final values %s",{c=crit,d=damage,cc=critChance,cb=critBonus,cd=critDamage,sumCD=(1.5 + critDamage + (critBonus/100.0))}) return damage end