Asteroidia mod [req] [idea]

This is the place to request new mods or give ideas about what could be done.
meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Asteroidia mod [req] [idea]

Post by meems »

Hi all, the community has just finished discussing Factorio 2 dev on the general discussion forum, and the conclusion is its time to start dev, here and now.
I won't call it Factorio 2 here, thats too cheeky, but the plan is to design the successor to F1, and hopefully get the core dev team onboard once they've finished F1.

1st thing we need is to remove the 'you' RPG element of the game. I see that has been done in the campaign ' belt madness' that comes with the game.

anyone know how to do it?

F2 is not an RPG - 4X hybrid like F1 is. Its just a 4X game. Which will make dev a lot easier.
Last edited by meems on Fri Jun 16, 2017 10:37 pm, edited 1 time in total.

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Factorio 2 dev

Post by meems »

dev goal #1 implement god-mode
dev goal #2 implement no night time

...so that player doesn't have to select it from custom scernario, it'll just be set when mod loaded.

Status : needs doing
Last edited by meems on Fri Jun 16, 2017 11:23 pm, edited 1 time in total.

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Factorio 2 dev

Post by meems »

dev goal #3

This one won't be so quick to solve.
The environment setting of F2 is asteroids in space.

This requires :
3a graphics mod
3b map generation mod

There's a fair amount of work there. Anyone know any mods that can be used as a template to get started? Or are we going to have to start from scratch?

doc
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Mon Mar 28, 2016 3:52 pm
Contact:

Re: Asteroidia mod [req] [idea]

Post by doc »

Oh, you want mining asteroids in space? https://mods.factorio.com/mods/docpaisl ... l-research

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

wow great work doc.
So the community has at least 1 modder who understands Asteroids are the destiny of Factorio.

Are you sticking with this Asteroids theme?

what are your ideas for it in the future?

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

my version of asteroids would vary from yours in these respects :

- It would not be an extension to F1, player wouldn't need to play thru F1 to get to the mod. It would be asteroids from the start
- It would be in a mode similar to god mode, ( god mode a good approximation )
- no teleporters, use ships to get between 'roids, but once you got a ship to a 'roid, you could zoom there instantly, cos its god mode.

What u think to that?

doc
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Mon Mar 28, 2016 3:52 pm
Contact:

Re: Asteroidia mod [req] [idea]

Post by doc »

Interesting ideas meems. I think it'd be a very different game if you had shuttles and asteroids available at the start. Balancing would be completely different. The aims of my mod have ended up a bit more complex, there is basically a whole extra game layer going on which is your "orbital network" that you manage somewhat indirectly by launching things in rockets.

I'd definitely like to do more things with the asteroids themselves - e.g. finding ancient artifacts, and new dangers. A lot more content should be added in time.

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

day #13 of asteroidia dev :

back to dev goal #1 : setting 'god mode'

So far, not managed to do it.

Searching the internet returns no immediate results, but it does give you this
/c game.player.character = nil
from
https://wiki.factorio.com/Console

this sets god mode, from the (ingame?) console

perhaps this console command can be translated into a mod script. I dunno. I'll keep searching

I've got a hypothesis : to set god mode, a modder must alter one of these files

control.lua, or settings.lua

I conjecture this, because on https://wiki.factorio.com/Tutorial:Modd ... ctorio_mod it says :
Mods with in-game effects will also need a control.lua file, to add scripting.
Mods with configurable user settings will use settings.lua to describe those settings.
God mode could be thought of as an 'in game effect', but I think its more likely to be classed as a setting. However, the description of settings, is for user control. This isn't quite what were after in a mod that forces god-mode, but since in vanilla, god mode is a user setting, there a fair chance the god mode switch will be found in settings.
Last edited by meems on Wed Jun 28, 2017 9:37 am, edited 1 time in total.

British_Petroleum
Filter Inserter
Filter Inserter
Posts: 321
Joined: Tue Dec 23, 2014 7:21 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by British_Petroleum »

Have a look at the satellite uplink mod:

viewtopic.php?f=97&t=19883
meems wrote:day #13 of asteroidia dev :

back to dev goal #1 : setting 'god mode'

So far, not managed to do it.

Searching the internet returns no immediate results, but it does give you this
/c game.player.character = nil
from
https://wiki.factorio.com/Console

this sets god mode, from the (ingame?) console

perhaps this console command can be translated into a mod script. I dunno. I'll keep searching

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

thx BP. I had a look. That's a complicated mod with a lot of code. Almost a total mystery to me.

I was able to find the term player.character in the control.lua code in that satellite uplink code.
However, curiously, it is not pre-termed by 'game'. I haven't figured out why yet. Is this a player outside the game? Where is this player then?
I dunno. Its a mystery, like the rest of the code.

After seeing the term player.character in the satellite mod code, along with seeing it as a console command, I felt confident enough to have a go at putting it in settings.lua
as game.player.character = nil as recommended in the wiki.

