Various newcomer to modding questions

Place to get help with not working mods / modding interface.
Post Reply
Mr.YaR
Inserter
Inserter
Posts: 26
Joined: Fri Jan 22, 2016 9:17 am
Contact:

Various newcomer to modding questions

Post by Mr.YaR »

Hello =)



Started modding factorio and was amazed by the possibilities, but on the other hand, some strange limitations seem to rise while is was trying to get deeper into factorio - specialy concerning combat.



Range stuff:

min_range = 40
max_range = 50
turn_range = 0.10 <most interesting

^seem to work only for turrets?^
Didn't manage to make this work for "cars". Imho, it's vital for aircraft and various self propelled weapon systems.
Tryed to put it in various code places after


data.raw stuff:

data.raw["ammo"]["firearm-magazine"].magazine_size = 5
data.raw["ammo"]["firearm-magazine"].stack_size = 50
^works fine^

But didn't manage to make this work:

data.raw["ammo"]["firearm-magazine"].target_type = "direction"

this should be written differently i guess?



Projectile stuff:

direction_deviation = 0.01,
range_deviation = 0.01,

direction_"" and range_"" together seem to produce "accuracy/inaccuracy" - but works does not seem to always work?
Can this work for target type direct? Could someone please share with what else is it linked(like target type)

speed = 0.001, --seems to be the starting speed of a projectile.

speed_deviation = 0.01 - this seems to be the speed variation for each fired projectile? (each projectile can have different speed?)

collision_box = {{0, 0}, {0, 0}}, -- how to remove some entity collision box entirely? Trying various used and unused masks didn't help


Sound stuff:

- How can one make it so everyone is able to hear the sound of a firing "car" while no player is in it??
- Is there a parameter for sound spreading (distance/intensity)?



Sub-entities stuff:

A "unit" ("car") may be created using several various entities.
Can this entities be "cars"? Interesting in making multiple seat vehicles/other.




Thank you for your attention.

PS: Will be further edited =) more questions to come

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Various newcomer to modding questions

Post by Adil »

I'm not going to answer the fully, but you simply need to observe the vanilla prototypes more time and more closely. Fields you add generally will only work if you add them to entities of the same kind as those which you got the tag names from and into a similar position inside their data structure. Assemblers cannot have attack_parameters, rockets can't possess crafting_speed and so on.

I guess, the turn_range defines the cone of fire of turrets, the ones that are automatic turrets, cars simply weren't coded to use that. You may try to put a modding interface request for that.

A scan through prototypes shows that "target_type" is used inside the "ammo_type" table, which can occur inside "ammo" item definition (which is data.raw["ammo"]["firearm-magazine"] ) it can also occur inside attack_parameters for entities that do not use ammo.

Projectiles deviations are only relevant if projectile is targeting a direction or position, like shotgun and cannon. Rockets and machine-gun always hit. You may also be placing those fields in the wrong position.

There is that rarely used field collision_mask which can be altered so that entity didn't collide with anything, see airplane mods.

People have been using custom explosions to create sounds via scripts. See detached gun sounds mod or maybe orbital ion cannon.

I don't entirely get what you say about cars. You can define a new entity or type "unit" and name that one "my-car" (there is already car in vanilla, and it would cause name collision if you'd simply did "car"). Regardless of it name, it'd behave much like biter and players would not be able to enter in that. If you're so inclined, you can spawn several entities (a unit and a bunch of cars, one per seat for the player) atop of each other and use scripts to maintain facade of a single multi-functional thing. I believe Aii has those units below cars, source is complicated to read though.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

Mr.YaR
Inserter
Inserter
Posts: 26
Joined: Fri Jan 22, 2016 9:17 am
Contact:

Re: Various newcomer to modding questions

Post by Mr.YaR »

Thanks for this very welcome information!

EDIT2: Found that if you simply reduce the collision box of something to a ridiculusly low number - it stops colliding(used this to solve the projectile/friendly fire problem. --collision_box = 0.000001 and x2 different area effect damage.
It's a very noob-friendly solution for artillery-like designs.

Also found how to do this
Got this finaly myself

Post Reply

Return to “Modding help”