Comments (2)
Adding
if not cost then return 0 endbefore line 261 (
if (incost + cost) > maxcost then
incircular_saw.allow_metadata_inventory_put
) prevents crash from occurring, but a better approach would be to keep track of aliased nodes inaliases.lua
try mapping old node into a new one to consistently calculate cost.
Maybe we should return an extremely high cost in this case? We should avoid introducing a duplication bug while fixing this 🙂
from moreblocks.
Maybe we should return an extremely high cost in this case? We should avoid introducing a duplication bug while fixing this
Returning 0 from circular_saw.allow_metadata_inventory_put
prevents the item from being inserted.
Returning a high cost from circular_saw:get_cost
is logically worse than returning nil. Cost for an unhandled item does not exist, thus it makes sense for circular_saw:get_cost
to return nil.
I suggested using aliases instead of simply returning 0 as it would result in expected behaviour instead of preventing players from recycling default stairs which might be confusing if they don't know what's going on.
So something along the lines of:
function circular_saw:get_cost(inv, stackname)
local name = minetest.registered_aliases[stackname] or stackname
for i, item in pairs(inv:get_list("output")) do
if item:get_name() == name then
return circular_saw.cost_in_microblocks[i]
end
end
end
Right, that fixes the problem. I'll submit a PR.
from moreblocks.
Related Issues (20)
- Provide some way to select which recipes should be overloaded HOT 5
- Make variants of nodes that can burn also burnable
- Make microblocks work for nodes with layered textures
- world aligned textures HOT 2
- Opt-depend on default HOT 2
- intllib is deprecated HOT 1
- include support for blocks of darkage mod HOT 2
- Broken crafting recipe HOT 1
- Minor issue causing warnings in MT 5.5.0 with texture alpha clipping HOT 2
- Would it be possible to port to mineclone? HOT 2
- Material disappears from Recycle output slot
- stairsplus:register_custom_subset computes the wrong "cost" for elements HOT 2
- Some adjustments to crafts might not be future-compatible HOT 6
- Server crashes by using Circular Saw HOT 5
- Request: corner pieces for half slope
- Missing paramtype2 and not registering alias
- Crash when placing slopes
- Big issue on Multicraft, Downloading MoreBlocks pack adds +100 slopes from Circular Saw HOT 3
- deprecation warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moreblocks.