[Mod] Throwing [0.13] [throwing]

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

[Mod] Throwing [0.13] [throwing]

by Jeija » Sun Jan 01, 2012 15:26

Hey!

This mod adds simple bows and arrows to minetest.
There is no good texture for them yet... Send in yours if you want to and I'll add them to my mod.
Crafting Recipes:
Image
Image
Image

And some screenshots...
Image
Image

You can use the code to add your own throwable things...
What about TNT/Grenades/whatever?

I think the scriptapi should have a possibility to get the name of an object, this gave me the possibility to make arrows disappear when they hit a mob. Would be nice if someone added that.

There still seems to be a bug: The bow sometimes disappears when shooting, especially when a game has just started, but this doesn't seem to be a mod issue.

Works from minetest 20111228 and better - you may have to compile this from github!
Download
V 0.1 as .tar.gz
V 0.11 as .tar.gz
V 0.12 as .tar.gz
V 0.13 as .tar.gz

Latest git as .zip
Latest git as .tar.gz

Dependencies: none


Cheers,
Jeija

License: WTFPL
Last edited by Jeija on Sun Jan 27, 2013 19:02, edited 1 time in total.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 01, 2012 15:48

+2!! I like it
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Sun Jan 01, 2012 17:45

SEE?! i told you it was possible jeija! :D +9001
If you can think it, you can make it.
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Sun Jan 01, 2012 18:01

I ever so slightly altered the textures they might look a bit better
https://www.sugarsync.com/pf/D6068353_8269537_298551
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Sun Jan 01, 2012 18:23

Jeija, you can get strings from RTMMP's version of ROPE mod. RTMMP's ROPE mod depends on RTMMP's FLOWERS mod.
My game: RTMG
GENTOO USER
 

cosarara97
Member
 
Posts: 180
Joined: Tue Nov 01, 2011 18:53

by cosarara97 » Sun Jan 01, 2012 18:31

Good! +5
I've just killed a rat with it xD but it disappeared, so I can't eat it...
Idea: You don't shoot until you release the mouse button, and the velocity depends on how much time have you been pressing it (with a maximum)
:D
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Sun Jan 01, 2012 18:34

Bad realization.
My game: RTMG
GENTOO USER
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 01, 2012 18:49

Hackeridze wrote:Bad realization.

It's 75% the best possible realization
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Sun Jan 01, 2012 20:11

sfan5 wrote:
Hackeridze wrote:Bad realization.

It's 75% the best possible realization

Are you idiot?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local objs = minetest.env:get_objects_inside_radius({x=playerpos.x,y=playerpos.y,z=playerpos.z}, 2)


He look to objects, but if 2 players shooting? Okay, we need a patch:
minetest.env:add_entity() should return objref to added entity. Just simple patch.
My game: RTMG
GENTOO USER
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 01, 2012 20:16

Hackeridze wrote:
sfan5 wrote:
Hackeridze wrote:Bad realization.

It's 75% the best possible realization

Are you idiot?

No
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Sun Jan 01, 2012 20:21

minetest.env:add_entity() should return objref to added entity. Just simple patch.


I agree with that, would need it in animals mod too

But i don't agree with those insultings, don't we all want to improove minetest? It would be strange if we all had the same opinion how to do that.
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Sun Jan 01, 2012 20:22

sfan5 wrote:
Hackeridze wrote:
sfan5 wrote:It's 75% the best possible realization

Are you idiot?

No

So you just mistaken in suggestion about code-quality?
My game: RTMG
GENTOO USER
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Sun Jan 01, 2012 20:27

Code quality is important, but It doesn't justify calling anybody an idiot.

As well as I assume we do have different opinions on what is code quality too ;-)
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Sun Jan 01, 2012 20:34

Who I call an idiot?
My game: RTMG
GENTOO USER
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Sun Jan 01, 2012 20:42

Are you idiot?


I appologize if I did translate it wrong but in my country asking this question is almost exactly the same as calling.
DON'T mention coding style!
(c) sapier all rights reserved
 

Tsumiman
New member
 
Posts: 5
Joined: Fri Dec 30, 2011 12:54

by Tsumiman » Sun Jan 01, 2012 20:43

So you just mistaken in suggestion about code-quality?

And how does code-quality associated with calling sombody an idiot? And, it's really looks like good realisation, without modification of actual C++ code.

Who I call an idiot?


Are you idiot?


Вот из-за таких мудрецов как ты, русских и считают упоротыми бананами 95% иностранцев.

Sorry for my bad English and Russian, lol.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Sun Jan 01, 2012 20:44

If you don't like the mod, Hackeridze, just ignore it!
It was, as sfan said, the 75% best possible solution without changing the minetest c++ source.
I don't want to have any dependencies for my mods, that's why I didn't use any other mods or create a custom minetest version...
RTMMMP's things can be added when creating a mod-pack.
Okay, we need a patch:
minetest.env:add_entity() should return objref to added entity.

