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

CRash on deadlock.add_stack #39

Open
RedRafe opened this issue Nov 21, 2024 · 1 comment
Open

CRash on deadlock.add_stack #39

RedRafe opened this issue Nov 21, 2024 · 1 comment

Comments

@RedRafe
Copy link

RedRafe commented Nov 21, 2024

Hi, before the update to 2.0, this is how I was calling to the API:

deadlock.add_stack('pipe', nil, 'deadlock-stacking-1', 64)

But now I'm getting this error on load:

   0.496 Script @__deadlock-beltboxes-loaders__/prototypes/shared.lua:13: DBL: Error: Can't create layered icon for item (pipe), base item defines icon but no icon_size
   0.496 Error ModManager.cpp:1741: Failed to load mod "redmew-data": __deadlock-beltboxes-loaders__/prototypes/create_stack.lua:124: attempt to index field '?' (a nil value)
stack traceback:
	__deadlock-beltboxes-loaders__/prototypes/create_stack.lua:124: in function 'create_stacking_recipes'
	__deadlock-beltboxes-loaders__/prototypes/public.lua:195: in function 'add_stack'
	...ger-ores/vanilla/compatibility/deadlock/data-updates.lua:15: in main chunk
	[C]: in function 'require'
	__redmew-data__/danger-ores/vanilla/data-updates.lua:8: in main chunk
	[C]: in function 'require'
	__redmew-data__/data-updates.lua:11: in main chunk
   0.520 Loading mod core 0.0.0 (data.lua)
   0.534 Checksum for core: 3203360670
   0.550 Error ModManager.cpp:1741: Error in assignID: procession with name 'default-b' does not exist.

Source: default (utility-constants).

Can you have a loot at it maybe?
Thanks

@RedRafe
Copy link
Author

RedRafe commented Nov 21, 2024

I believe this is due to new prototype definition, from Wube's src:

 {
    type = "item",
    name = "pipe",
    icon = "__base__/graphics/icons/pipe.png",
    subgroup = "energy-pipe-distribution",
    order = "a[pipe]-a[pipe]",
    inventory_move_sound = item_sounds.metal_small_inventory_move,
    pick_sound = item_sounds.metal_small_inventory_pickup,
    drop_sound = item_sounds.metal_small_inventory_move,
    place_result = "pipe",
    stack_size = 100,
    weight = 5 * kg,
    random_tint_color = item_tints.iron_rust
  }

icon_size now defaults to 64 but is not specified in prototype attributes. So maybe you'd want to fallback to that value if no icons found and only icon is specified without icon_size.

elseif base_item.icon then
if not base_item.icon_size then
DBL.log_error(string.format("Can't create layered icon for item (%s), base item defines icon but no icon_size", item_name))
return
end

Setting data.raw.item.pipe.icon_size = 64 before calling deadlock.add_stack('pipe', nil, 'deadlock-stacking-1', 64) does indeed fix the issue.
Up to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant