Game Mechanics Help

Place to get help with not working mods / modding interface.
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Game Mechanics Help

Post by TheSAguy »

I’m actually not exactly sure what to title this request…

I’m trying to accomplish two things that are very similar:

1. Having a radar scan faster, by consuming/burning/using Science packs or Alien artifacts.

2. Having an assembly machine craft faster by consuming/burning/using Science packs.

This second request I’m actually going to apply to the Green House Mod. So it will act like fertilizer. By consuming Science packs the trees will grow faster. Maybe Red = 1, Blue = 2 and Purple = 4. I know that the Tree Farm mod does something like this, but I believe that’s all scripting on the actual trees and not the Machine (farm).

This is similar to my Fuel / Energy Question. I ran into a dead end there.

Thanks for assistance.
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: Game Mechanics Help

Post by Afforess »

1. Create 2 radar prototypes / entities, and chest entity attached.The first radar entity is the slow/default scan speed, the second radar is the fast radar entity. When the chest has alien artifacts / purple science, replace the slow radar entity with the fast radar entity, remove an alien science every X ticks, and swap the entity back when the chest runs out of science packs.

In list form:

1.) Create 2 radar items, one craft-able by the player. Give them the same description text, and graphics, so players can not tell.
2.) Create a 1x1 chest item that is un-craftable by the player. This will be placed by your mod when a player creates your radar, to act as the assembly slot.
3.) Listen to on entity placed (or robot placed), check if the entity name matches your radar, stick it in a list you create in global data to keep track of.
4.) When your radar is placed, also create the chest entity next to it. Keep track of this chest entity in the global data.
5.) Check the chest for items every 300 ticks or so (5s), and if it has the items you need, remove one, and replace the slow radar entity with the fast radar entity
6.) When the chest runs out of items, replace the fast radar entity with the slow radar entity

2. Same idea as 1?
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1455
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Game Mechanics Help

Post by TheSAguy »

Wow, I would not have thought of this...

I've used the switch out before, but not connect cheats or deductions on tick before.

Is there any example code were something similar to the above has been done?

And thanks for the feedback!
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: Game Mechanics Help

Post by Afforess »

TheSAguy wrote:Wow, I would not have thought of this...

I've used the switch out before, but not connect cheats or deductions on tick before.

Is there any example code were something similar to the above has been done?

And thanks for the feedback!
AmmoBox is similar, but not exactly the same. I connect a logistics chest to a gun turret to allow logistics robots to restock it.
Post Reply

Return to “Modding help”