I agree
And as I already said, there should also be a way to get the name of an object when you have the objref.
@sdzen: Gonna implement your textures. Thx!!
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Sun Jan 01, 2012 20:56

sapier wrote:
Are you idiot?


I appologize if I did translate it wrong but in my country asking this question is almost exactly the same as calling.

People in your country are wrong.

sapier wrote:If you don't like the mod, Hackeridze, just ignore it!

Im just find bad code and say it for you, so now you know how to fix your mistakes.

sapier wrote:It was, as sfan said, the 75% best possible solution without changing the minetest c++ source.

He said:
sfan5 wrote:It's 75% the best possible realization


sapier wrote:RTMMMP's things can be added when creating a mod-pack.

It will added then minetest.env:add_entity() will return objref of added entity.

Tsumiman, тебя никто не спрашивал. Я же не говорю, кем считаю их?

Tsumiman wrote:And how does code-quality associated with calling sombody an idiot?

Because we can forgive idiot's mistakes.
My game: RTMG
GENTOO USER
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Sun Jan 01, 2012 21:03

Because we can forgive idiot's mistakes.


<ironic> Yes, I think we can do that</ironic>
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Sun Jan 01, 2012 21:04

sapier wrote:
Because we can forgive idiot's mistakes.


<ironic> Yes, I think we can do that</ironic>

/facepalm
My game: RTMG
GENTOO USER
 

Tsumiman
New member
 
Posts: 5
Joined: Fri Dec 30, 2011 12:54

by Tsumiman » Sun Jan 01, 2012 21:05

It's 75% the best possible realization

"possible realization" means realization without changing C++ code, that's quite obviously. If minetest.env:add_entity() behavior would be changed, then there will be better realization.

Also, I should admit, that asking if somebody is an idiot only shows that you are a moron, who don't know how to lead a discussion. In any language and country.
Last edited by Tsumiman on Sun Jan 01, 2012 21:16, edited 1 time in total.
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Sun Jan 01, 2012 21:06

But this discussion is a little bit off-topic, without changes to minetest a really good solution is impossible so we should ask celeron to add at least the return value to add_entity
DON'T mention coding style!
(c) sapier all rights reserved
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sun Jan 01, 2012 21:07

sapier wrote:As well as I assume we do have different opinions on what is code quality too ;-)

Right
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Sun Jan 01, 2012 21:28

But this discussion is a little bit off-topic

Right, let's do something productive:
I added sdzen's textures and changed the code a little... but no new features.
The Download link is in the first post in this topic above.
Redstone for minetest: Mesecons (mesecons.net)
 

Tsumiman
New member
 
Posts: 5
Joined: Fri Dec 30, 2011 12:54

by Tsumiman » Sun Jan 01, 2012 21:51

Line 81, obj:getpos().y==self.object:getpos().y is checked two times. Seems quite strange. Maybe is should be z-coordinate check in third line?
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Sun Jan 01, 2012 21:55

You're right Tsumiman! Thanks for reporting. Anyway, these lines of code are just to make sure that the arrow doesn't remove itself. This bug shouldn't matter.
Redstone for minetest: Mesecons (mesecons.net)
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Mon Jan 02, 2012 00:57

I am going to say this once, celeron and kahrl are doing the C++ and not you. However, this is not the point. Don't fight over code. This mod works, leave it there and, wait for 0.4 to go release. Then the LUA will be done.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Mon Jan 02, 2012 01:00

I like this mod, however the bow item texture should probably be flipped around (it looks weird in hand).
 

User avatar
MrThebuilder3
Member
 
Posts: 104
Joined: Sat Nov 19, 2011 18:26

by MrThebuilder3 » Mon Jan 02, 2012 02:12

awesome! +9000
 

User avatar
xyz
Member
 
Posts: 449
Joined: Thu Nov 10, 2011 14:25

by xyz » Mon Jan 02, 2012 05:26

Hackeridze, успокойся, пожалуйста.
Just something to stop everybody arguing:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
     // EnvRef:add_entity(pos, entityname)
     // pos = {x=num, y=num, z=num}
     static int l_add_entity(lua_State *L)
     {   
         //infostream<<"EnvRef::l_add_entity()"<<std::endl;
         EnvRef *o = checkobject(L, 1);
         ServerEnvironment *env = o->m_env;
         if(env == NULL) return 0;
         // pos
         v3f pos = readFloatPos(L, 2);
         // content
         const char *name = luaL_checkstring(L, 3);
         // Do it
         ServerActiveObject *obj = new LuaEntitySAO(env, pos, name, "");
         env->addActiveObject(obj);
         // Return created entity
         objectref_get_or_create(L, obj);
         return 1;
     }

Replace your l_add_entity in scriptapi.cpp with this and it will return objectref (not entity, but its .object property). I already use it in my seasons mod (latest version that is not published now) and catapults mod. Of course, this should be somehow improved to return entity rather that object.
 

Next

Return to Old Mods

Who is online

Users browsing this forum: Google [Bot] and 7 guests

cron