Search found 151 matches

by yagaodirac
Mon Jun 28, 2021 1:34 am
Forum: Modding help
Topic: How to change force for entity in editor or script?
Replies: 4
Views: 342

Re: How to change force for entity in editor or script?

Silari wrote: ↑
Sun Jun 27, 2021 5:30 pm
Thanks. I'll check it out.
by yagaodirac
Mon Jun 28, 2021 1:33 am
Forum: Modding help
Topic: How to change force for entity in editor or script?
Replies: 4
Views: 342

Re: How to change force for entity in editor or script?

PFQNiet wrote: ↑
Sun Jun 27, 2021 2:21 pm
OK thanks.
by yagaodirac
Sun Jun 27, 2021 1:42 pm
Forum: Modding help
Topic: How to change force for entity in editor or script?
Replies: 4
Views: 342

How to change force for entity in editor or script?

I tried to make a scenario. I messed up the force. Now I need to find all the worm turrets and set then to enemy. Any idea?
I searched in the docs but found nothing. Entity doesn't contain a field to set force, neither force is without any function to receive entity.
Editor doesn't do this neither.
by yagaodirac
Sat Jun 19, 2021 12:04 pm
Forum: News
Topic: Friday Facts #366 - The only way to go fast, is to go well!
Replies: 88
Views: 30135

Re: Friday Facts #366 - The only way to go fast, is to go well!

You should separate the LuaEntity.html by the types.
by yagaodirac
Tue Jun 01, 2021 8:26 am
Forum: Technical Help
Topic: Fail getting response from pingpong server.
Replies: 0
Views: 171

Fail getting response from pingpong server.

I stops my game from being visible in the game list. How can I solve it?
by yagaodirac
Mon May 31, 2021 7:53 am
Forum: Not a bug
Topic: surface.get_tile function returns wrong result.
Replies: 8
Views: 739

Re: surface.get_tile function returns wrong result.

Pi-C wrote: ↑
Thu May 27, 2021 3:13 pm
I have no idea how the set chunk ... status works. No idea if the code works. No idea, and I don't want to guess any more.
The trouble is already solved. I made a container in lua, and looked up from it. You could see it in my scenario.
by yagaodirac
Mon May 31, 2021 7:18 am
Forum: Technical Help
Topic: Fail to startup headless server.
Replies: 0
Views: 153

Fail to startup headless server.

Everything works properly until I tried to restart the server with a new save file. 9.224 Info CommandLineMultiplayer.cpp:278: Maximum segment size = 100; minimum segment size = 25; maximum-segment-size peer count = 10; minimum-segment-size peer count = 20 9.449 Info ServerRouter.cpp:525: Own addres...
by yagaodirac
Thu May 27, 2021 10:23 am
Forum: Not a bug
Topic: surface.get_tile function returns wrong result.
Replies: 8
Views: 739

Re: surface.get_tile function returns wrong result.

I'm very sorry to tell you that your suggestion doesn't help. If it's supposed to work and you are very sure, plz provide more detail or experience, or code directly. My solution is a container to store the generated chunks. It works properly. But I guess you should provide the api in your cpp code.
by yagaodirac
Thu May 27, 2021 10:20 am
Forum: Not a bug
Topic: surface.get_tile function returns wrong result.
Replies: 8
Views: 739

Re: surface.get_tile function returns wrong result.

Pi-C wrote: ↑
Thu May 27, 2021 5:54 am
I'm not 100% sure, but this event.position is already divided by 32. In other words, it's chunk position, it's not tile position.
On chunk generated passes 2 position to the call back function. The other one is an area, with coords not divided by 32.
by yagaodirac
Thu May 27, 2021 1:17 am
Forum: Not a bug
Topic: surface.get_tile function returns wrong result.
Replies: 8
Views: 739

Re: surface.get_tile function returns wrong result.

Fitst of all, Thank you for helping. But I really need some more help. I added global.surface.set_chunk_generated_status(event.position, defines.chunk_generated_status.custom_tiles) global.surface.set_chunk_generated_status(event.position, defines.chunk_generated_status.basic_tiles) global.surface....
by yagaodirac
Wed May 26, 2021 8:06 am
Forum: Not a bug
Topic: surface.get_tile function returns wrong result.
Replies: 8
Views: 739

