[MOD 0.11.22] Galactic Trade Mod
Posted: Sun May 24, 2015 6:23 am
by coopmaster
Type: Mod
Name: Galactic Trade
Description: Adds the ability to buy and sell items. This version is no longer supported, go here for the latest versions.
License: MIT
Version: 0.4.1
Release: 2015-07-17
Tested-With-Factorio-Version: 0.11.22
Category: Item
Tags: Trading, Market
Download-Url: https://forums.factorio.com/forum/dow ... hp?id=4523
Website: archive of older versions (because I don't have a website yet)
Name: Galactic Trade
Description: Adds the ability to buy and sell items. This version is no longer supported, go here for the latest versions.
License: MIT
Version: 0.4.1
Release: 2015-07-17
Tested-With-Factorio-Version: 0.11.22
Category: Item
Tags: Trading, Market
Download-Url: https://forums.factorio.com/forum/dow ... hp?id=4523
Website: archive of older versions (because I don't have a website yet)
License
License
The MIT License (MIT)
Copyright (c) 2015 Cooper Mahring
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--------------------------------------------------------------------------------------------------------------------------
This license basically means that you can do whatever you want with the code, just make sure that you give credit to me.
You can use the code in your mod if you want. If you make a modpack with my mod in it, just let me know.
If I ever stop working on the mod, I will most likely edit the post to make sure that it is clear that it isn't being worked on anymore. If that ever does happen without me saying anything, the code can be used by anyone to make a similar mod.
The MIT License (MIT)
Copyright (c) 2015 Cooper Mahring
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--------------------------------------------------------------------------------------------------------------------------
This license basically means that you can do whatever you want with the code, just make sure that you give credit to me.
You can use the code in your mod if you want. If you make a modpack with my mod in it, just let me know.
If I ever stop working on the mod, I will most likely edit the post to make sure that it is clear that it isn't being worked on anymore. If that ever does happen without me saying anything, the code can be used by anyone to make a similar mod.
Long description
Long description
THIS VERSION IS NO LONGER SUPPORTED, if you want to use the mod in a more stable version, update to 0.12+ and go here
This mod adds the ability to buy and sell items in the game at market prices. You unlock the chest by researching market trading which comes after electronics. This mod adds two items (shown below) the buying trading chest (top left), the selling trading chest (top right), the logistics buying trading chest (bottom left), and the logistics selling chest (bottom right).
The selling trading chest adds a gui on the top left of the screen (shown below) which shows you information about the sale of the contents. It also has a checkbox that allows you to disable that chest from selling its contents to the market.
The logistics selling chest is a chest that is a part of the logistics network that acts like a requester chest, just with the same functionality as a selling trading chest.
The buying trading chest also gives an additional gui that allows the sale of items. It shows the info about the sale and by clicking on any of the buttons with item icons, it switches the sale to that item. The textbox is where you enter the amount you want to have in the box, make sure you press the update button to update the information. Also like the selling trading box, it has a checkbox which allows the ability to disable that chest from buying things off the market. The copy and paste buttons allow you to copy trading chest values over to other trading chests. The current amount text shows how much it would cost to get the currently requested items, so if you already have 50 iron in the chest and request 100, it shows the price for 50 iron. There are multiple pages of items (which the size of a page can be changed in the config), clicking the left or right arrows will take you to different pages. The logistics buying trading chest has the same gui, except it acts like a passive provider chest.
Once a day, at noon (in game time of day value of 0) , everything in the selling trading chest is sold for credits with a 15% cut of the buying price. In the buying trading chest, whatever item is sold is bought at the amount requested. Credits are in the top left of the screen (see below).
If you don't have enough credits to complete the purchase, currently you won't buy anything for that chest's order (each chest has its own order it request). The price of each item is determined by the resources it takes to craft them, any item that can be crafted in the game can be bought. The price is also determined by the crafting time (2 credits for each resource item (recursive)) and if it was smelted (additional 15 credits). Items that have no crafting recipe have a value set manually, so might need balancing. You don't need any research to buy or sell items, you just need the appropriate chests.
Next to the credits is a button that shows info of your current and previous transactions on the market. You can look at all the days where you had a transaction and how much you gained or lost. You can look through your transaction history with the arrow buttons (outer ones being first and last).
THIS VERSION IS NO LONGER SUPPORTED, if you want to use the mod in a more stable version, update to 0.12+ and go here
This mod adds the ability to buy and sell items in the game at market prices. You unlock the chest by researching market trading which comes after electronics. This mod adds two items (shown below) the buying trading chest (top left), the selling trading chest (top right), the logistics buying trading chest (bottom left), and the logistics selling chest (bottom right).
The selling trading chest adds a gui on the top left of the screen (shown below) which shows you information about the sale of the contents. It also has a checkbox that allows you to disable that chest from selling its contents to the market.
The logistics selling chest is a chest that is a part of the logistics network that acts like a requester chest, just with the same functionality as a selling trading chest.
The buying trading chest also gives an additional gui that allows the sale of items. It shows the info about the sale and by clicking on any of the buttons with item icons, it switches the sale to that item. The textbox is where you enter the amount you want to have in the box, make sure you press the update button to update the information. Also like the selling trading box, it has a checkbox which allows the ability to disable that chest from buying things off the market. The copy and paste buttons allow you to copy trading chest values over to other trading chests. The current amount text shows how much it would cost to get the currently requested items, so if you already have 50 iron in the chest and request 100, it shows the price for 50 iron. There are multiple pages of items (which the size of a page can be changed in the config), clicking the left or right arrows will take you to different pages. The logistics buying trading chest has the same gui, except it acts like a passive provider chest.
Once a day, at noon (in game time of day value of 0) , everything in the selling trading chest is sold for credits with a 15% cut of the buying price. In the buying trading chest, whatever item is sold is bought at the amount requested. Credits are in the top left of the screen (see below).
If you don't have enough credits to complete the purchase, currently you won't buy anything for that chest's order (each chest has its own order it request). The price of each item is determined by the resources it takes to craft them, any item that can be crafted in the game can be bought. The price is also determined by the crafting time (2 credits for each resource item (recursive)) and if it was smelted (additional 15 credits). Items that have no crafting recipe have a value set manually, so might need balancing. You don't need any research to buy or sell items, you just need the appropriate chests.
Next to the credits is a button that shows info of your current and previous transactions on the market. You can look at all the days where you had a transaction and how much you gained or lost. You can look through your transaction history with the arrow buttons (outer ones being first and last).
Pictures
Version history
Version history
Version# (Date): What has changed...
0.1.0 (2015-05-25):
-Initial release
0.1.1 (2015-05-25):
-fixed selling values when selling items
-fixed all buying chest buying amounts set to 0 when another buying chest is destroyed
-added gui for selling chest which shows the value of the items in the chest
0.1.2 (2015-05-25):
-selling trading chest gui now shows value it will sell for on the market with merchant cut
0.2.0 (2015-05-27):
-fixed all buying chest buying amounts set to 0 when another buying chest is destroyed (instead of being mined)
-added checkbox for enabling/disabling the trading for a specific chest
-most items are now available on the market at the price of their recipes resource values
-support for other mods with a little bit of work required on the user's end
0.2.1 (2015-06-02):
-fixed when a trading chest is mined or placed by a robot, it would cause a crash (after trying opening another chest or buying or selling)
-if trading chest has more of an item than what you entered to buy, it now shows 0 instead of a negative number
-update button in buying trading chest now doesn't set the amount to 0 if a valid number isn't entered
-added copy and paste button for buying trading chest
-buying trading chest no longer request more items than it can accept
-added background for credits amount to make easier to see
0.2.2 (2015-06-07):
-base resources that don't have values now are shown when values are shown
-added values for NEAR mod (uncomment in control.lua) credit to Syriusz
-added config.lua and moved loading values for mods there
-fixed where modded smelted items didn't have extra value added
-added pages for item list and you can now change the size of the item list in the config.lua
-now reloads all values when mod loads (in case you want to change it in a map you already started)
-fixed some mods causing a loop when finding values
-added option in config to reload values on load
-added a way to blacklist modded items in config
0.2.3 (2015-06-10):
-fixed a bug where there wouldn't be more than one page after loading a save with the trading chest
0.3.0 (2015-07-08):
-made trading chest show localised name of items
-added loading bar to loading items
-items without values are now put into a horizontal list that fits the screen if there are too many
-you can now disable alerts for trader in config.lua
-added a button in the top left that tells current and previous transactions
-fixed a bug where new buying trading chests would not always be enabled by default
-made credits easier to read (by adding commas)
-no longer shows alert for trade merchant coming if you don't have any trading chests put down
-expanded both trading chests by 2 stacks
0.4.0 (2015-07-14):
-added logistic trading chests
-fixed a bug where if you started a vanilla game and tried to load galactic trade, it would cause an error
-added first and last buttons for transaction history
0.4.1 (2015-07-17):
-fixed issue where disabling selling trading chest would crash the game
Version# (Date): What has changed...
0.1.0 (2015-05-25):
-Initial release
0.1.1 (2015-05-25):
-fixed selling values when selling items
-fixed all buying chest buying amounts set to 0 when another buying chest is destroyed
-added gui for selling chest which shows the value of the items in the chest
0.1.2 (2015-05-25):
-selling trading chest gui now shows value it will sell for on the market with merchant cut
0.2.0 (2015-05-27):
-fixed all buying chest buying amounts set to 0 when another buying chest is destroyed (instead of being mined)
-added checkbox for enabling/disabling the trading for a specific chest
-most items are now available on the market at the price of their recipes resource values
-support for other mods with a little bit of work required on the user's end
0.2.1 (2015-06-02):
-fixed when a trading chest is mined or placed by a robot, it would cause a crash (after trying opening another chest or buying or selling)
-if trading chest has more of an item than what you entered to buy, it now shows 0 instead of a negative number
-update button in buying trading chest now doesn't set the amount to 0 if a valid number isn't entered
-added copy and paste button for buying trading chest
-buying trading chest no longer request more items than it can accept
-added background for credits amount to make easier to see
0.2.2 (2015-06-07):
-base resources that don't have values now are shown when values are shown
-added values for NEAR mod (uncomment in control.lua) credit to Syriusz
-added config.lua and moved loading values for mods there
-fixed where modded smelted items didn't have extra value added
-added pages for item list and you can now change the size of the item list in the config.lua
-now reloads all values when mod loads (in case you want to change it in a map you already started)
-fixed some mods causing a loop when finding values
-added option in config to reload values on load
-added a way to blacklist modded items in config
0.2.3 (2015-06-10):
-fixed a bug where there wouldn't be more than one page after loading a save with the trading chest
0.3.0 (2015-07-08):
-made trading chest show localised name of items
-added loading bar to loading items
-items without values are now put into a horizontal list that fits the screen if there are too many
-you can now disable alerts for trader in config.lua
-added a button in the top left that tells current and previous transactions
-fixed a bug where new buying trading chests would not always be enabled by default
-made credits easier to read (by adding commas)
-no longer shows alert for trade merchant coming if you don't have any trading chests put down
-expanded both trading chests by 2 stacks
0.4.0 (2015-07-14):
-added logistic trading chests
-fixed a bug where if you started a vanilla game and tried to load galactic trade, it would cause an error
-added first and last buttons for transaction history
0.4.1 (2015-07-17):
-fixed issue where disabling selling trading chest would crash the game
media
Video Spotlights
https://youtu.be/TtKj1XPknTc
https://youtu.be/TtKj1XPknTc
Adding Support for Other Mods
If you get stuck with the steps, you can check out my video which shows you how to do it here
1. go to galactic trade mod folder
2. copy styles.lua
3. go to mod you want to add support with (if it has extra items)
4. paste the styles.lua file
5. edit data.lua with a text editor
6. add to the end of the file
7. if it has any raw resources (resources that don't have crafting recipes, but are available) go back to galactic trade mod folder (otherwise you are done!)
8. make sure the mod isn't already supported (look below)
8. edit the config.lua file with a text editor
9. look for the line "--add raw resource values here (items which don't have crafting recipes) with their values, see examples below"
10. look at examples and make sure you know what the item name is inside the mod's files, it would look something like "iron-plate"
(there are also some mods which already have support, all you need to do is remove the --[[ and --]] that surrounds the mod you want support for)
11. put the new line in and if it is smelted then also look slightly lower down (it also has instructions)
12. if you have done all of those steps then the items from the mod should show up in the buying trading chest with the correct credit values
13. if you want to help others not do steps 7-12, post to the forum thread and tell me the mod it was, and the lines you added to the files.
1. go to galactic trade mod folder
2. copy styles.lua
3. go to mod you want to add support with (if it has extra items)
4. paste the styles.lua file
5. edit data.lua with a text editor
6. add
Code: Select all
require("styles")
7. if it has any raw resources (resources that don't have crafting recipes, but are available) go back to galactic trade mod folder (otherwise you are done!)
8. make sure the mod isn't already supported (look below)
8. edit the config.lua file with a text editor
9. look for the line "--add raw resource values here (items which don't have crafting recipes) with their values, see examples below"
10. look at examples and make sure you know what the item name is inside the mod's files, it would look something like "iron-plate"
(there are also some mods which already have support, all you need to do is remove the --[[ and --]] that surrounds the mod you want support for)
11. put the new line in and if it is smelted then also look slightly lower down (it also has instructions)
12. if you have done all of those steps then the items from the mod should show up in the buying trading chest with the correct credit values
13. if you want to help others not do steps 7-12, post to the forum thread and tell me the mod it was, and the lines you added to the files.
Planned Features
All future versions will be on the newer versions of the mod, I will still update this mod with bug fixes until 0.12 is released as stable.
Archive
archive of older versions
versions 0.4.x and before are for factorio version 0.11.22, the thread for 0.11.22 can be found at https://forums.factorio.com/forum/vie ... 14&t=12496
versions 0.4.x and before are for factorio version 0.11.22, the thread for 0.11.22 can be found at https://forums.factorio.com/forum/vie ... 14&t=12496