Replacing Beacons with Overclocking Stations - possible?

Place to post guides, observations, things related to modding that are not mods themselves.
Katharsas
Inserter
Inserter
Posts: 27
Joined: Sat Nov 10, 2018 1:45 am
Contact:

Re: Replacing Beacons with Overclocking Stations - possible?

Post by Katharsas »

Thanks!
Sadly there is no event that fires when robots change the beacon inventory.

Katharsas
Inserter
Inserter
Posts: 27
Joined: Sat Nov 10, 2018 1:45 am
Contact:

Re: Replacing Beacons with Overclocking Stations - possible?

Post by Katharsas »

I managed to solve the problem with proxies, thanks to viewtopic.php?f=28&t=102415

The first version of my mod that i would describe as "working" can now be tested :D
ocs_0.1.0.zip
(262.06 KiB) Downloaded 49 times
Note:
It is only very roughly balanced to give you similar/slightly lower production output per area of your factory compared to full beacon setups, which means you need more assembly machines because OCS take up way less space than beacons.

Honktown
Filter Inserter
Filter Inserter
Posts: 886
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: Replacing Beacons with Overclocking Stations - possible?

Post by Honktown »

Katharsas wrote:
Sun May 15, 2022 12:57 am
What is the event that triggers when robots place modules into a beacon?
It would lead to a destruction of an 'item-request-proxy'. Unfortunately the only way to know when they're made from blueprints is if the entity in the blueprint had some... Not sure where that is. entity.item_requests will produce them if used on a ghost. The item-proxy would be registered for destruction via script.register_on_entity_destroyed.

There may be a much more convenient way that needs a data-stage change:

Code: Select all

created_effect	::	Trigger (optional)
If an item-request-proxy is given a trigger which raises a lua event as a source effect, then you'll always have when item-request-proxies are created. (if it works, never heard anyone try).
I have mods! I guess!
Link

Katharsas
Inserter
Inserter
Posts: 27
Joined: Sat Nov 10, 2018 1:45 am
Contact:

Re: Replacing Beacons with Overclocking Stations - possible?

Post by Katharsas »

Unfortunately the only way to know when they're made from blueprints is if the entity in the blueprint had some... Not sure where that is.
I think my solution (which i picked up from some other factorio discussion) is kind of easier, maybe less robust:
I simply check the positon of the becaon entity when it gets placed by a robot for any item-request-proxies.
See: https://github.com/Katharsas/Overclocki ... l.lua#L372


Another question:
Is it possible to tell the beacon entity to render spilled items over it instead of under it?
I allowed items to overlap with:

Code: Select all

collision_mask = {"water-tile"},
However now, since my entities look kinda like floor plates, it looks really weird when items spill under them. I tried changing the blueprint to include:

Code: Select all

render_layer = "ground-tile",
but it didn't change anything.

Katharsas
Inserter
Inserter
Posts: 27
Joined: Sat Nov 10, 2018 1:45 am
Contact:

Re: Replacing Beacons with Overclocking Stations - possible?

Post by Katharsas »

Katharsas wrote:
Wed May 18, 2022 3:50 pm
Another question:
Is it possible to tell the beacon entity to render spilled items over it instead of under it?
Ok i managed to solve this problem by using animation_list with a single layer / render_layer instead of base_picture. So instead of:

Code: Select all

    render_layer = "floor-mechanics",
    base_picture = {
      filename = "__ocs__/graphics/my-beacon-h.png",
      ... (picture size etc) ...
    },
i use this:

Code: Select all

    animation_list = {
    {
      always_draw = true,
      render_layer = "floor-mechanics",
      animation = {
        layers = {
          {
            filename = "__ocs__/graphics/my-beacon-h.png",
            ... (picture size etc) ...
This also fixed the sprite going over the player instead of under it.

So, my next question is:
So it seems like it is possible to define lights and animations, but can i change the displayed animations of the entity based on my own lua code?

I need different parts of my entity to have lights on/off based on which sides are connected to other entities. Basically, i want all 4 sides of the graphic to have a small lamp which turns on when that side is connected to a crafting machine.

Edit: I think that LuaRendering::draw_animation is what i am looking for.

Post Reply

Return to “Modding discussion”