surface.get_tile function returns wrong result.

In on_chunk_generated, I turned all the tiles out side (-200,-200),(200,200) into "water". script.on_event(defines.events.on_chunk_generated, function(event) --Some trivial code removed. local tiles = {} local index = 1 for x=event.area.left_top.x,event.area.right_bottom.x-1 do for y=event...
by yagaodirac
Sun May 09, 2021 6:44 am
Forum: Modding help
Topic: A short question. Where is the flag to check if the code runs on server or client?
Replies: 4
Views: 491

Re: A short question. Where is the flag to check if the code runs on server or client?

boskid wrote: ↑
Fri Apr 23, 2021 5:24 am
OK, thanks.
The feature is already done and works properly and not causes any heavy performance issue.
by yagaodirac
Fri Apr 23, 2021 5:09 am
Forum: Modding help
Topic: A short question. Where is the flag to check if the code runs on server or client?
Replies: 4
Views: 491

Re: A short question. Where is the flag to check if the code runs on server or client?

boskid wrote: ↑
Fri Apr 23, 2021 4:55 am
Thanks for replying.
The purpose is that, I need to display something for players. They are trivial and not worthy any memory on server.
But if there is not such a mechanism, it's the same for me to do it in a unified script and cost some extra memory on server.
by yagaodirac
Fri Apr 23, 2021 3:02 am
Forum: Modding help
Topic: A very normal assignment fails in lua.
Replies: 6
Views: 651

Re: A very normal assignment fails in lua.

Klonan wrote: ↑
Thu Apr 22, 2021 4:47 pm
OK, thanks. I plan to assemble all the parts in that project again to see what goes wrong. By the way, I found that it's not practical to set the metatable in on_load when the data structure and relationship scale and get complex. Would you consider doing it in your cpp code?
by yagaodirac
Thu Apr 22, 2021 11:48 am
Forum: Modding help
Topic: A very normal assignment fails in lua.
Replies: 6
Views: 651

Re: A very normal assignment fails in lua.

If you have looked at the log just lines above the final error info, you would find that, a table with a field named "amount_per_minute" is gone after a line like. cont[index] = this table. The container should be very correct. Then what is the problem? I don't believe it's possible to do...
by yagaodirac
Thu Apr 22, 2021 9:34 am
Forum: Modding help
Topic: A very normal assignment fails in lua.
Replies: 6
Views: 651

A very normal assignment fails in lua.

https://github.com/YagaoDirac/Bug-report-Do-not-download Directly run the scenario. The bug occurs within a second. In log, it's very clear. A very strange behavior happens. Inside the add function of array_simple, a field of the added element is removed. The array_simple is a container. It works pr...
by yagaodirac
Wed Apr 21, 2021 6:48 am
Forum: Not a bug
Topic: [1.1.32]Metatable doesn't work in multiplayer.
Replies: 3
Views: 427

Re: [1.1.32]Metatable doesn't work in multiplayer.

Klonan wrote: ↑
Tue Apr 20, 2021 8:21 am
boskid wrote: ↑
Tue Apr 20, 2021 10:03 am
Thank both of you.
It's here:
https://mods.factorio.com/mod/Multiplay ... OP-example
by yagaodirac
Wed Apr 21, 2021 6:27 am
Forum: Modding help
Topic: [1.1.32]Reference counting in lua memory managing doesn't function properly.
Replies: 7
Views: 627

Re: [1.1.32]Reference counting in lua memory managing doesn't function properly.

First of all, thank you for such a long reply. It's very helpful. I do recommend you to add some concrete example into your docs. According to my test, all the functions, and metatable under global is gone after loading. All the variables outside the global( I guess this is what you call "the ...
by yagaodirac
Wed Apr 21, 2021 2:27 am
Forum: Modding help
Topic: [1.1.32]Reference counting in lua memory managing doesn't function properly.
Replies: 7
Views: 627

Re: [1.1.32]Reference counting in lua memory managing doesn't function properly.

boskid wrote: ↑
Tue Apr 20, 2021 1:57 pm
Thanks.
The document is not helpful enough. It doesn't show what to do. You mean, on_init is something for the setup of global, and on_load is for the metatable? OK, I'll give it a try.

Go to advanced search