Need help turning a biter-spawner into an assembler

Place to get help with not working mods / modding interface.
Post Reply
doktorstick
Fast Inserter
Fast Inserter
Posts: 151
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Need help turning a biter-spawner into an assembler

Post by doktorstick »

Howdy. I need an assist.

I've successfully turned a biter-spawner into an assembler. The main change I had to do was change the animations to animation and pick one of the spawner_idle_animations.

However, I'm running into a problem with pipe connections. I can't seem to get fluid-boxes definition correct. Fiddling with collision_box, selection_box and pipe_connections, I can only ever seem to get an input pipe to connect from one direction (usually the west, but sometimes the east). North/south are misaligned.

What am I missing? Thanks!

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by aubergine18 »

Is your current code posted anywhere (github) so people can download and experiment with it to find out what the issue with pipe connections is?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

doktorstick
Fast Inserter
Fast Inserter
Posts: 151
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by doktorstick »

I don't. It's not even a mod per se--i'm tinkering/exploring. I'll see about packaging a zip together, but it won't be for a long while. Busy day today.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by Adil »

You can't make entity of one kind to behave like another. Spawner type doesn't support the pipe connections, if you want to make those visible, you'll have to write them in sprite definitions. If you wan them to behave like pipes, you'll have to hack new entity and place it beside the spawner.
Actually it seems easier to make assembler to look like spawner and create units around it with lua.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by DedlySpyder »

Adil wrote:Actually it seems easier to make assembler to look like spawner and create units around it with lua.
Or make an extra entity under the assembler that is a spawner (I have to imagine that the spawning logic is better than what a mod can do easily)

doktorstick
Fast Inserter
Fast Inserter
Posts: 151
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by doktorstick »

Adil wrote:You can't make entity of one kind to behave like another. Spawner type doesn't support the pipe connections, if you want to make those visible, you'll have to write them in sprite definitions. If you wan them to behave like pipes, you'll have to hack new entity and place it beside the spawner.
Actually it seems easier to make assembler to look like spawner and create units around it with lua.
That's basically what I've done. I set the type as "assembing-machine" and updated the "animations" tag to be "animation" because using what was defined in the spawner entity caused an empty sprite. What I thought was happening with the pipe (because it shows up and rotates on the "R" key) is that the spawner's collision/selection box is rectangular--not square.

Here's the test definition I have. You'll notice most are from assembler 3 IIRC. I'm not sure what the base_area and base_level do; I've tried various values to (seemingly) no effect.

Code: Select all

{
   type = "assembling-machine",
   name = "test-spawner-assembler"
   icon = moddir.."/graphics/icons/biter-spawner.png",  -- just copied from base/; did this before I realized "animations" didn't work
   flags = {"placeable-neutral","placeable-player", "player-creation"},
   minable = {hardness = 0.2, mining_time = 0.5, result = "test-spawner-assembler"}
   max_health = 300,
   corpse = "big-remnants",
   dying_explosion = "medium-explosion",
   resistances =
      {
         {
            type = "fire",
            percent = 70
         }
      },
   fluid_boxes =
      {
         {
            production_type = "input",
            pipe_picture = assembler3pipepictures(),
            pipe_covers = pipecoverspictures(),
            --base_area = 10,
            --base_level = -1,
            pipe_connections = {{ type="input", position = {0, -2.2}}}
         },
         off_when_no_fluid_recipe = true
      },
   open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
   close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
   vehicle_impact_sound =  { filename = "__base__/sound/car-metal-impact.ogg", volume =
 0.65 },
   working_sound =
      {
         sound = {
            {
               filename = "__base__/sound/assembling-machine-t3-1.ogg",
               volume = 0.8
            },
            {
               filename = "__base__/sound/assembling-machine-t3-2.ogg",
               volume = 0.8
            },
         },
         idle_sound = { filename = "__base__/sound/idle1.ogg", volume = 0.6 },
         apparent_volume = 1.5,
      },

   -- Assembler 3
   --collision_box = {{-1.2, -1.2}, {1.2, 1.2}},
   --selection_box = {{-1.5, -1.5}, {1.5, 1.5}},

   collision_box = {{-3.2, -2.2}, {2.2, 2.2}},
   selection_box = {{-3.5, -2.5}, {2.5, 2.5}},

   fast_replaceable_group = "assembling-machine",
   animation = spawner_idle_animation (0, {r=0.92, g=0.54, b=0, a=0.5}),

   crafting_categories = {"test-recipes"},
   crafting_speed = 1.25,
   energy_source =
      {
         type = "electric",
         usage_priority = "secondary-input",
         emissions = 0.03 / 3.5
      },
   energy_usage = "210kW",
   ingredient_count = 6,
   module_specification =
      {
         module_slots = 4
      },
   allowed_effects = {"consumption"}
}

