Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfixing and some polish #3515

Merged
merged 15 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions codex/documents/networkguide.codex
Original file line number Diff line number Diff line change
Expand Up @@ -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.",

Expand Down Expand Up @@ -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:

Expand Down
20 changes: 10 additions & 10 deletions items/active/weapons/crits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ 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.
]]

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

Expand All @@ -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"))
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion items/active/weapons/melee/mace/pyreitemace.activeitem
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"baseDps":7.7,
"damageConfig" : {
"damageSourceKind" : "hellfire",
"statusEffects" : [ "burning" ]
"statusEffects" : [ "burningnapalm" ]
}
},
"critChance" : 1,
Expand Down
2 changes: 1 addition & 1 deletion items/active/weapons/melee/rapier/pyreiterapier.activeitem
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"baseDps" : 6.2,
"damageConfig" : {
"damageSourceKind":"hellfire",
"statusEffects":["burning"]
"statusEffects":["burningnapalm"]
}
},

Expand Down
10 changes: 5 additions & 5 deletions objects/kheAA/kheAA_containerLink/kheAA_containerLink.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion objects/kheAA/kheAA_containerLink/kheAA_containerLink.object
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
Original file line number Diff line number Diff line change
@@ -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",

Expand Down
20 changes: 17 additions & 3 deletions objects/kheAA/kheAA_repeater/kheAA_repeater.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
6 changes: 4 additions & 2 deletions objects/kheAA/kheAA_repeater/kheAA_repeater.object
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Expand All @@ -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]],
Expand All @@ -32,4 +34,4 @@
"kheAA_outDataNode":0,

"scriptDelta" : 1
}
}
88 changes: 49 additions & 39 deletions objects/kheAA/kheAA_repeater/repeater.animation
Original file line number Diff line number Diff line change
@@ -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" : "<partImage>:<color>.off"
}
},

"on" : {
"properties" : {
"image" : "<partImage>:<color>.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": "<partImage>:<color>.off"
}
},
"on": {
"properties": {
"image": "<partImage>:<color>.on"
}
},
"error": {
"properties": {
"image": "<partImage>:<color>.error"
}
}
}
}
}
}
},
"sounds": {
"alarm": [
"/sfx/objects/redalert.ogg"
]
}
}
4 changes: 2 additions & 2 deletions objects/kheAA/kheAA_repeater/repeater.frames
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
]
}
}
Binary file modified objects/kheAA/kheAA_repeater/repeater.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions objects/kheAA/kheAA_router/kheAA_router.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion objects/kheAA/kheAA_router/kheAA_router.object
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"objectName" : "network_router",
"tooltipKind":"basenew",
"colonyTags" : [],
"printable" : false,
"rarity" : "Common",
Expand All @@ -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",

Expand Down
Loading
Loading