[slingshot] Update to Git commit ef698e8:
https://github.com/AntumMT/mtmod-slingshot/tree/ef698e8master
parent
90c54df1f8
commit
85e028a6e5
|
@ -39,7 +39,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
||||||
* [enchanting][] ([GPL / WTFPL / CC BY-SA-NA][lic.enchanting]) -- version: [13ea31c Git][ver.enchanting] *2016-12-16*
|
* [enchanting][] ([GPL / WTFPL / CC BY-SA-NA][lic.enchanting]) -- version: [13ea31c Git][ver.enchanting] *2016-12-16*
|
||||||
* equipment/
|
* equipment/
|
||||||
* [airtanks][] ([MIT][lic.airtanks]) -- version: [5787956 Git][ver.airtanks] *2017-05-13*
|
* [airtanks][] ([MIT][lic.airtanks]) -- version: [5787956 Git][ver.airtanks] *2017-05-13*
|
||||||
* [slingshot][] ([MIT][lic.slingshot] / [CC0][lic.cc0]) -- version: [7af8719 Git][ver.slingshot] *2017-06-07*
|
* [slingshot][] ([MIT][lic.slingshot] / [CC0][lic.cc0]) -- version: [ef698e8 Git][ver.slingshot] *2017-06-26*
|
||||||
* [xtraarmor][] ([CC BY-SA][lic.ccbysa3.0]) -- version: 0.3
|
* [xtraarmor][] ([CC BY-SA][lic.ccbysa3.0]) -- version: 0.3
|
||||||
* farming/
|
* farming/
|
||||||
* [crops][] ([LGPL / CC BY-SA / CC BY / CC0][lic.crops]) -- version: [2b1bb37 Git][ver.crops] *2017-03-31* ([patched][patch.crops])
|
* [crops][] ([LGPL / CC BY-SA / CC BY / CC0][lic.crops]) -- version: [2b1bb37 Git][ver.crops] *2017-03-31* ([patched][patch.crops])
|
||||||
|
@ -496,7 +496,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
||||||
[ver.rainbow_ore]: https://github.com/FsxShader2012/rainbow_ore/tree/6e77693
|
[ver.rainbow_ore]: https://github.com/FsxShader2012/rainbow_ore/tree/6e77693
|
||||||
[ver.signs_lib]: https://github.com/minetest-mods/signs_lib/tree/3e00159
|
[ver.signs_lib]: https://github.com/minetest-mods/signs_lib/tree/3e00159
|
||||||
[ver.simple_protection]: https://github.com/SmallJoker/simple_protection/tree/23c024f
|
[ver.simple_protection]: https://github.com/SmallJoker/simple_protection/tree/23c024f
|
||||||
[ver.slingshot]: https://github.com/AntumMT/mtmod-slingshot/tree/7af8719
|
[ver.slingshot]: https://github.com/AntumMT/mtmod-slingshot/tree/ef698e8
|
||||||
[ver.sneeker]: https://github.com/AntumMT/mtmod-sneeker/tree/a56b9c2
|
[ver.sneeker]: https://github.com/AntumMT/mtmod-sneeker/tree/a56b9c2
|
||||||
[ver.snowdrift]: https://github.com/paramat/snowdrift/tree/fcb0537
|
[ver.snowdrift]: https://github.com/paramat/snowdrift/tree/fcb0537
|
||||||
[ver.spawneggs]: https://github.com/thefamilygrog66/spawneggs/tree/4650370
|
[ver.spawneggs]: https://github.com/thefamilygrog66/spawneggs/tree/4650370
|
||||||
|
|
|
@ -37,24 +37,26 @@ function slingshot.on_use(itemstack, user, veloc)
|
||||||
local upos = {x=pos.x, y=pos.y+2, z=pos.z}
|
local upos = {x=pos.x, y=pos.y+2, z=pos.z}
|
||||||
local dir = user:get_look_dir()
|
local dir = user:get_look_dir()
|
||||||
local item = itemstack:to_table()
|
local item = itemstack:to_table()
|
||||||
local mode = minetest.deserialize(item['metadata'])
|
-- Throw items in slot to right
|
||||||
if mode == nil then mode = 1 else mode = mode.mode end
|
local mode = 1
|
||||||
|
|
||||||
local item = user:get_inventory():get_stack('main', user:get_wield_index()+mode):get_name()
|
local item = user:get_inventory():get_stack('main', user:get_wield_index()+mode):get_name()
|
||||||
if item == '' then return itemstack end
|
if item == '' then return itemstack end
|
||||||
local e = minetest.add_item({x=pos.x, y=pos.y+2, z=pos.z}, item)
|
local e = minetest.add_item({x=pos.x, y=pos.y+2, z=pos.z}, item)
|
||||||
e:setvelocity({x=dir.x*veloc, y=dir.y*veloc, z=dir.z*veloc})
|
if e then
|
||||||
e:setacceleration({x=dir.x*-3, y=-5, z=dir.z*-3})
|
e:setvelocity({x=dir.x*veloc, y=dir.y*veloc, z=dir.z*veloc})
|
||||||
e:get_luaentity().age = slingshot.tmp_time
|
e:setacceleration({x=dir.x*-3, y=-5, z=dir.z*-3})
|
||||||
table.insert(slingshot.tmp_throw, {ob=e, timer=2, user=user:get_player_name()})
|
e:get_luaentity().age = slingshot.tmp_time
|
||||||
|
table.insert(slingshot.tmp_throw, {ob=e, timer=2, user=user:get_player_name()})
|
||||||
|
|
||||||
if item == 'slingshot:slingshot' then
|
if item == 'slingshot:slingshot' then
|
||||||
itemstack:set_wear(9999999)
|
itemstack:set_wear(9999999)
|
||||||
|
end
|
||||||
|
|
||||||
|
user:get_inventory():remove_item('main', item)
|
||||||
|
minetest.sound_play('slingshot_throw', {pos=pos, gain = 1.0, max_hear_distance = 5,})
|
||||||
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
user:get_inventory():remove_item('main', item)
|
|
||||||
minetest.sound_play('slingshot_throw', {pos=pos, gain = 1.0, max_hear_distance = 5,})
|
|
||||||
return itemstack
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,27 +86,6 @@ function slingshot.register(name, def)
|
||||||
slingshot.on_use(itemstack, user, def.velocity)
|
slingshot.on_use(itemstack, user, def.velocity)
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_place = function(itemstack, user, pointed_thing)
|
|
||||||
local item = itemstack:to_table()
|
|
||||||
local meta = minetest.deserialize(item['metadata'])
|
|
||||||
local mode = 0
|
|
||||||
if meta == nil then meta = {} mode = 1 end
|
|
||||||
if meta.mode == nil then meta.mode = 1 end
|
|
||||||
mode = (meta.mode)
|
|
||||||
if mode == 1 then
|
|
||||||
mode = -1
|
|
||||||
minetest.chat_send_player(user:get_player_name(), 'Use stack to left')
|
|
||||||
else
|
|
||||||
mode = 1
|
|
||||||
minetest.chat_send_player(user:get_player_name(), 'Use stack to right')
|
|
||||||
end
|
|
||||||
meta.mode = mode
|
|
||||||
item.metadata = minetest.serialize(meta)
|
|
||||||
item.meta = minetest.serialize(meta)
|
|
||||||
itemstack:replace(item)
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- def.ingredient overrides def.recipe
|
-- def.ingredient overrides def.recipe
|
||||||
|
|
Loading…
Reference in New Issue