Hello everyone. I'm new to mod making and I thought i would give making a mod for factorio a go as I know lua. But after looking through the API's i'm not certain if my mod idea can actually be done. I want to make an environmental hazard to add difficulty to the game, this would be in the form of an ore.
But there are two things that I want the ore to do that I can't think of a way of implementing. 1. The ore is toxic, and i want it to do damage to the player when they walk over it or attempt to mine it by hand. 2. I want the ore to spread on its own, checking tiles around it to see if it is free and have a chance of adding the ore to that tile.
I know i can add a new ore to the game and I'm already working on that aspect. But would the 2 properties I described be done using the current mod API, or is it something outside of it's technical capabilities?
Many thanks in advanced.
Ore player damage and spread.
-
- Manual Inserter
- Posts: 3
- Joined: Mon Mar 28, 2016 6:47 pm
- Contact:
-
- Fast Inserter
- Posts: 171
- Joined: Sun Feb 17, 2013 4:31 pm
- Contact:
Re: Ore player damage and spread.
You could use the payers current x\y coordinates, then do a entity search to see if there is some of your ore under the player, and then call the damage method on the player if there is.
I think it's do able, but performance may be an issue?
I think it's do able, but performance may be an issue?
-
- Manual Inserter
- Posts: 3
- Joined: Mon Mar 28, 2016 6:47 pm
- Contact:
Re: Ore player damage and spread.
Hay, that mite work. I was thinking along the lines of the ore actively searching for the player, but now i think of it that would be a bit of overkill when it comes to calculations, as all the ore entity's will be doing the same scan over and over. Now i just need to figure out if I can get the ore to spread.
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: Ore player damage and spread.
Sounds like you want to make Tiberium!
Checking the player's location every ~30 ticks or so and testing for the presence of Tiberium, then damaging if found would be fine for performance. As for spreading, well, you'll probably want to make a new type of entity and place it down at mapgen, and have this entity do the periodic expansion of Tiberium fields -- a Tiberium spawner, of sorts; if I'm not mistaken this is now the C&C games themselves handle Tiberium expansion. Perhaps code it as a radar-type entity and make use of the on_sector_scanned event for spawning new fields.
Checking the player's location every ~30 ticks or so and testing for the presence of Tiberium, then damaging if found would be fine for performance. As for spreading, well, you'll probably want to make a new type of entity and place it down at mapgen, and have this entity do the periodic expansion of Tiberium fields -- a Tiberium spawner, of sorts; if I'm not mistaken this is now the C&C games themselves handle Tiberium expansion. Perhaps code it as a radar-type entity and make use of the on_sector_scanned event for spawning new fields.
-
- Manual Inserter
- Posts: 3
- Joined: Mon Mar 28, 2016 6:47 pm
- Contact:
Re: Ore player damage and spread.
I can neither confirm or deny your assumptions .
But i have been looking at the code for bitter spanners and i think i can uses that if it is possible to get a sawner to spawn ore, and to also give ore enemy attributes to the ore allowing it to do melee attacks on the player.
I will see if that works, in the mean time any code suggestions on the best way of doing things in the most preference friendly way would be of help.
But i have been looking at the code for bitter spanners and i think i can uses that if it is possible to get a sawner to spawn ore, and to also give ore enemy attributes to the ore allowing it to do melee attacks on the player.
I will see if that works, in the mean time any code suggestions on the best way of doing things in the most preference friendly way would be of help.