doktorstick
Fast Inserter
Fast Inserter
Posts: 151
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by doktorstick »

DedlySpyder wrote:
Adil wrote:Actually it seems easier to make assembler to look like spawner and create units around it with lua.
Or make an extra entity under the assembler that is a spawner (I have to imagine that the spawning logic is better than what a mod can do easily)
Oh, hah, yeah, that's not what I want. It isn't spawning units. It's an "otherworldly" goods producer. It should function like a normal assembler, but has a different skin--that of the spawner. I'll pick different sounds and stuff later to match the theme.

User avatar
DedlySpyder
Filter Inserter
Filter Inserter
Posts: 253
Joined: Fri Jun 20, 2014 11:42 am
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by DedlySpyder »

I think you need to find "assembler3pipepictures()" and "pipecoverspictures()" and make your own replacements. It's been a while since I touched fluid boxes though.

If you check my Avatars mod (in my signature, though check the github because I haven't touched the thread in a while) I use fluid boxes to display a door on my avatar assembling machine.

Edit: ok, I checked it real fast, pipe connections is the pipe, and pipe covers is the cap on the pipes if it's not connected (I didn't use the covers). Relevant github link: https://github.com/DedlySpyder/Avatars/ ... sembly.lua

User avatar
anarchyinc
Inserter
Inserter
Posts: 29
Joined: Tue Jul 05, 2016 9:31 pm

Re: Need help turning a biter-spawner into an assembler

Post by anarchyinc »

Base_area = size of the storage for pipe/tank (1 equals 10, 10 equals 100)
Base_level = location of the fluid box relative to 0 (ground level) +1 will push out -1 will pull into.
viewtopic.php?f=25&t=2442&start=10

Your fluid boxes should be
Fluid box
The selection/collision boxes should be... (This will maintain a 3x3 footprint with the correct connections to the pipes, I have no idea why you made it into a rectangle)
collision
And lastly, you left the animation size undefined. The assembler and spawner sprite sheets are different sizes so you need to adjust accordingly. This should be the proper math, but you might need to play with the shift to get it perfect.
base animation
Edit: Ah, I see what you did wrong. You tried to use all the code from the spawner and turn it into an assembly machine instead of just using the assembler code with a new graphic. I was wondering why the collision box was so wrong. Wrong collision = pipes will never connect.
"Friends don't let friends drink & drive", "Gamers don't let gamers install steam"

doktorstick
Fast Inserter
Fast Inserter
Posts: 151
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by doktorstick »

I'll give this a try on Saturday! Thanks for the detailed look.

User avatar
anarchyinc
Inserter
Inserter
Posts: 29
Joined: Tue Jul 05, 2016 9:31 pm

Re: Need help turning a biter-spawner into an assembler

Post by anarchyinc »

I did a bit of testing and got it to work fine with my code on the first try. You might want to add scale = 0.75 or so to the base animation but it's good enough to play with. Also, when using the game's default spawner the thing rotates when it is running as part of the animation so I made you a new sprite sheet.
working spawner-assember
working spawner-assember
spawner.png (419.72 KiB) Viewed 4080 times
base animation
base animation
spawner-idle.png (360.99 KiB) Viewed 4080 times
test.lua
prototype file
(3.22 KiB) Downloaded 82 times
"Friends don't let friends drink & drive", "Gamers don't let gamers install steam"

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by Nexela »

I never realized how disgusting those spawners looked until see thing post.........

doktorstick
Fast Inserter
Fast Inserter
Posts: 151
Joined: Fri Aug 12, 2016 10:22 pm
Contact:

Re: Need help turning a biter-spawner into an assembler

Post by doktorstick »

:D Works great, thank you kindly. You've gotten me over my hurdle and I appreciate the extra effort you went through.

Post Reply

Return to “Modding help”