Image
( I'm using helocopter as a template mod )

hard to make sense of this.
seems factorio is complaining that 'game' does not yet exist, but of course, the game hasn't started yet. Perhaps I'm doing it wrong. Or perhaps god mode has to be activated in control.lua

over the next few weeks I will try to find out.

* edit *

This is what happens if I move the line
" game.player.character = nil " to control.lua
Image

Even though at control.lua we should be ingame, Factorio still doesn't recognise 'game' as an entity.
I'll guess we need to make a script that checks to see if game exists THEN switch game.player.character = nil

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Asteroidia mod [req] [idea]

Post by bobingabout »

never use game.player.character in control.lua. game.player doesn't exist there anymore. Instead you need to iterate through game.players[] using a for in pairs loop.

As for your issue with the game variable, it doesn't exist in the on_load script, nor as a global. it is however accessible in most other scripts, like on_init (Which is called once the first time the game is loaded/created with this mod installed.)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
featherwinglove
Filter Inserter
Filter Inserter
Posts: 579
Joined: Sat Jun 25, 2016 6:14 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by featherwinglove »

bobingabout wrote:never use game.player.character in control.lua. game.player doesn't exist there anymore.
It does if script is responding to a remote call from the console; game.player is whoever typed it. That's pretty rare though: Muddy Mountains has 66 mods, only one of which needs console commands.

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

Thx for help bob & fwl

Based on your suggestions, I tried this code in control.lua

Code: Select all

function on_init()

	for i, player in pairs(game.players) do
		player.character = nil
	end

end
the game loaded the mod without error, which was an improvement. But on starting a game, god-mode was not activated. It seems factorio ignored the command to set player to nil. Or perhaps it was setting player to not nil soon afterwards. Do you know of any mod which successfully sets god mode at the start of game? I wonder if I can reverse engineer the 'belt madness' subgame and see how its done there. That'll be my next investigation.

I also tried

Code: Select all

function on_init()

	for i, player in pairs(game.players) do
		player.character = nil
	end

   game.player.character = nil

end
but got same result

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

Re: Asteroidia mod [req] [idea]

Post by DedlySpyder »

IIRC, the player doesn't exist yet in on_init.

Try just using on_player_created. You can also get the player_index from that event, look then up with game.players[player_index], and just remove that character (would then work if someone else joined as well).

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

Hi DSpyder

Code: Select all

function on_player_created()

        game.player.character = nil

	for i, player in pairs(game.players) do
		player.character = nil
	end

end
I tried your suggestion. But got same result. Player is still created after map generation. :(
Seems its a toughy, might have to ask Rseding91 for a new API function

Bilka
Factorio Staff
Factorio Staff
Posts: 3159
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by Bilka »

Have you actually registered you function for the event?

This is how you would do that:

Code: Select all

script.on_event(defines.events.on_player_created, your_function_here(event))
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

Hi Bilka, thx for advice.
From programming in the 1980s on my C16+4 basic, BBC micro basic , from haskell, to clean, C , C++, blitz, blitzplus, blitzmax, java, python.. etc. I've never heard of having to register a function. I've always just wrote out a function and used it. LUA and the way factorio uses it are a mystery to me.

I tried your suggestion, my 1st attempt ever at registering a function.

Code: Select all

script.on_event(defines.events.on_player_created, on_player_created(event) )

function on_player_created()

	for i, player in pairs(game.players) do
		player.character = nil
	end

end
I got this error message :
Image
factorio seems to be pissed that I've called on_player_created. Or that on_player_created has a nil value and has been called.
Not sure wtf is going on. If the player is created, then how can on_player_created be nil?

Bilka
Factorio Staff
Factorio Staff
Posts: 3159
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by Bilka »

You are trying to call the function before it is defined. Place the snippet of code that I gave you below your actual function, not above it, so that you define the function before you call it with the event.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

meems
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Wed Feb 15, 2017 2:02 am
Contact:

Re: Asteroidia mod [req] [idea]

Post by meems »

then how come some modders do function registration before the function is defined?

e.g.

Code: Select all

script.on_init(function() On_Init() end)
script.on_configuration_changed(function() On_Init() end)

function On_Init()
	global.character_data = global.character_data or {}
	global.station_data = global.station_data or {}
end
taken from
https://github.com/Suprcheese/Satellite ... ontrol.lua

Don't understand.
anyway, I tried your suggestion.

Code: Select all

function on_player_created()

	for i, player in pairs(game.players) do
		player.character = nil
	end

end

script.on_event(defines.events.on_player_created, on_player_created(event) )
on generate map, got this error
Image
game doesn't exist? But on_player_created has been called?
I don't understand it. :?

Veden
Filter Inserter
Filter Inserter
Posts: 294
Joined: Wed Jul 13, 2016 3:54 pm
Contact:

Re: Asteroidia mod [req] [idea]

Post by Veden »

meems wrote:function on_player_created()

   for i, player in pairs(game.players) do
      player.character = nil
   end

end

script.on_event(defines.events.on_player_created, on_player_created(event) )

Code: Select all

function on_player_created()

   for i, player in pairs(game.players) do
      player.character = nil
   end

end

script.on_event(defines.events.on_player_created, on_player_created )
Lua has first class functions, so functions can be passed as variables.
on_player_created(event) is making an invocation with a null variable event.
on_player_created is just passing the function
script.on_event takes a event ID and a function to call when the event ID comes up.

Post Reply

Return to “Ideas and Requests For Mods”