[Mod] Smart shop 7.11 [smartshop]
- rubenwardy
- Moderator
- Posts: 6978
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: Bristol, United Kingdom
- Contact:
Re: [Mod] Smart shop [smartshop]
Wow, this is like watching a really bad hacking ahow
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
YES, THE PROBLEM IS C++ ENGINE. BECAUSE NOW MY SERVER IT'S NOT CRASHING.MineYoshi wrote:I forgot the say there is a Lua compiler in the engine... So can be from the engine too, but since mostly times is the mod, i have to say i didn't think about that factParaklataChotou wrote:I removed the old c++ and now it's working fine - by the moment. but if you say that it's error on programming, so I'll need to consider remove this mod. It's an amazing mod, but these bugs are unacceptable for a server.
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
You were right. My server still crashing. I'll download the mod again, and install it. If it still crashing, I'll remove it.
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
Re: [Mod] Smart shop [smartshop]
Try with a fresh Minetest version...ParaklataChotou wrote:You were right. My server still crashing. I'll download the mod again, and install it. If it still crashing, I'll remove it.
Are you using 64bit Minetest? (Justly wondering)
Have a nice day! :D
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
Yes, I'm using 64 bit. And this minetest I downloaded recently. But I tried this: now I added the smartshop folder directly to minetest_game folder. Now let's see if it works.MineYoshi wrote:Try with a fresh Minetest version...ParaklataChotou wrote:You were right. My server still crashing. I'll download the mod again, and install it. If it still crashing, I'll remove it.
Are you using 64bit Minetest? (Justly wondering)
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
Re: [Mod] Smart shop [smartshop]
It doesn't matter where you put it!ParaklataChotou wrote:Yes, I'm using 64 bit. And this minetest I downloaded recently. But I tried this: now I added the smartshop folder directly to minetest_game folder. Now let's see if it works.MineYoshi wrote:Try with a fresh Minetest version...ParaklataChotou wrote:You were right. My server still crashing. I'll download the mod again, and install it. If it still crashing, I'll remove it.
Are you using 64bit Minetest? (Justly wondering)
Simply, try another build, likely the sfan's one: viewtopic.php?f=42&t=1523&start=525#p229282 download it and test the mod.
Recently some people are having issues with Minetest 64 bit version... Try that, i hope that solve the problem...
Have a nice day! :D
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
Kirby: AT LEAST THE SFAN PATCHES IS WORKING SO WELL AND THE MINETEST SERVER IT'S NOT BREAKING - BY THE MOMENT. THANK YOU FOR YOUR SUGGESTION.
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
Re: [Mod] Smart shop [smartshop]
Please, Don't use CAPITALS ALL THE TIME it makes look likely you're shouting...ParaklataChotou wrote:Kirby: AT LEAST THE SFAN PATCHES IS WORKING SO WELL AND THE MINETEST SERVER IT'S NOT BREAKING - BY THE MOMENT. THANK YOU FOR YOUR SUGGESTION.
Also, i think the next version of Minetest will work alright!
Have a nice day! :D
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
Still working so well.MineYoshi wrote:Please, Don't use CAPITALS ALL THE TIME it makes look likely you're shouting...ParaklataChotou wrote:Kirby: AT LEAST THE SFAN PATCHES IS WORKING SO WELL AND THE MINETEST SERVER IT'S NOT BREAKING - BY THE MOMENT. THANK YOU FOR YOUR SUGGESTION.
Also, i think the next version of Minetest will work alright!
Thanks <3
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
Re: [Mod] Smart shop [smartshop]
Propose replace 1 sign by Mese lamp in shop's recipe, becasue shop glows in the dark...
yeah it glows, but is still pretty expensive to make, and would be much more just to find 3 mese, there will be a torch instead :-)
stuff used to make 1 shop:
chests: 32 wood + 4 steel
signs: 24 wood + 4 sticks
torch: 1 stick + 1 coal
the result: 56 wood, 5 sticks, 4 steel, 1 coal
... so its pretty expensive to make.
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
No, this mods it's not working, and it causes server crash. Reasons? I don't know. But I removed this mod - it's not a good idea use this mod on servers. I removed this mod from my server, I did removed all my shops and added simple shop - and it works fine.
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
Re: [Mod] Smart shop [smartshop]
Show the error you are receiving in terminal/console when minetest crashes and a fix can be found... Note: This mod is working a-ok on Xanadu server (just sayin').
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
Thank you tenplusone, but I've removed the smartshops. It's really cool, but it was glitchy. and that point you said I've tried, and it didn't work. If you have fixed the smartshop on your server, you can attach the patched file. It would help to other players. And thank you for your suggestion.TenPlus1 wrote:Show the error you are receiving in terminal/console when minetest crashes and a fix can be found... Note: This mod is working a-ok on Xanadu server (just sayin').
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
Re: [Mod] Smart shop [smartshop]
Here is the smartshop code we use in Xanadu and new recipe, hope it helps:
Code: Select all
smartshop = {
user = {},
tmp = {},
dir = {
{x = 0, y = 0, z = -1},
{x = -1, y = 0, z = 0},
{x = 0, y = 0, z = 1},
{x = 1, y = 0, z = 0}
},
dpos = {
{
{x = 0.2, y =0.2, z = 0},
{x = -0.2, y = 0.2, z = 0},
{x = 0.2, y = -0.2, z = 0},
{ x =-0.2, y =- 0.2, z = 0}
},
{
{x = 0, y = 0.2, z = 0.2},
{x = 0, y = 0.2, z = -0.2},
{x = 0, y = -0.2, z = 0.2},
{x = 0, y = -0.2, z = -0.2}
},
{
{x = -0.2, y = 0.2, z = 0},
{x = 0.2, y = 0.2, z = 0},
{x = -0.2, y = -0.2, z = 0},
{x = 0.2, y = -0.2, z = 0}
},
{
{x = 0, y = 0.2, z = -0.2},
{x = 0, y = 0.2, z = 0.2},
{x = 0, y = -0.2, z = -0.2},
{x = 0, y = -0.2, z = 0.2}
}
}
}
minetest.register_craft({
output = "smartshop:shop",
type = "shapeless",
recipe = {"default:chest_locked", "default:meselamp"},
})
smartshop.update = function(pos, stat)
--clear
local spos = minetest.pos_to_string(pos)
for _, ob in pairs(minetest.get_objects_inside_radius(pos, 2)) do
if ob
and ob:get_luaentity()
and ob:get_luaentity().smartshop
and ob:get_luaentity().pos == spos then
ob:remove()
end
end
if stat == "clear" then
return
end
--update
local meta = minetest.get_meta(pos)
if not meta then return end -- ADDED
local inv = meta:get_inventory()
local node = minetest.get_node(pos)
local dp = smartshop.dir[node.param2 + 1]
if not dp then
return
end
pos.x = pos.x + dp.x * 0.01
pos.y = pos.y + dp.y * 6.5 / 16
pos.z = pos.z + dp.z * 0.01
for i = 1, 4, 1 do
local item = inv:get_stack("give" .. i, 1):get_name()
local pos2 = smartshop.dpos[node.param2 + 1][i]
if item ~= "" then
smartshop.tmp.item = item
smartshop.tmp.pos = spos
local e = minetest.add_entity({
x = pos.x + pos2.x,
y = pos.y + pos2.y,
z = pos.z + pos2.z
},"smartshop:item")
e:setyaw(math.pi * 2 - node.param2 * math.pi / 2)
end
end
end
minetest.register_entity(":smartshop:item",{
hp_max = 1,
visual = "wielditem",
visual_size = {x = .20,y = .20},
collisionbox = {0, 0, 0, 0, 0, 0},
physical = false,
textures = {"air"},
smartshop = true,
on_activate = function(self, staticdata)
if not self then -- ADDED
self.object:remove()
return
end
if smartshop.tmp.item ~= nil then
self.item = smartshop.tmp.item
self.pos = smartshop.tmp.pos
smartshop.tmp = {}
else
if staticdata ~= nil
and staticdata ~= "" then
local data = staticdata:split(';')
if data
and data[1]
and data[2] then
self.item = data[1]
self.pos = data[2]
end
end
end
if self.item ~= nil then
self.object:set_properties({textures = {self.item}})
else
self.object:remove()
end
end,
get_staticdata = function(self)
if self.item ~= nil
and self.pos ~= nil then
return self.item .. ';' .. self.pos
end
return ""
end,
})
smartshop.showform = function(pos, player, re)
local meta = minetest.get_meta(pos) ; if not meta then return end
local creative = meta:get_int("creative")
local inv = meta:get_inventory()
local gui = ""
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local owner = meta:get_string("owner") == player:get_player_name()
if re then
owner = false
end
smartshop.user[player:get_player_name()] = pos
if owner then
gui = ""
.. "size[8,10]"
.. "button_exit[6,0;1.5,1;customer;Customer]"
.. "label[0,0.2;Item:]"
.. "label[0,1.2;Price:]"
.. "list[nodemeta:" .. spos .. ";give1;2,0;1,1;]"
.. "list[nodemeta:" .. spos .. ";pay1;2,1;1,1;]"
.. "list[nodemeta:" .. spos .. ";give2;3,0;1,1;]"
.. "list[nodemeta:" .. spos .. ";pay2;3,1;1,1;]"
.. "list[nodemeta:" .. spos .. ";give3;4,0;1,1;]"
.. "list[nodemeta:" .. spos .. ";pay3;4,1;1,1;]"
.. "list[nodemeta:" .. spos .. ";give4;5,0;1,1;]"
.. "list[nodemeta:" .. spos .. ";pay4;5,1;1,1;]"
if creative == 1 then
gui = gui .."label[0.5,-0.4;Your stock is unlimited because you have creative or give]"
.."button[6,1;2.2,1;tooglelime;Toogle ltd.]"
end
gui = gui
.."list[nodemeta:" .. spos .. ";main;0,2;8,4;]"
.."list[current_player;main;0,6.2;8,4;]"
.."listring[nodemeta:" .. spos .. ";main]"
.."listring[current_player;main]"
else
gui = ""
.."size[8,6]"
.."list[current_player;main;0,2.2;8,4;]"
.."label[0,0.2;Item:]"
.."label[0,1.2;Price:]"
.."list[nodemeta:" .. spos .. ";give1;2,0;1,1;]"
.."item_image_button[2,1;1,1;".. inv:get_stack("pay1",1):get_name() ..";buy1;\n\n\b\b\b\b\b" .. inv:get_stack("pay1",1):get_count() .."]"
.."list[nodemeta:" .. spos .. ";give2;3,0;1,1;]"
.."item_image_button[3,1;1,1;".. inv:get_stack("pay2",1):get_name() ..";buy2;\n\n\b\b\b\b\b" .. inv:get_stack("pay2",1):get_count() .."]"
.."list[nodemeta:" .. spos .. ";give3;4,0;1,1;]"
.."item_image_button[4,1;1,1;".. inv:get_stack("pay3",1):get_name() ..";buy3;\n\n\b\b\b\b\b" .. inv:get_stack("pay3",1):get_count() .."]"
.."list[nodemeta:" .. spos .. ";give4;5,0;1,1;]"
.."item_image_button[5,1;1,1;".. inv:get_stack("pay4",1):get_name() ..";buy4;\n\n\b\b\b\b\b" .. inv:get_stack("pay4",1):get_count() .."]"
end
minetest.after((0.1), function(gui)
return minetest.show_formspec(player:get_player_name(), "smartshop.showform",gui)
end, gui)
end
minetest.register_on_player_receive_fields(function(player, form, pressed)
if form == "smartshop.showform" then
if pressed.customer then
return smartshop.showform(smartshop.user[player:get_player_name()], player, true)
elseif pressed.tooglelime then
local pos = smartshop.user[player:get_player_name()]
if not pos then return end -- ADDED
local meta = minetest.get_meta(pos)
if not meta then return end -- ADDED
local pname = player:get_player_name()
if meta:get_int("type") == 0 then
meta:set_int("type", 1)
minetest.chat_send_player(pname, "Your stock is limited")
else
meta:set_int("type", 0)
minetest.chat_send_player(pname, "Your stock is unlimited")
end
elseif not pressed.quit then
local n = 1
for i = 1, 4, 1 do
n = i
if pressed["buy" .. i] then
break
end
end
local pos = smartshop.user[player:get_player_name()]
if not pos then return end -- ADDED
local meta = minetest.get_meta(pos)
if not meta then return end -- ADDED
local type = meta:get_int("type")
local inv = meta:get_inventory()
local pinv = player:get_inventory()
local pname = player:get_player_name()
if pressed["buy" .. n] then
local name = inv:get_stack("give" .. n, 1):get_name()
local stack = name .." ".. inv:get_stack("give" .. n,1):get_count()
local pay = inv:get_stack("pay" .. n, 1):get_name() .." ".. inv:get_stack("pay" .. n, 1):get_count()
if name ~= "" then
if type == 1
and inv:room_for_item("main", pay) == false then
minetest.chat_send_player(pname, "Error: The owners stock is full, cant receive, exchange aborted.")
return
end
if type == 1
and inv:contains_item("main", stack) == false then
minetest.chat_send_player(pname, "Error: The owners stock is end.")
return
end
if not pinv:contains_item("main", pay) then
minetest.chat_send_player(pname, "Error: You dont have enough in your inventory to buy this, exchange aborted.")
return
end
if not pinv:room_for_item("main", stack) then
minetest.chat_send_player(pname, "Error: Your inventory is full, exchange aborted.")
return
end
pinv:remove_item("main", pay)
pinv:add_item("main", stack)
if type == 1 then
inv:remove_item("main", stack)
inv:add_item("main", pay)
end
end
end
else
if smartshop.user[player:get_player_name()] then
local meta = minetest.get_meta(smartshop.user[player:get_player_name()])
if not meta then return end -- ADDED
if meta:get_string("owner") == player:get_player_name() then
smartshop.update(smartshop.user[player:get_player_name()], "update")
end
end
smartshop.user[player:get_player_name()] = nil
end
end
end)
minetest.register_node(":smartshop:shop", {
description = "Smartshop",
tiles = {"default_chest_top.png^[colorize:#ffffff77^default_obsidian_glass.png"},
groups = {
choppy = 2, oddly_breakable_by_hand = 1,
tubedevice = 1, tubedevice_receiver = 1
},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.0, 0.5, 0.5, 0.5}
},
paramtype2="facedir",
paramtype = "light",
sunlight_propagates = true,
light_source = 10,
tube = {
insert_object = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local added = inv:add_item("main", stack)
return added
end,
can_insert = function(pos, node, stack, direction)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:room_for_item("main", stack)
end,
input_inventory = "main",
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1}
},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name())
meta:set_string("infotext", "Shop by: " .. placer:get_player_name())
meta:set_int("type", 1)
if minetest.check_player_privs(placer:get_player_name(), {creative = true})
or minetest.check_player_privs(placer:get_player_name(), {give = true}) then
meta:set_int("creative", 1)
meta:set_int("type", 0)
end
end,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_int("state", 0)
meta:get_inventory():set_size("main", 32)
meta:get_inventory():set_size("give1", 1)
meta:get_inventory():set_size("pay1", 1)
meta:get_inventory():set_size("give2", 1)
meta:get_inventory():set_size("pay2", 1)
meta:get_inventory():set_size("give3", 1)
meta:get_inventory():set_size("pay3", 1)
meta:get_inventory():set_size("give4", 1)
meta:get_inventory():set_size("pay4", 1)
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
smartshop.showform(pos, player)
end,
on_punch = function(pos, node, puncher)
smartshop.update(pos, "update") -- ADDED
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if minetest.get_meta(pos):get_string("owner") == player:get_player_name() then
return stack:get_count()
end
return 0
end,
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
if minetest.get_meta(pos):get_string("owner") == player:get_player_name() then
return stack:get_count()
end
return 0
end,
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
if minetest.get_meta(pos):get_string("owner") == player:get_player_name() then
return count
end
return 0
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
if not meta then return false end -- ADDED
local inv = meta:get_inventory()
if (meta:get_string("owner")==player:get_player_name()
and inv:is_empty("main")
and inv:is_empty("pay1")
and inv:is_empty("pay2")
and inv:is_empty("pay3")
and inv:is_empty("pay4")
and inv:is_empty("give1")
and inv:is_empty("give2")
and inv:is_empty("give3")
and inv:is_empty("give4"))
or meta:get_string("owner") == "" then
smartshop.update(pos, "clear")
return true
end
end,
})
- ParaklataChotou
- Member
- Posts: 209
- Joined: Sat Jun 18, 2016 17:09
- GitHub: paraklatachotou
- IRC: CareBearWhoCares
- In-game: AutistCortana
Re: [Mod] Smart shop [smartshop]
I've changed of mod, but anyways, thanks. But now, other servers could benefit with this code. Thank you TenPlus1.
Visit my server: freextress.ddnsking.com 30002 . mobs, npcs, interesting places, pvp.
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: [Mod] Smart shop [smartshop]
The smartshops are very useful and decorative at the same time. As far as their functionality goes, it would be great to be able to see how many trades the shop can do based on its current stock. It's annoying to collect materials from your storage just to find out that the shop is out of stock - or had only one or two items left to sale.
A list of my mods can be found here.
Re: [Mod] Smart shop [smartshop]
i see, like some stores takes ages to go through and click tons of times, thats tediously .It's annoying to collect materials from your storage just to find out that the shop is out of stock
i will try to add a calculation to the infotext.
Re: [Mod] Smart shop 2 [smartshop]
Done!
V2:
+ the shop will always show how many purchases there are left
if the material is end will it be removed from the list
+ protection_bypass support (makes players with the priv can do everything that the owner can)
+ License changed to CC0
V2:
+ the shop will always show how many purchases there are left
if the material is end will it be removed from the list
+ protection_bypass support (makes players with the priv can do everything that the owner can)
+ License changed to CC0
- Attachments
-
- screenshot_20161129_111930.png (85.38 KiB) Viewed 1947 times
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: [Mod] Smart shop 2 [smartshop]
Thank you for the update! I hope it'll show up on servers soon.
A list of my mods can be found here.
Re: [Mod] Smart shop 2 [smartshop]
Another update: Make it so you can buy the items in the give line, so that the shops show that they are empty when the stock runs out, so you don't have to take the time to found that out.
Re: [Mod] Smart shop 3 [smartshop]
Code: Select all
Make it so you can buy the items in the give line
oddly enough this did not mess.
+V3: the "All" button will lime your stock to the inventory or and the giveline, its on as default + calculated in the info text.
in most cases i think people want to sell all, so it was with good reason to add itl :-)
- Diamond knight
- Member
- Posts: 475
- Joined: Sun Apr 19, 2015 19:50
- GitHub: Diamondknight
- In-game: Ferrumprinceps
- Location: Chilling in Constantinople
- Contact:
Re: [Mod] Smart shop 4 [smartshop]
when is aliveai 1.9 coming out?
finally a use for shops in singleplayer
finally a use for shops in singleplayer
My modding team: https://github.com/basilea-rhomaion
- christoferlevich
- Member
- Posts: 325
- Joined: Thu Dec 01, 2016 23:44
- GitHub: ChristoferL
- Location: Athol, Massachusetts
Re: [Mod] Smart shop 4r [smartshop]
I just noticed the update! Will be testing in a 30 seat network on Monday. I love the concept and really would like this mod to rock and roll! :)
everything can be a learning experience...
-
- Member
- Posts: 100
- Joined: Wed Nov 29, 2017 17:33
- In-game: IanniPowerup
- Contact:
Re: [Mod] Smart shop 5 [smartshop]
is the download link removed ? I do not see it
Who is online
Users browsing this forum: No registered users and 65 guests