change roboport settings

Things that we aren't going to implement
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

change roboport settings

Post by mophydeen »

I'm looking for a way to change the roboport settings.

- logistics_radius
- construction_radius
- amount of charge positions
- charge speed

I'd like to use it for tiered technology research.
this works for laser turrets.

Code: Select all

effects =
    {
      {
        type = "ammo-damage",
        ammo_category = "laser-turret",
        modifier = "0.1"
      }
    },
eg. logistics_radius
0) 25 (vanilla)
1) 50
2) 75
3) 100
4) 125
5) 150


thank you.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14594
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: change roboport settings

Post by Rseding91 »

All of those can already be set in the entity prototype for the roboport. Or, am I missing something?
If you want to get ahold of me I'm almost always on Discord.
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

Re: change roboport settings

Post by mophydeen »

Currently I'm adding a new entity "m-improved-roboport" which is unlocked after research.

But I would like to not use a new entity. Just update the vanilla roboport's settings through lab research.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: change roboport settings

Post by Supercheese »

Sadly I don't believe item prototype definitions can be altered dynamically in control.lua - access to item prototype information there is read-only.

Your best bet will be to go the route Bob's mods take and indeed use new, tiered upgrades that unlock with research.
keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: change roboport settings

Post by keyboardhack »

mophydeen wrote:Currently I'm adding a new entity "m-improved-roboport" which is unlocked after research.

But I would like to not use a new entity. Just update the vanilla roboport's settings through lab research.
Their stats are read only so you can't change them, but you can still upgrade the roboports.

Make new entities for each upgraded roboport you want and then when a reasearch is unlocked you replace all the old roboports with the new roboports.
Waste of bytes : P
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

Re: change roboport settings

Post by mophydeen »

keyboardhack wrote:
mophydeen wrote:Currently I'm adding a new entity "m-improved-roboport" which is unlocked after research.

But I would like to not use a new entity. Just update the vanilla roboport's settings through lab research.
Their stats are read only so you can't change them, but you can still upgrade the roboports.

Make new entities for each upgraded roboport you want and then when a reasearch is unlocked you replace all the old roboports with the new roboports.

Do you have a link?

cause I don't see an option to do that directly in technology.
I'm guessing you would listen for tech completed and than replace them:
- stacks in all inventories
- stacks in all chests
- inside factories on the map
- in Items
- placed on the map
- ...



btw: it would be great if the factorio developers would add more modifiers.
source: https://forums.factorio.com/wiki/inde ... y-modifier


Also more documentations would be welcome. Or is there an official updated source?
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

Re: change roboport settings

Post by mophydeen »

Did some research.

I see Force is used and I think it is used for future "squads" (multiple teams with each there own tech tree).
If so?
Are Items placed on the map from a Force/squad/team or do they become a part of the map.
When mined? Can you mine them from other Forces.
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

Re: change roboport settings

Post by mophydeen »

I give up on this remod.
Lack of access I guess.

My story/thoughts as a 1.5 day lua programmer (might contain bad naming for some items/parts/objects/..)
Was able to replace a roboport dynamically depending on what tech was researched.

Could not replace all roboports placed before and change/upgrade them.

force.logistic_networks only has 1 entry for player (0 for enemy and neutral)
I had multiple personal roboports and 1 from roboports (doc, that I could find, said they all count)
However the values inside returned nil and not there values (get_contents, robot_limit, all_logistic_robots, cells, )
This is needed because 'cells' hold 'stationed_logistic_robot_count' and 'stationed_construction_robot_count' BUT no 'stationed_repair_pack_count' ??

Code: Select all

script.on_event(defines.events.on_research_finished, function(event)
..
..
..
	 for _,surface in pairs(game.surfaces) do
	 	game.player.print("Surface: " .. surface.name)

	 	-- vanilla
	 	replaceit1(force, surface, name, mtiers, toitemname)
	 	-- mtiers
	 	for i = 1, mtiers do
	 		replaceit1(force, surface, name.."-m"..i, mtiers, toitemname)
	 	end
	 end
..
..
..
  for _,it in pairs(surface.find_entities_filtered{area={{-bound, -bound}, {bound, bound}},force=force , name=name}) do		
	local posi = it.position
	local forc = it.force
			
	it.destroy()

	surface.create_entity{name=toitemname, position=posi, force=forc}
  end
..
..
..
end)
The create_entity wont work, a player is needed and the on_event has no player only research ...
I could probably cheat it by searching for a random player and use 'player.surface.create_entity{name=name, position=position, force=force}'


devs PLS add:
- an easy way to dynamically replace an entity(item placed on the map/surface) with an other entity.
  1. only for same size?? (eg. 1 x 1 for belt, 2 x 2)
    only for object with the same 'fast_replaceable_group'
- an easy way to dynamically add a new item/entity on the map..



source for most parts: http://5dimmod.com/api/Classes.html
Rseding91
Factorio Staff
Factorio Staff
Posts: 14594
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: change roboport settings

Post by Rseding91 »

mophydeen wrote:I give up on this remod.
Lack of access I guess.

...
Everything is already there. It just sounds like you don't know the ins and outs of the Factorio Lua API.
  • Entities are associated with a force (entity.force)
  • Entities have a prototype you can read runtime to get the fast_replaceable_group and bounding_box (entity.prototype)
  • You can search for all entities of a given type of a given force: surface.find_entities_filtered({force=player.force, type="roboport", area={...}})
  • You can copy inventory contents verbatim from one inventory to another from one entity to another: entity.get_inventory(...)[...].set_item_stack(entity2.get_inventory(...)[...])
The only thing missing would be the ability to change a roboport's settings runtime (which is something I'd like to enable) which would just make the entire thing easier. However, the game its self isn't currently written to support that so it's not as simple as a switch I can just flip :) (It's not difficult either, but it takes time just like everything else.)
If you want to get ahold of me I'm almost always on Discord.
mophydeen
Filter Inserter
Filter Inserter
Posts: 529
Joined: Sun Nov 22, 2015 5:02 pm
Contact:

Re: change roboport settings

Post by mophydeen »

thank you for your reaction.

I didn't know (4), I might try it out.

However there is no easy option to create_entity on the map from an on_event (finished research -> research -> force ...).

Or is it sure that there won't be more forces (player, enemy, neutral). though it would be a great addition to the game to have a 'player2', ..


edit:

please add in future version more research options. You did great for the robo speed, cargo size, laser turret damage, laser turret speed.

MODIFIERS
- max_health, emissions, resistance, energy_usage, module_slots, ..
- roboport: c area, l area, charging location(4 -> 5,6,7,..), charging 'size'/speed,
- electric pole: area size, distance,
- machines: crafting speed and/or mining_power, mining_speed


=> less tiering ingame, less stuff in the crafting menu (when using mods)
=> more resources spend on getting all the possible tech(vanilla or (m)mod) :)
Post Reply

Return to “Won't implement”