| Time |
Nick |
Message |
| 00:00 |
shamoanjac |
yeah |
| 00:00 |
shamoanjac |
yet it looks dirty |
| 00:00 |
shamoanjac |
I'm almost done with factions btw |
| 00:00 |
shamoanjac |
I see there is a chat handler |
| 00:01 |
shamoanjac |
I think I'll remove it for now as it's too entangled with lots of data from the ancient model |
| 00:03 |
shamoanjac |
alright, done |
| 00:03 |
shamoanjac |
stripped chatcommands down to 320 lines |
| 00:03 |
thePalindrome |
Dang son |
| 00:06 |
|
TGminer joined #minetest |
| 00:11 |
agrecascino |
shamoanjac, push the latest factionsmod.lua to the repo and ill rewrite chatcommands.lua |
| 00:12 |
shamoanjac |
both are rewritten |
| 00:12 |
shamoanjac |
but I'm pushing |
| 00:14 |
agrecascino |
so should we make a reparser? |
| 00:14 |
shamoanjac |
there should be a "command" class or something |
| 00:14 |
shamoanjac |
that auto-checks whether the player, faction exist |
| 00:15 |
shamoanjac |
and whether privileges are done |
| 00:15 |
shamoanjac |
so that you only specify the action on success |
| 00:15 |
shamoanjac |
like |
| 00:15 |
agrecascino |
just make a SanityCheck(player,faction) |
| 00:15 |
agrecascino |
and have that return true or false |
| 00:15 |
shamoanjac |
not enough, muh privileges |
| 00:15 |
shamoanjac |
I was thinking of |
| 00:16 |
shamoanjac |
factionsmod.register_command("command", { |
| 00:16 |
shamoanjac |
privileges = {list}, |
| 00:16 |
agrecascino |
ur dumb |
| 00:16 |
shamoanjac |
format = {"faction_name", "any", "player_name"}, |
| 00:17 |
shamoanjac |
action = function(parameters, player) |
| 00:17 |
shamoanjac |
}) |
| 00:17 |
shamoanjac |
it would auto check the correct formatting of the command, check the required privileges, and then execute action |
| 00:18 |
agrecascino |
shamoanjac, err\ |
| 00:18 |
agrecascino |
no offence, but this is a lot |
| 00:18 |
agrecascino |
also |
| 00:18 |
agrecascino |
can someone donate me one of these https://upload.wikimedia.org/wikipedia/commons/d/da/HP-HP9000-C8000-Workstation_33.jpg |
| 00:20 |
shamoanjac |
https://github.com/agrecascino/factions/pull/2 |
| 00:20 |
shamoanjac |
it's not a lot m8 |
| 00:20 |
shamoanjac |
I can do it in an hour tomorrow |
| 00:20 |
shamoanjac |
right now we gotta check that the mod works |
| 00:20 |
shamoanjac |
or even better, I'll go to sleep |
| 00:21 |
shamoanjac |
g'night |
| 00:26 |
|
Hirato joined #minetest |
| 00:30 |
Hijiri |
haskell is great though |
| 00:31 |
Hijiri |
too bad shamoanjac isn't here for more language arguments |
| 00:37 |
|
STHGOM joined #minetest |
| 00:37 |
|
STHGOM joined #minetest |
| 00:42 |
|
betterthanyou710 joined #minetest |
| 00:43 |
|
betterthanyou710 joined #minetest |
| 00:43 |
betterthanyou710 |
testing |
| 00:43 |
betterthanyou710 |
OldCoder can you read this? |
| 00:43 |
OldCoder |
betterthanyou710, yes |
| 00:44 |
betterthanyou710 |
good |
| 01:26 |
|
GunshipPenguin joined #minetest |
| 01:29 |
|
swift110 joined #minetest |
| 01:30 |
|
swift110 joined #minetest |
| 01:43 |
|
frostsnow joined #minetest |
| 01:48 |
|
Miner_48er joined #minetest |
| 01:51 |
|
Yst joined #minetest |
| 02:07 |
|
Void7 joined #minetest |
| 02:07 |
|
linushsao joined #minetest |
| 02:09 |
|
Tmanyo joined #minetest |
| 02:42 |
|
DonBatman joined #minetest |
| 02:55 |
|
DI3HARD139 joined #minetest |
| 04:53 |
|
lumidify joined #minetest |
| 05:48 |
|
Nosrick joined #minetest |
| 05:50 |
|
DMackey- joined #minetest |
| 06:12 |
Nosrick |
Anyone about? |
| 06:14 |
|
DMackey joined #minetest |
| 06:30 |
Nosrick |
Just for documentation's sake; I think I'm going to have to use register_on_hpchange to directly influence damage, as the engine currently handles ALL damage calculations, and they can't be touched directly except through on_hpchange. |
| 06:32 |
|
sonicpp joined #minetest |
| 06:33 |
|
LazyJ joined #minetest |
| 06:40 |
Nosrick |
Aaaaand that only works for players |
| 06:40 |
Nosrick |
I don't think I can do this. |
| 06:42 |
|
Krock joined #minetest |
| 06:45 |
|
lumidify joined #minetest |
| 06:50 |
Hijiri |
Nosrick: are you looking for more than just attack damage? |
| 06:50 |
Nosrick |
Yes. |
| 06:51 |
Hijiri |
ok |
| 06:51 |
Nosrick |
I need to know a few things about the attacker, as well. |
| 06:51 |
Hijiri |
what damage sources other than attacks? |
| 06:51 |
Nosrick |
If I could combine the on_hpchange and on_punch, that'd be great. |
| 06:51 |
Nosrick |
It's not so much damage sources, as it is active effects. |
| 06:51 |
Hijiri |
what things that set hp |
| 06:52 |
Nosrick |
Need to know if the attacker has a certain effect going, so I can boost the damage received. |
| 06:52 |
Hijiri |
If those effects are implemented by you, you can handle that in your effect-handling code |
| 06:53 |
Hijiri |
maybe you can make it nicer by having some API that tracks the boosts for you |
| 06:53 |
Nosrick |
I'm using the playereffects API. |
| 06:53 |
Hijiri |
with repeating effects? |
| 06:53 |
Nosrick |
I'm not using them, but yeah, that's the one. |
| 06:54 |
Hijiri |
ok |
| 06:54 |
Hijiri |
Oh, the effects aren't applying damage |
| 06:54 |
Hijiri |
they are boosting it? |
| 06:54 |
Nosrick |
Correct. |
| 06:54 |
Nosrick |
Although... |
| 06:54 |
Hijiri |
the entities have to support your damage mechanism |
| 06:55 |
Hijiri |
I don't think there is a way around it |
| 06:55 |
Hijiri |
you can make a generic function that can be placed in an entity's on_punch callback, and reuse that |
| 06:55 |
Nosrick |
I could apply a 0 second effect that decrements the entity's HP on application |
| 06:56 |
Hijiri |
if you are replacing an existing entity you can call the on_punch with a modified damage, but I'm not sure that will work nicely with things like mobs redo with special handling of punches |
| 06:56 |
Nosrick |
(It's unresistable damage) |
| 06:56 |
Hijiri |
Nosrick: playereffects can't apply effects to entities |
| 06:56 |
Hijiri |
At least, as far as I know, but I'm pretty sure you can't |
| 06:57 |
Nosrick |
Funny, I'm sure I got my spells working on summoned (through the mobs API) entities. |
| 06:57 |
Hijiri |
are you replacing their on_punch? |
| 06:57 |
Nosrick |
Not yet. |
| 06:57 |
Nosrick |
But even if I did, I have no access to the damage caused. |
| 06:57 |
Hijiri |
I wouldn't expect it to not work, unless you were doing something like that |
| 06:58 |
Hijiri |
Nosrick: entity on_punch overrides normal punch damage |
| 06:58 |
Hijiri |
You can calculate the damage on your own from there |
| 06:58 |
Nosrick |
Oh, I see! |
| 07:00 |
Hijiri |
the problem with mobs from existing mob frameworks is that they do special things in their punch handling, like giving drops and calling death callbacks |
| 07:00 |
Hijiri |
so you need to make sure those get run also |
| 07:00 |
Hijiri |
(If you overwrite their on_punch) |
| 07:01 |
Hijiri |
at some point mobs redo mobs didn't support non-player punchers, but I don't know if that's still the case |
| 07:01 |
Nosrick |
How's this? http://pastebin.com/Xn0JUBZy |
| 07:02 |
Hijiri |
that should be momtest.on_punch(self, ...) or momtest:on_punch(puncher, ...) if you want that to be easily usable as a value |
| 07:03 |
Hijiri |
Nosrick: are your punch callbacks intended for calculating damage? |
| 07:03 |
Nosrick |
Yep. |
| 07:03 |
Hijiri |
the original purpose of punch callbacks is so special things can happen when punches happen, but not most damage calculations |
| 07:03 |
Nosrick |
Well, I will be doing extra things. |
| 07:03 |
Hijiri |
I was expecting you would calculate the damage there and just call the callbacks with the calculated damage |
| 07:04 |
Nosrick |
Which callbacks do I need to call? on_punch and...? |
| 07:04 |
Hijiri |
I mean the ones in your global table |
| 07:05 |
Hijiri |
my idea was that you write a "replacement on_punch" that you can put in an entity definition |
| 07:05 |
Hijiri |
in that case this would be the on_punch |
| 07:06 |
Hijiri |
this code seems weird to me because I would expect a fairly uniform treatment of punching, just augmented with whatever features you wanted (damage boosts) |
| 07:06 |
Krock |
Hijiri, have you been dicussing for 9 hours or did you take a break in between? Just wonder |
| 07:07 |
Hijiri |
Krock: break |
| 07:07 |
Krock |
oh, then it's fine |
| 07:08 |
Hijiri |
So I would have expected something similar to the way global callbacks are used from register_on_punchplayer from the base API, just using the specially-calculated damage instead |
| 07:08 |
Nosrick |
Oh, okay. |
| 07:09 |
Hijiri |
I'm actually not sure how I would do this |
| 07:09 |
Hijiri |
But I think replacing an entity's on_punch at least is necessary, because that is the only thing that can change what happens when a player hits an entity |
| 07:10 |
Nosrick |
Yeah, I think that's what I'm going to do. |
| 07:10 |
Hijiri |
punches don't come with a fixed damage, they come with tool capabilities that describe the way they damage |
| 07:10 |
Nosrick |
Yeah, I'm just writing out the damage calculation for it now. |
| 07:10 |
Hijiri |
so what you could do is call something behaving like the original obj:punch(), except with boosted tool capabilities |
| 07:11 |
Hijiri |
then you don't even need to do damage calculations, just modify the damage output described in the capabilities |
| 07:11 |
Hijiri |
that would require you to scan through the tool capabilities and find all the damage fields |
| 07:12 |
Nosrick |
Yup, doing so at the moment. |
| 07:12 |
Hijiri |
Ok, I think that is a good way to go |
| 07:13 |
Hijiri |
I guess this is sort of like a function decorator |
| 07:13 |
Hijiri |
or just a function on functions |
| 07:13 |
Hijiri |
endofunction on functions |
| 07:21 |
Nosrick |
for key, value in toolCapabilities do |
| 07:21 |
Nosrick |
damage = damage + (toolCapabilities.damage_groups[value] * min(0.0, max(1.0, (lastPunch / toolCapabilities.full_punch_interval))) * (self.armor_groups[value] / 100)) |
| 07:21 |
Nosrick |
end |
| 07:21 |
Nosrick |
Well, that didn't work too well. |
| 07:22 |
Nosrick |
But there's my damage calculation. |
| 07:25 |
|
CWz joined #minetest |
| 07:27 |
Nosrick |
Any idea how to get the playereffects of another player? |
| 07:28 |
Nosrick |
Nevermind, I just RTFM |
| 07:35 |
|
ssieb joined #minetest |
| 07:37 |
Hijiri |
Nosrick: I mean don't try to calculate your own damage |
| 07:37 |
Hijiri |
oh |
| 07:37 |
Hijiri |
wait |
| 07:37 |
Hijiri |
I did implicitly say that |
| 07:37 |
Hijiri |
if you are emulating punch |
| 07:37 |
Hijiri |
sorry |
| 07:38 |
Hijiri |
Nosrick: instead of checking if a player has a certain effect, you can have your effect set a flag somewhere for the player |
| 07:38 |
Hijiri |
That allows you to have multiple effects that set the same flag |
| 07:39 |
Hijiri |
(Even better, use a monoid instead of a flag and you can have both effects active at the same time :P) |
| 07:43 |
Hijiri |
Then in your damage calculations you can read the flag |
| 07:43 |
Hijiri |
if this is for damage boosts, I would advise using monoids, or something similar, so that you don't have to check for individual effects |
| 07:44 |
Hijiri |
It doesn't have to be monoids, but it should be something that lets you: Read the total damage boost of a given player, and contribute to the damage boost from multiple sources |
| 07:44 |
Hijiri |
checking for particular effects doesn't scale |
| 07:45 |
Hijiri |
maybe you aren't doing that, but that's what it sounded like |
| 07:46 |
|
Volkj joined #minetest |
| 07:49 |
Hijiri |
I have to sleep, so I won't be able to respond for a while |
| 07:49 |
Hijiri |
I'll stay connected unless I lose connection, though |
| 07:53 |
|
Hirato joined #minetest |
| 07:54 |
|
its100best joined #minetest |
| 08:01 |
|
Szkodnix joined #minetest |
| 08:03 |
|
Yst joined #minetest |
| 08:13 |
Nosrick |
Thanks, Hijiri. Sorry I didn't reply, wife needed the laptop. |
| 08:29 |
|
Jousway joined #minetest |
| 09:05 |
|
jin_xi joined #minetest |
| 09:07 |
|
lumidify joined #minetest |
| 09:10 |
|
Weedy joined #minetest |
| 09:17 |
|
jan6 joined #minetest |
| 09:19 |
jan6 |
what are the minimal dependecies for building a minetest client from source? |
| 09:20 |
aix |
hi all |
| 09:20 |
Krock |
irrlicht and zlib |
| 09:20 |
sfan5 |
and sqlite3 |
| 09:20 |
Krock |
oh right, we don't have that bundled anymore |
| 09:25 |
|
SylvieLorxu joined #minetest |
| 09:27 |
|
shamoanjac joined #minetest |
| 09:30 |
aix |
are there any remote bag mods? |
| 09:30 |
aix |
y'know, like a wifi chest but in the inventory |
| 09:31 |
|
davisonio joined #minetest |
| 09:52 |
Nosrick |
You weren't kidding when you said the damage stuff in minetest is totally fucked |
| 09:58 |
Nosrick |
My on_punch function in my custom entity isn't calling at all. |
| 10:01 |
Krock |
Nosrick, punch a dropped item and you see that it works prefectly |
| 10:02 |
|
davisonio joined #minetest |
| 10:02 |
|
Gael-de-Sailly joined #minetest |
| 10:03 |
Nosrick |
But my custom on_punch isn't in a dropped item |
| 10:03 |
Nosrick |
It's in a mob. |
| 10:06 |
Nosrick |
Ah, I see why. |
| 10:07 |
Nosrick |
The mob API I'm using doesn't have an on_punch callback. |
| 10:08 |
Krock |
So don't blame Minetest for it :P |
| 10:12 |
|
Markow joined #minetest |
| 10:17 |
|
dlaboratory joined #minetest |
| 10:33 |
Nosrick |
Damn it, I can't get my custom entities to hook into on_punch. |
| 10:40 |
Nosrick |
I think I'm going to have to write my own damn mob API. |
| 10:41 |
|
Tux[Qyou] joined #minetest |
| 10:51 |
|
lumidify joined #minetest |
| 10:55 |
|
ElectronLibre joined #minetest |
| 10:58 |
|
dlaboratory joined #minetest |
| 11:06 |
|
davisonio joined #minetest |
| 11:09 |
|
T4im joined #minetest |
| 11:12 |
|
texmex joined #minetest |
| 11:13 |
|
Fixer joined #minetest |
| 11:23 |
|
betterthanyou710 joined #minetest |
| 11:24 |
Nosrick |
Is it possible to change an entity's on_punch function after initialisation? |
| 11:24 |
T4im |
should be possible, yea |
| 11:26 |
|
DMackey- joined #minetest |
| 11:27 |
Nosrick |
So I use minetest.add_entity() to spawn the entity, which returns an entity, but when I try to reassign its on_punch function, it crashes and tells me I'm trying to index into a userdata value. How do I get around this? |
| 11:29 |
T4im |
it returns an ObjectRef |
| 11:30 |
T4im |
not an entity |
| 11:30 |
Nosrick |
Ah. |
| 11:30 |
T4im |
for whatever reason entities don't inherit from objects |
| 11:30 |
T4im |
meaning you are looking for on_punch in a c structure, that doesn't have it |
| 11:30 |
Nosrick |
Why on earth does add_entity() return an ObjectRef?! |
| 11:31 |
Krock |
why shouldn't it? |
| 11:31 |
T4im |
you'll probably want object.get_luaentity() |
| 11:32 |
Nosrick |
Oh, so I need to get_luaentity(), then reassign its on_punch? |
| 11:33 |
Nosrick |
Where is get_luaentity() located? |
| 11:37 |
|
Laster joined #minetest |
| 11:37 |
T4im |
object:get_luaentity() * |
| 11:37 |
T4im |
in LuaEntitySAo |
| 11:37 |
T4im |
SAO* |
| 11:43 |
Nosrick |
Thanks! |
| 11:43 |
Nosrick |
I can't believe I missed that. |
| 11:46 |
Nosrick |
Different problem: it looks like add_entity() returns a copy? |
| 11:47 |
Nosrick |
As making changes to it seem to be discarded. |
| 11:48 |
Nosrick |
Will I have to look up the minetest.luaentities and replace it there? |
| 11:49 |
|
Megaf joined #minetest |
| 11:50 |
Megaf |
G'Day folks |
| 11:50 |
Nosrick |
Hello! |
| 11:51 |
|
ElectronLibre joined #minetest |
| 12:10 |
Laster |
Hello everyone!@ |
| 12:10 |
Markow |
hey |
| 12:11 |
Laster |
I try to install a mod to extend my minetest 0.4.14 |
| 12:11 |
Laster |
on ubuntu 14.04 |
| 12:12 |
Laster |
where does look Minetest for mods? |
| 12:12 |
Laster |
I mean in which map? |
| 12:13 |
Laster |
more as that is not written on http://wiki.minetest.net/Installing_Mods |
| 12:14 |
T4im |
each world you create will have a world.mt file in its directory (under .minetest/worlds) in which it saves which mods are loaded for that world |
| 12:15 |
T4im |
hm no, that stands on that page, too |
| 12:15 |
T4im |
not sure what you are missing? :D |
| 12:15 |
Calinou |
Laster: ~/.minetest/mods |
| 12:15 |
Calinou |
install your mods there |
| 12:15 |
Calinou |
(you can also "git clone" them directly, for easy updating) |
| 12:16 |
Laster |
on that page stands that it depends on the version you have |
| 12:16 |
Laster |
*too |
| 12:16 |
Calinou |
Laster: if you installed Minetest through compiling without RUN_IN_PLACE or with a package, it's almost certainly in ~/.minetest/mods |
| 12:16 |
Calinou |
you may have to create the folder |
| 12:16 |
Calinou |
(mkdir -p ~/.minetest/mods) |
| 12:17 |
T4im |
if you mean the "As of 0.4.7,", that's still the case, what is explained there |
| 12:19 |
Laster |
Thank you Calinou! |
| 12:19 |
Laster |
I think this wil worl! |
| 12:20 |
Laster |
*work |
| 12:25 |
Nosrick |
What's wrong with this line? I'm getting an "attempt to call table value" error: for key, value in ipairs(momtest.on_punch_callbacks) do |
| 12:26 |
Nosrick |
Actually, I don't think it's that line... |
| 12:26 |
Nosrick |
I think it's where I assign the table's value (supposed to be a function) to a local, and try to call it. |
| 12:27 |
Krock |
yes, must be another line because that looks fine |
| 12:27 |
|
davisonio joined #minetest |
| 12:29 |
T4im |
momtest? O_o |
| 12:30 |
Krock |
dadtest |
| 12:31 |
* T4im |
imagines a game for becoming moms to train caring for children by having an entity that cries all the time and needs feeding... wait.. why do you want to override on_punch again? |
| 12:31 |
* T4im |
hides |
| 12:33 |
* Krock |
looks worried at T4im and tells him that his imagination creates too many strange elements |
| 12:33 |
Nosrick |
Oh, Master of Magic. |
| 12:33 |
Nosrick |
Not uh... moms. |
| 12:34 |
T4im |
ah |
| 12:34 |
Nosrick |
But there's another idea for a mod... |
| 12:34 |
Nosrick |
BABY PUNCHING! |
| 12:34 |
Nosrick |
As a frustrated mother |
| 12:34 |
Nosrick |
Wow, I think I'll stop now. That got really grim really fast. |
| 12:35 |
Krock |
For the case there's a horrible musical performed by strange chicken then you could throw tomatoes and babies at them |
| 12:35 |
Krock |
(if it was a normal musical you'd use tomatoes and eggs) |
| 12:36 |
T4im |
x) thanks for the explanation |
| 12:37 |
|
est31 joined #minetest |
| 12:39 |
|
rubenwardy joined #minetest |
| 12:41 |
|
dlab joined #minetest |
| 12:42 |
|
Amaz joined #minetest |
| 12:45 |
|
SylvieLorxu joined #minetest |
| 13:14 |
|
basxto joined #minetest |
| 13:19 |
Nosrick |
Why is minetest crashing and telling me that get_hp() is a nil value? |
| 13:20 |
rubenwardy |
try gethp? |
| 13:20 |
rubenwardy |
The api is a little inconsistent |
| 13:20 |
thePalindrome |
Also make sure you're operating on a player |
| 13:20 |
rubenwardy |
no, it's get_Hp |
| 13:20 |
thePalindrome |
Has the minetest bug where scripts can crash the game been fixed yet? |
| 13:20 |
rubenwardy |
and it works on lua entities as well |
| 13:21 |
Krock |
thePalindrome, that's not one bug. |
| 13:22 |
Krock |
there are many ways to crash the game, even without using the API functions |
| 13:22 |
shamoanjac |
trying to call a nil value usually results in the brown screen of death |
| 13:23 |
thePalindrome |
iirc the bug that was most annoying was when you had a variable of a different type than you thought |
| 13:23 |
shamoanjac |
I had many of those when I still didn't understand well the difference between foo:bar() and foo.bar() |
| 13:23 |
thePalindrome |
I do remember it involved type mismatches |
| 13:23 |
thePalindrome |
is there even a difference? |
| 13:23 |
shamoanjac |
yeah like when you got a "player" argument to a function |
| 13:23 |
shamoanjac |
so you try to call getpos() |
| 13:23 |
T4im |
foo:bar() == foo.bar(foo) |
| 13:24 |
shamoanjac |
but it turns out it was a player name, not a player ObjectRef |
| 13:24 |
thePalindrome |
Ah, I see |
| 13:24 |
T4im |
foo is then accessable as "self" |
| 13:24 |
thePalindrome |
#1794 is what I was thinking of |
| 13:24 |
T4im |
that is, unless you define it with another name when defining it with "." |
| 13:25 |
T4im |
if you define it with : it defaults to self |
| 13:25 |
|
STHGOM joined #minetest |
| 13:25 |
shamoanjac |
tfw I've rewritten 99% of agrecascino's work |
| 13:25 |
shamoanjac |
I feel somewhat bad |
| 13:26 |
shamoanjac |
not to talk about Sapier's original work which has pretty much disappeared |
| 13:27 |
* thePalindrome |
works on too many things at once |
| 13:28 |
shamoanjac |
9>You can't make a faction server right now as there are no proper mods out there |
| 13:28 |
shamoanjac |
ha ha ha! |
| 13:28 |
shamoanjac |
now with my rewrite it's usable |
| 13:28 |
shamoanjac |
and extendible |
| 13:28 |
shamoanjac |
with groups/permissions settings |
| 13:29 |
rubenwardy |
ctf_pvp_engine could be used to make a faction mod, with some slight modifications ;) |
| 13:29 |
shamoanjac |
rubenwardy, if you want to use what I've written, feel free to take a look at github.com/shamoanjac/factions |
| 13:29 |
rubenwardy |
although I don't recommend it, it's an old project which has some code weirdness |
| 13:30 |
shamoanjac |
or agrecascino's repo which is the original (but right now hasn't accepted my latest PR) |
| 13:31 |
rubenwardy |
Does your factions mod have diplomacy? Or are factions always at war? https://www.dropbox.com/s/5msi3fxyxkpjxpg/CTF_team_gui_diplo.png?dl=1 |
| 13:31 |
shamoanjac |
there are alliances and enemies |
| 13:31 |
shamoanjac |
I haven't implemented the commands to set them though, but the functions are there |
| 13:31 |
shamoanjac |
there are about a hundred TODOs which are merely "add message here" |
| 13:32 |
shamoanjac |
registering a command is super easy, though |
| 13:32 |
|
theTroy joined #minetest |
| 13:33 |
shamoanjac |
http://pastebin.com/RGYk2sU8 |
| 13:33 |
shamoanjac |
uh I've forgot to remove a part of the code |
| 13:34 |
shamoanjac |
namely the 'if cmd == "version" then' part |
| 13:35 |
shamoanjac |
you can also make functions available only to certain privileges and faction permissions, and specify their format, to make sure the on_success() will be always called on a correctly formatted command |
| 13:36 |
rubenwardy |
have you seen chatcmdbuilder? http://rubenwardy.com/minetest_modding_book/chapters/chat_complex.html |
| 13:36 |
rubenwardy |
You can use patterns like cmd:sub("join :username :teamname", function(name, username, teamname) |
| 13:45 |
|
nalkri joined #minetest |
| 13:46 |
Nosrick |
So apparently it isn't get_Hp() |
| 13:46 |
Nosrick |
Or get_hp() |
| 13:47 |
rubenwardy |
http://rubenwardy.com/minetest_modding_book/lua_api.html#get_hp |
| 13:48 |
rubenwardy |
lua_api.txt does say it is |
| 13:48 |
|
Freejack joined #minetest |
| 13:48 |
Nosrick |
Yeah, I'm getting a nil value error on it. |
| 13:49 |
rubenwardy |
please can you share your code? |
| 13:49 |
Nosrick |
target:set_hp(target:get_Hp() - damage) |
| 13:49 |
rubenwardy |
You're probably doing something wrong :P |
| 13:49 |
Nosrick |
set_hp() calls fine, apparently |
| 13:49 |
rubenwardy |
target:set_hp(target:get_hp() - damage) |
| 13:49 |
rubenwardy |
where do you get target from? |
| 13:50 |
|
davisonio joined #minetest |
| 13:51 |
Nosrick |
target comes from an on_punch callback |
| 13:51 |
Nosrick |
So it's the self from there |
| 13:51 |
rubenwardy |
entity or node? |
| 13:51 |
Nosrick |
Entity |
| 13:53 |
rubenwardy |
you want self.object:get_hp() |
| 13:54 |
rubenwardy |
where self is from on_punch = function(self, hitter) |
| 13:55 |
Nosrick |
Should I change it to this, then? target.object:set_hp(target.object:get_hp() - damage) |
| 13:55 |
rubenwardy |
probably |
| 13:56 |
rubenwardy |
the reason get_hp threw an error and not set_hp was because get_hp was run first |
| 13:57 |
rubenwardy |
it goes: 1) get_hp 2) damage 3) minus 4) set_hp |
| 13:57 |
Nosrick |
Ah, I see. |
| 13:57 |
Nosrick |
It works now! |
| 13:57 |
Nosrick |
Sort of. |
| 13:57 |
Nosrick |
My damage calculations are wrong, but it works! |
| 14:01 |
|
betterthanyou710 joined #minetest |
| 14:12 |
|
Player_2 joined #minetest |
| 14:13 |
|
Taoki joined #minetest |
| 14:18 |
|
aheinecke joined #minetest |
| 14:19 |
|
Void7 joined #minetest |
| 14:19 |
shamoanjac |
no rubenwardy, I hadn't seent it |
| 14:22 |
rubenwardy |
you don't need to use that structure |
| 14:22 |
rubenwardy |
you could do local cmd = ChatCmdBuilder("foo", function() end) |
| 14:22 |
|
KaadmY joined #minetest |
| 14:22 |
rubenwardy |
you could do local cmd = ChatCmdBuilder.new("foo", function() end) |
| 14:23 |
rubenwardy |
cmd:sub("bar :name", function(name, param_name) print(name .. " ran /foo bar " .. param_name) end) |
| 14:29 |
|
juhdanad joined #minetest |
| 14:31 |
|
namach[Svet] joined #minetest |
| 14:33 |
shamoanjac |
sounds good |
| 14:33 |
shamoanjac |
however I've already rewritten all the functions and it took me a couple hoursd |
| 14:33 |
shamoanjac |
I'm not sure I want to spend another two hours re-writing the function declarations :P |
| 14:35 |
|
Darcidride joined #minetest |
| 14:36 |
Nosrick |
Why does my mob's on_punch callback go back to default on re-entering a world? |
| 14:38 |
est |
because thats the way its designed |
| 14:38 |
est |
you have to load it from static data |
| 14:39 |
Nosrick |
Ah, crap. That's handled by the API. |
| 14:42 |
|
Darkside_ joined #minetest |
| 14:45 |
Nosrick |
Odd, there's nothing in the API that forces the on_punch back to its regular state. |
| 14:48 |
|
IhrFussel joined #minetest |
| 14:48 |
IhrFussel |
"Invalid command" message is hard coded right? |
| 14:49 |
Nosrick |
This has been a huge pain in the ass. |
| 14:52 |
shamoanjac |
is there a reason a steel door couldn't be mined with a regular pickaxe? |
| 14:53 |
|
Trustable joined #minetest |
| 14:53 |
|
Void7 joined #minetest |
| 14:56 |
Darkside_ |
i don't know, probly same reason as for mese ore you need a steel pickaxe for that ;0 |
| 14:56 |
shamoanjac |
yeah it was that |
| 14:57 |
|
aheinecke_ joined #minetest |
| 14:57 |
IhrFussel |
I think I can prevent "Invalid command" by changing return false to return true inside chat command handler when cmd_def is not defined |
| 14:57 |
shamoanjac |
any tips for optimized self-compiled Minetest? |
| 15:00 |
thePalindrome |
-O3 if you really want to |
| 15:01 |
|
davisonio joined #minetest |
| 15:05 |
burli |
How can I reduce the default crafting filed to 2x2? |
| 15:06 |
Darkside_ |
edit formspec code, im just a modding noobie ;) |
| 15:07 |
thePalindrome |
Yeah, you'd have to overwrite the default crafting screen |
| 15:07 |
thePalindrome |
Which would make it incompatible with unified inventory et al |
| 15:07 |
Darkside_ |
and craft recipes as wel |
| 15:07 |
|
Krock joined #minetest |
| 15:08 |
burli |
any example how to do? |
| 15:08 |
|
Weedy joined #minetest |
| 15:08 |
est |
http://rubenwardy.com/minetest_modding_book/lua_api.html#minecraft-like-player-inventory |
| 15:09 |
burli |
I'll try, thx |
| 15:10 |
|
Megaf joined #minetest |
| 15:10 |
shamoanjac |
thePalindrome, I should put -O3 in the calls to GCC, right? |
| 15:10 |
burli |
just to make sure: is this compatible with minetest 0.4.14? |
| 15:11 |
shamoanjac |
no way to pass them on cmake or make? |
| 15:11 |
thePalindrome |
You'd have to edit the makefile to do that, and -O3 *should* be comptabile, but sometimes O3 causes issues |
| 15:11 |
shamoanjac |
ok |
| 15:12 |
shamoanjac |
for some reason when I compiled the 0.4.14 it made Minetest unable to run fullscreen at >10FPS |
| 15:12 |
shamoanjac |
when it could handle it at 25FPS before |
| 15:13 |
shamoanjac |
(with more render distance) |
| 15:13 |
thePalindrome |
iirc 0.4.14 added some new shader things, it's possible that some of the shaders were forced to use software rendering |
| 15:14 |
thePalindrome |
O3 isn't going to help with graphical performance :P |
| 15:15 |
shamoanjac |
no but I figured it could help with other parts |
| 15:16 |
shamoanjac |
not sure how I can make the shaders to use hardware rendering instead of software though |
| 15:16 |
shamoanjac |
my graphics card isn't even that bad |
| 15:18 |
shamoanjac |
well, I've just recompiled and now it runs smooth again |
| 15:20 |
thePalindrome |
Huh, weird. What's your driver/opengl support? |
| 15:22 |
shamoanjac |
Nouveau, and I can handle at least OpenGL 3.3 |
| 15:22 |
shamoanjac |
quite sure I can run OpenGL 4 too |
| 15:25 |
|
Yst joined #minetest |
| 15:26 |
thePalindrome |
Hmmm |
| 15:30 |
thePalindrome |
afaik you either have 3.3 support or 4.3 support, depending on the driver. Nouveau can be a bit finicky, because nvidia made it so |
| 15:32 |
|
davisonio joined #minetest |
| 15:36 |
shamoanjac |
is there really no method to get the world spawn position? |
| 15:37 |
thePalindrome |
Kindof |
| 15:38 |
thePalindrome |
iirc It's about 0,0,0 but with random offests |
| 15:38 |
thePalindrome |
It's on a per player basis |
| 15:38 |
shamoanjac |
ah, well |
| 15:38 |
|
Void7 joined #minetest |
| 15:41 |
thePalindrome |
You might be able to, but it'd be a player method |
| 15:41 |
shamoanjac |
i have Ctrl+F "spawn" in lua_api.txt and I found nothing |
| 15:41 |
shamoanjac |
not for players, not worldwide |
| 15:43 |
thePalindrome |
hmm |
| 15:44 |
Darkside_ |
should be somewhere in the mapgen sourcode if you mean trying to find were creation of the world starts i guess 0,0,0 at players pos at first login |
| 15:46 |
Darkside_ |
i don't know, just put it up there let the genius ones reply on it to correct it ;) |
| 15:46 |
burli |
est, looks like this 2x2 crafting patch doesn't work with 0.4.14. Thx anyway |
| 15:47 |
Krock |
there's a mod that changes your inventory grid size |
| 15:47 |
burli |
that would be cool |
| 15:48 |
|
hmmmm joined #minetest |
| 15:50 |
|
jojoa1997 joined #minetest |
| 15:55 |
burli |
Krock, do you have a link or a name? Can't find it |
| 15:56 |
burli |
And I also look for a simple workbench mod without any fancy stuff |
| 15:57 |
Krock |
you're looking for two times the same mod |
| 15:57 |
rubenwardy |
!mod workbench |
| 15:57 |
MinetestBot |
rubenwardy: Workbench - 3x3 4x4 5x5 [workbench] by cornernote - https://forum.minetest.net/viewtopic.php?t=3275 |
| 15:57 |
rubenwardy |
https://forum.minetest.net/viewtopic.php?t=14085 |
| 15:57 |
rubenwardy |
use that last link, burli ^^ |
| 15:58 |
rubenwardy |
oh wait, different thing |
| 15:58 |
T4im |
https://github.com/minetest-mods/workbench ? |
| 15:58 |
burli |
I know the xdecor workbench. But I dont need the cut feature or anything |
| 15:59 |
Krock |
!crafting |
| 15:59 |
Krock |
!mod crafting |
| 15:59 |
MinetestBot |
Krock: Mini Trees (now has seeds and crafting!) [minitrees] by 12Me21 - https://forum.minetest.net/viewtopic.php?t=5387 |
| 15:59 |
Krock |
noo |
| 15:59 |
Krock |
!mod crafting] |
| 15:59 |
MinetestBot |
Krock: Crafting [crafting] by BlockMen - https://forum.minetest.net/viewtopic.php?t=5641 |
| 15:59 |
Krock |
this one changes it to 2x2 |
| 15:59 |
rubenwardy |
your mod search really should prioritise the basename over appearance in the title |
| 15:59 |
T4im |
!mod coffee |
| 15:59 |
MinetestBot |
T4im: Could not find anything. |
| 16:00 |
T4im |
:( |
| 16:00 |
T4im |
still no coffee mod |
| 16:00 |
rubenwardy |
T4im, https://github.com/rubenwardy/coffee |
| 16:00 |
Krock |
rubenwardy, yeah.. |
| 16:00 |
T4im |
oh |
| 16:00 |
T4im |
<3 |
| 16:00 |
rubenwardy |
currently only espressos and lattes |
| 16:00 |
T4im |
with kopi luwak crafted out of nyancat + coffee? :3 |
| 16:01 |
Krock |
DO NOT USE nyancats in crafting recipes! |
| 16:01 |
Krock |
poor cats |
| 16:01 |
T4im |
well maybe not crafted, fed to them then |
| 16:01 |
rubenwardy |
food has nyancat juice |
| 16:01 |
T4im |
kopi luwaki is that coffee where the beans were fermented by cats |
| 16:02 |
T4im |
luwak* |
| 16:02 |
T4im |
very expensive coffee |
| 16:02 |
Krock |
eeks |
| 16:02 |
T4im |
~50€ per cup |
| 16:02 |
rubenwardy |
so: milk in furnace gives steamed milk, coffee bean in espresso machine gives espresso, 2xEspresso + milk + drinking glass = latte |
| 16:02 |
T4im |
> €500 per KG if you buy it in bulk |
| 16:03 |
shamoanjac |
that's the price of an average glass of water in Paris |
| 16:03 |
shamoanjac |
:P |
| 16:03 |
T4im |
heh |
| 16:03 |
rubenwardy |
I really should finish and release that coffee mod |
| 16:03 |
Krock |
where can I buy Dihydrogen-Monoxide? |
| 16:03 |
* T4im |
is waiting for one since a few years |
| 16:03 |
shamoanjac |
does the coffee do something? |
| 16:04 |
burli |
Krock, I know that mod, but doesn't work with 0.4.14 |
| 16:04 |
Void7 |
Krock: you really want to buy the #1 killer of sharks? |
| 16:04 |
burli |
afk |
| 16:04 |
T4im |
it's coffee, drink it, shamoanjac :p |
| 16:04 |
shamoanjac |
Krock, Dihydrogen-Monoxide is toxic |
| 16:04 |
shamoanjac |
look at this page |
| 16:04 |
Krock |
Void7, yes but I want to use it to kill people |
| 16:04 |
shamoanjac |
there's a government conspiracy |
| 16:04 |
Void7 |
Krock: you can probably find it in every paper cup |
| 16:04 |
shamoanjac |
http://www.dhmo.org/facts.html |
| 16:04 |
Calinou |
"Easy conspiracies to shine in society" |
| 16:04 |
Krock |
they already sell it in the subway bread but I don't want to extrct it from there |
| 16:05 |
shamoanjac |
Monsanto keeps patents on the production of DHMO |
| 16:05 |
Void7 |
"* DHMO is a major component of acid rain." |
| 16:05 |
Krock |
Thousands of people die each year - caused by DHMO |
| 16:05 |
Void7 |
"* Often associated with killer cyclones" |
| 16:06 |
Void7 |
"* [DHMO is used] in community swimming pools to maintain chemical balance" |
| 16:06 |
shamoanjac |
Brazilian farmers are found to be at increased risks of suffering several acute diseases due to exposure to DHMO |
| 16:06 |
shamoanjac |
and compounds that contain DHMO |
| 16:06 |
shamoanjac |
is this what you want your coffee to be? |
| 16:06 |
shamoanjac |
a man-killer? |
| 16:07 |
Void7 |
"...that athletes regularly ingest large quantities of DHMO in an effort to gain a competitive edge over an opponent." |
| 16:07 |
shamoanjac |
http://bandhmo.org/ |
| 16:08 |
shamoanjac |
3>Dihydrogen monoxide (DHMO) is colorless, odorless, tasteless, and sickens over 4 billion and kills over 2 million people every year |
| 16:08 |
Void7 |
"the chemical separation of dihydrogenoxide from the hazardous oxygendihydride is extremely difficult." |
| 16:08 |
shamoanjac |
3>Ahmadinejad: A rain of DHMO if Israel attacks nuclear facilities |
| 16:09 |
Krock |
DHMO was also found as a cause for the nuclear power station in fukushima |
| 16:10 |
Void7 |
>3Dihydrogen Monoxide has been found in our rivers, lakes, oceans and streams |
| 16:10 |
Void7 |
but srsly why does this discussion exist |
| 16:10 |
Void7 |
we all know that DHMO is very toxic/deadly |
| 16:10 |
Krock |
but that's no wonder because DHMO is another waste product of nuclear power stations |
| 16:11 |
T4im |
why do you guys copy an age old gag here? people can read the website and the wikipedia article etc without irc :P |
| 16:11 |
Krock |
T4im, what are you talking about. this is serious |
| 16:11 |
T4im |
no need to paste every line though |
| 16:11 |
Krock |
http://www.overclockers.com.au/pic.php?pic=images/newspics/29jul16/32.jpg |
| 16:11 |
shamoanjac |
looks like T4im is part of the globalist Monsanto-Rotschild conspiracy |
| 16:12 |
Krock |
Oh my god the illuminati are back |
| 16:12 |
shamoanjac |
the trails of planes contain DHMO |
| 16:12 |
shamoanjac |
lol |
| 16:12 |
* T4im |
lives off that stuff |
| 16:13 |
Darkside_ |
lol so this is what people do these days? back in the day people went to church on sunday ;D |
| 16:13 |
Krock |
but not at 6 pm |
| 16:13 |
shamoanjac |
vesper mass |
| 16:13 |
T4im |
there are plenty of minetest churches in several worlds |
| 16:13 |
shamoanjac |
well that's at 5pm |
| 16:13 |
T4im |
you can go virutally |
| 16:13 |
T4im |
virtually* |
| 16:14 |
Krock |
meat the virual godot |
| 16:14 |
Krock |
*meet god |
| 16:24 |
rubenwardy |
T4im, https://forum.minetest.net/viewtopic.php?f=9&t=15321 |
| 16:24 |
rubenwardy |
!titke |
| 16:24 |
rubenwardy |
!title |
| 16:24 |
MinetestBot |
rubenwardy: [Mod] Coffee [0.1][coffee] - work in progress / prototype - Minetest Forums |
| 16:28 |
Darkside_ |
im on youtube looking for minecraft griefing Team Avolition the episode in wich Storm_Surge drowns and dies in church before they grief the server :D |
| 16:29 |
T4im |
rubenwardy: maybe support the coffee maker in homedecor via item override? .D |
| 16:29 |
Calinou |
it's cool we don't have griefing teams on Minetest :P |
| 16:30 |
rubenwardy |
T4im, didn't know such a thing existed. Will investigate at some point |
| 16:33 |
Krock |
Calinou, do we have builder teams in Minetest? |
| 16:36 |
Calinou |
not sure :p |
| 16:38 |
Darkside_ |
lol that minecraft suffocating sound should be added to mt ;) |
| 16:39 |
Krock |
I doubt it has a license |
| 16:40 |
Darkside_ |
hmm i can buy a microphone and recreate the sound on my pc lol |
| 16:43 |
Nosrick |
What table do I need to access to get my hands on the registered entities? |
| 16:43 |
Nosrick |
minetest.luaentities? |
| 16:43 |
Nosrick |
No wait, it's minetest.registered_entities. |
| 16:44 |
Krock |
you can find these tables in builtin/game/register.lua for the case your lua_api.txt file is corrupted and you have no internet connection to check it online |
| 16:46 |
|
xSmurf joined #minetest |
| 16:47 |
* Krock |
gives xSmurf a white hat |
| 16:49 |
Nosrick |
Oh, I didn't realise I had the lua source available. Which makes sense, now that I think about it. |
| 16:54 |
Darkside_ |
:) |
| 17:01 |
Nosrick |
Is anyone familiar with the mobs-redo API? |
| 17:08 |
Nosrick |
Also, it looks like my damage calculations are wrong, because the tool capabilities passed in are always empty. |
| 17:23 |
Nosrick |
Any idea why this wouldn't do any operations? |
| 17:23 |
Nosrick |
for key, value in ipairs(toolCapabilities.damage_groups) do |
| 17:23 |
Nosrick |
print("Damage before calculations: " .. value) |
| 17:23 |
Nosrick |
damage = damage + (value * punchTimePercent * (target.armor_groups[key] / 100)) |
| 17:23 |
Nosrick |
end |
| 17:23 |
T4im |
you know about github gists? :P |
| 17:23 |
Nosrick |
I... do not. |
| 17:24 |
T4im |
https://gist.github.com |
| 17:24 |
Nosrick |
Sorry, I'm not a smart man. |
| 17:24 |
T4im |
but i guess damage_groups is not a list, is it? |
| 17:25 |
shamoanjac |
Nosrick, I think you have to use pairs() instead of ipairs() |
| 17:25 |
Nosrick |
What's the difference? |
| 17:25 |
shamoanjac |
for i in ipairs(list) do |
| 17:25 |
shamoanjac |
foo(list[i]) |
| 17:25 |
shamoanjac |
end |
| 17:25 |
shamoanjac |
basically, ipairs gives you a list of indexes |
| 17:26 |
Nosrick |
Ah, I see. |
| 17:26 |
shamoanjac |
https://stackoverflow.com/questions/8955085/should-i-use-ipairs-or-a-for-loop |
| 17:26 |
T4im |
it also gives you the entry as second parameter |
| 17:26 |
Nosrick |
Changing it to pairs causes it to do stuff. It crashes now! |
| 17:26 |
Nosrick |
Which is a start. |
| 17:26 |
Nosrick |
Thanks, guys. |
| 17:28 |
|
whitephoenix joined #minetest |
| 17:30 |
Nosrick |
Why would object.get_armor_groups() fail as a nil value? |
| 17:30 |
T4im |
ipairs will run all entries numerically like 1,2,3,4... until nil in order (so if you have a hole, it won't continue numeric indexes after that) |
| 17:30 |
Nosrick |
Oh, I see. |
| 17:30 |
Nosrick |
But pairs takes all of them? |
| 17:30 |
T4im |
pairs will iterate through key-value pairs, but does not guarantee order |
| 17:30 |
shamoanjac |
object:get_armor_groups() |
| 17:30 |
Nosrick |
(And I'm really sorry for all the questions, I promise my mod will be worth it) |
| 17:31 |
shamoanjac |
try that |
| 17:31 |
Nosrick |
I have; it still fails. |
| 17:31 |
T4im |
pairs will indeed iterate through everything, yea |
| 17:31 |
shamoanjac |
don't worry Nosrick, I've been asking every single line of code in here for the week before my banners mod was released lel |
| 17:32 |
shamoanjac |
(which was before yesterday) |
| 17:32 |
GNU[BDC] |
\0/ |
| 17:32 |
T4im |
hey, any of you guys know sources for good open source 80s synth tracks? tron-style, stranger things etc? |
| 17:33 |
Nosrick |
Can you make music? |
| 17:33 |
* T4im |
cannot |
| 17:33 |
Nosrick |
Because if you can, use LMMS. It's got a great bunch of cheesy 80s style synths. |
| 17:33 |
Nosrick |
Ah, damn. |
| 17:33 |
T4im |
:( |
| 17:33 |
Nosrick |
Learn! |
| 17:33 |
T4im |
heh |
| 17:33 |
Nosrick |
I've been learning a bit of music theory here and there for the past few weeks. |
| 17:34 |
Nosrick |
And I'm tone deaf. |
| 17:34 |
Nosrick |
So if I can do it, so can you. ;) |
| 17:34 |
|
juhdanad joined #minetest |
| 17:35 |
|
Krock joined #minetest |
| 17:35 |
Nosrick |
Krock! |
| 17:35 |
Krock |
Krock! |
| 17:35 |
Calinou |
Krock! |
| 17:36 |
Nosrick |
Let's hope he has sound enabled. |
| 17:36 |
Nosrick |
>shouting his own name |
| 17:36 |
Nosrick |
I didn't even notice lol |
| 17:36 |
Krock |
Sound is, but no message alert sound set |
| 17:36 |
Nosrick |
Probably for that exact reason? :P |
| 17:37 |
Krock |
no, it's easier to delay a discussion when I get no sound alert |
| 17:37 |
Krock |
this is IRC, so it can wait for smoe minutes if I don't want to answer |
| 17:37 |
Krock |
*some |
| 17:38 |
Nosrick |
That's true. |
| 17:40 |
|
agrecascino joined #minetest |
| 17:40 |
agrecascino |
shamoanjac, hey |
| 17:40 |
T4im |
you are not really running your irc client as root, are you? :o |
| 17:41 |
agrecascino |
T4im, hell yeah i am |
| 17:41 |
T4im |
hey, there are open unprotected company VNC's out there running their desktop on root, so i am ready to believe everything :P |
| 17:42 |
agrecascino |
T4im, my vnc server has now auth |
| 17:42 |
agrecascino |
but has lightdm running |
| 17:42 |
shamoanjac |
hey agrecascino |
| 17:42 |
* T4im |
should take a look at vnc roulette again, that was fun, sad, but fun |
| 17:42 |
shamoanjac |
I've reworked the commands system to what I said yesterday |
| 17:42 |
shamoanjac |
I'm fixing bugs rn\ |
| 17:42 |
agrecascino |
? |
| 17:42 |
agrecascino |
oh |
| 17:42 |
Nosrick |
Apparently get_armor_groups() takes an argument of userdata? |
| 17:43 |
shamoanjac |
http://pastebin.com/RGYk2sU8 |
| 17:43 |
shamoanjac |
this is what it looks like, except I had forgotten to remove the inner if in that one |
| 17:43 |
Krock |
"This page is no longer available. It has either expired, been removed by its creator, or removed by one of the Pastebin staff." |
| 17:43 |
agrecascino |
shamoanjac, i feel worthless |
| 17:43 |
T4im |
use gists :P |
| 17:43 |
shamoanjac |
ah yeah I set the pastebin to last for an hour |
| 17:44 |
T4im |
you can remove gists too, but at least until you do, they are versioned and syntax highlighted |
| 17:44 |
Nosrick |
Versioned |
| 17:44 |
agrecascino |
use susepaste |
| 17:44 |
Nosrick |
Are you serious? |
| 17:44 |
shamoanjac |
agrecascino, there are a hundred TODOs for you to complete |
| 17:44 |
T4im |
yea, until you delete them |
| 17:44 |
agrecascino |
http://paste.opensuse.org |
| 17:44 |
T4im |
they are like miniature-git repos |
| 17:44 |
shamoanjac |
which are merely error messages |
| 17:44 |
shamoanjac |
but still |
| 17:45 |
Nosrick |
MY DAMAGE CALCULATIONS WORK! |
| 17:45 |
Nosrick |
WOOHOO |
| 17:46 |
Nosrick |
Now to see if Heroism boosts damage. |
| 17:46 |
agrecascino |
Nosrick, what does your framework do? |
| 17:46 |
Nosrick |
Damage boosts and stuff |
| 17:47 |
Nosrick |
Except it doesn't seem to want to work. |
| 17:57 |
|
Telesight joined #minetest |
| 18:04 |
|
lumidify joined #minetest |
| 18:04 |
shamoanjac |
if #self.global_privileges > 0 then |
| 18:05 |
shamoanjac |
what's wrong with this ^ |
| 18:05 |
shamoanjac |
why does it complain about it being nil |
| 18:05 |
shamoanjac |
when it's {} |
| 18:05 |
shamoanjac |
pls don't tell me {} == nil |
| 18:05 |
shamoanjac |
pls don't tell me #{} ~= 0 |
| 18:05 |
shamoanjac |
please Lua don't be like that |
| 18:07 |
shamoanjac |
holy fucking shit |
| 18:07 |
shamoanjac |
why are empty table nil values? |
| 18:07 |
Nosrick |
It is, isn't it? |
| 18:07 |
shamoanjac |
what's the fucking point |
| 18:07 |
|
juhdanad left #minetest |
| 18:08 |
shamoanjac |
it just makes my life harder |
| 18:08 |
shamoanjac |
it forces me to add indentation levels |
| 18:08 |
KaadmY |
because "lua is EASY" |
| 18:08 |
KaadmY |
which is also why there isn't a continue keyword |
| 18:08 |
KaadmY |
because "easy" |
| 18:08 |
shamoanjac |
is {} == nil |
| 18:08 |
Nosrick |
There isn't? |
| 18:08 |
shamoanjac |
for real??? |
| 18:08 |
KaadmY |
likely |
| 18:08 |
KaadmY |
Nosrick: nope |
| 18:09 |
Nosrick |
wat |
| 18:09 |
Nosrick |
WHY LUA |
| 18:09 |
Nosrick |
WHY |
| 18:09 |
KaadmY |
http://lua-users.org/wiki/ContinueProposal |
| 18:09 |
shamoanjac |
the lack of continue is annoying |
| 18:09 |
shamoanjac |
but the design decision of {} == nil |
| 18:09 |
shamoanjac |
that's |
| 18:09 |
shamoanjac |
fucking |
| 18:09 |
shamoanjac |
retarded |
| 18:09 |
|
Taoki joined #minetest |
| 18:09 |
Nosrick |
Not half, eh? |
| 18:10 |
shamoanjac |
now what do I do? add yet another check and yet another indentation level? |
| 18:12 |
Krock |
great. They won't add "continue" instead they add the spaghetti-keyword "goto" |
| 18:13 |
shamoanjac |
local language ruins everything |
| 18:13 |
Nosrick |
Why is table.insert doing nothing? |
| 18:14 |
shamoanjac |
NIL VALUES LOL |
| 18:14 |
shamoanjac |
probably because it doesn't get called |
| 18:14 |
Nosrick |
But I'm calling it without any conditions. |
| 18:14 |
shamoanjac |
uh |
| 18:14 |
shamoanjac |
idk |
| 18:15 |
T4im |
Nosrick: insert like remove only works on the sequential numeric part of the table |
| 18:15 |
T4im |
and like ipairs |
| 18:15 |
Nosrick |
Are you fucking serious |
| 18:15 |
T4im |
i am cobbly serious |
| 18:15 |
Nosrick |
I just want to put a value into a table and find it with pairs later. |
| 18:16 |
T4im |
you can do that, as long as you don't assign it to a key |
| 18:16 |
T4im |
if you assign it to a key, then forget about insert remove and ipair |
| 18:16 |
T4im |
and use the key to access it |
| 18:17 |
T4im |
either or :) |
| 18:17 |
T4im |
if that's not the problem, show the code, maybe its something else |
| 18:17 |
T4im |
i just assumed, since you already had troubles with that :P |
| 18:17 |
Nosrick |
table.insert(momtest.on_punch_callbacks, functionToRegister) |
| 18:17 |
Nosrick |
This is literally it. |
| 18:18 |
|
FirePowi joined #minetest |
| 18:18 |
Nosrick |
When I later iterate over it with pairs, I get nothing! |
| 18:18 |
T4im |
and on_punc_callbacks is a { function()end, function()end, function()end } structure? |
| 18:18 |
Nosrick |
I believe so, yes. |
| 18:18 |
T4im |
or a { name = function()end } one? |
| 18:18 |
Nosrick |
I think it's a function()end one. |
| 18:19 |
T4im |
then insert should work |
| 18:19 |
Nosrick |
But it doesn't. :( |
| 18:19 |
T4im |
as will momtest.on_punch_callbacks[#momtest.on_punch_callbacks + 1] = functionToRegister btw |
| 18:20 |
Nosrick |
I'll try that. |
| 18:20 |
T4im |
the problem is likely somewhere else |
| 18:20 |
T4im |
functionToRegister being nil for example |
| 18:21 |
|
Krock2 joined #minetest |
| 18:22 |
|
SylvieLorxu joined #minetest |
| 18:24 |
Nosrick |
I don't think it can be. The function is a globally defined one. |
| 18:24 |
|
LazyJ joined #minetest |
| 18:25 |
|
Tmanyo joined #minetest |
| 18:27 |
Nosrick |
I also just tried it with an anonymous function, but that didn't work either. |
| 18:27 |
Nosrick |
Apparently it's nil? |
| 18:27 |
Nosrick |
How can that be? |
| 18:29 |
shamoanjac |
isn't there color in Minetest chat? |
| 18:29 |
Krock |
restricted to mods AFAIK |
| 18:30 |
T4im |
enough support to color chatcommand outputs |
| 18:30 |
T4im |
and formspecs |
| 18:31 |
T4im |
no console output yet :( |
| 18:32 |
Nosrick |
Wait, can't you just use print()? |
| 18:32 |
Nosrick |
That's what I've been doing so far. |
| 18:32 |
T4im |
print is just for debug output |
| 18:33 |
T4im |
and i meant no color for console output |
| 18:33 |
Nosrick |
Ah, right. |
| 18:33 |
T4im |
you can do console output with io.write |
| 18:33 |
T4im |
stdout that is |
| 18:33 |
* thePalindrome |
can do color in stdout |
| 18:33 |
thePalindrome |
Bow to the penguin! |
| 18:33 |
T4im |
but not with the existing color functions |
| 18:33 |
Nosrick |
So why would the function I pass into a table be nil? |
| 18:33 |
|
Krock2 joined #minetest |
| 18:34 |
thePalindrome |
Are you executing the function? |
| 18:34 |
thePalindrome |
func is the function object, func() is the return of the function |
| 18:34 |
Nosrick |
No, just trying to register it as an on_punch callback. |
| 18:34 |
T4im |
Nosrick: without seeing the code we can just guess |
| 18:35 |
Nosrick |
https://gist.github.com/Nosrick/7aa9848c8cbef364e3a608dc06c7f667 |
| 18:35 |
KaadmY |
\0332J\033[0;0H\033[31;01mOf course I can use colors, such as \033[34mblue\033[31;01m in stdout text!\033[00m |
| 18:36 |
shamoanjac |
love ur mom |
| 18:36 |
shamoanjac |
you should really change the name lel |
| 18:36 |
T4im |
Nosrick: "." and ":" ;) |
| 18:36 |
|
tonnerkiller joined #minetest |
| 18:37 |
T4im |
if you define a function with ":" the first parameter is always "self" |
| 18:37 |
T4im |
so you assign the function to self and check a nil parameter |
| 18:37 |
T4im |
if you call a function with : then you pass the table to the first parameter |
| 18:38 |
Nosrick |
I'm still pretty new to Lua. Which one do I change? |
| 18:39 |
|
Fixer joined #minetest |
| 18:39 |
T4im |
well, you can do either, but in this case I'd recommend just change line 1 to a dot |
| 18:39 |
T4im |
since you don't need "momtest" as "self" |
| 18:40 |
T4im |
":" becomes very practically once you started with lua metatables :D |
| 18:40 |
shamoanjac |
heh |
| 18:40 |
Nosrick |
Ah, I see! |
| 18:41 |
T4im |
but "function momtest:registerOnPunch(functionToRegister)" is identical "function momtest.registerOnPunch(self, functionToRegister)" |
| 18:41 |
T4im |
to see what the problem is :) |
| 18:43 |
Nosrick |
I think that's it working. |
| 18:44 |
T4im |
hm btw, i recommend adding a .gitignore that ignores the eclipse .project etc files |
| 18:44 |
T4im |
since many entries are specific to your setup |
| 18:44 |
T4im |
like "E:/minetest-0.4.14/mods/minetest_playereffects" |
| 18:46 |
T4im |
here, you can take this one https://raw.githubusercontent.com/minetest-mods/xdecor/master/.gitignore |
| 18:46 |
Nosrick |
Thank you. :) |
| 18:50 |
Nosrick |
Okay, so I'm passing time_from_last_punch into a function, and it says it's a table. |
| 18:52 |
Krock |
cargocasting!!! |
| 18:52 |
Nosrick |
Cargocasting? |
| 18:52 |
Krock |
when you copy code and don't understand what it actually does because it's magical |
| 18:53 |
T4im |
culting* |
| 18:53 |
Krock |
oops |
| 18:53 |
Nosrick |
I didn't copy it, though, that's the strangest thing. |
| 18:53 |
Krock |
typecast and cargocult |
| 18:54 |
shamoanjac |
3if 6infaction3 and not 6player_faction 3then |
| 18:54 |
shamoanjac |
if infaction = true |
| 18:54 |
shamoanjac |
and player_faction = nil |
| 18:54 |
shamoanjac |
why the fuck doesn't this run |
| 18:54 |
Nosrick |
It's taking the time_from_last_punch from the vanilla on_punch function, and passing it into my function. It then becomes a table. |
| 18:54 |
Krock |
* == |
| 18:54 |
|
Void7 joined #minetest |
| 18:54 |
T4im |
Nosrick: it sounds like you :/. switched something again |
| 18:55 |
T4im |
if you **call** something with : then the table in front of it is passed as first argument |
| 18:55 |
shamoanjac |
no Krock it's not that |
| 18:55 |
shamoanjac |
the only actual line is the one I've written with colors |
| 18:55 |
Nosrick |
Oh, bloody buggery, that's exactly it, I think. |
| 18:55 |
T4im |
if you **define** something with : then it sets "self" as first parameter expecting something to call it with ":" to get the table as "self |
| 18:55 |
Nosrick |
Because the parameter BEFORE the last parameter is a TABLE! |
| 18:56 |
T4im |
you can mix : and . but then you have to handle the first parameter explicitly where you used "." |
| 18:56 |
Nosrick |
Haha, that was it! |
| 18:56 |
shamoanjac |
ah right, it's self.infaction |
| 18:56 |
Nosrick |
I swear, I'll get used to this stuff eventually. |
| 18:56 |
T4im |
for the sake of argument, let's assume "" in lua is of type "strings" (not quite correct, but close enough) |
| 18:57 |
T4im |
strings.rep("b", 3) -> bbb |
| 18:57 |
T4im |
or |
| 18:57 |
T4im |
"b":rep(3) -> bbb |
| 18:57 |
Nosrick |
Ah, I see. |
| 18:57 |
Nosrick |
Thank you! |
| 18:57 |
Krock |
shouldn't it be ("b"):rep(3) ? |
| 18:57 |
T4im |
oops |
| 18:57 |
T4im |
yes |
| 18:58 |
T4im |
it's essentially doing this: ("b").rep("b", 3) |
| 18:58 |
T4im |
and because enything you call on ("b") is directed to strings, that works |
| 19:00 |
Hijiri |
shamoanjac: {} is not nil |
| 19:00 |
Hijiri |
you are getting an error because # has higher precedence than . (I think) |
| 19:01 |
shamoanjac |
that makes more sense |
| 19:01 |
shamoanjac |
trying... |
| 19:01 |
Hijiri |
tables are identified with their location, as I mentioned during our argument |
| 19:02 |
Hijiri |
so actually every fresh {} will be unequal from each other |
| 19:02 |
T4im |
yea, new identity |
| 19:02 |
Hijiri |
you can (ab)use it to make short-lived unique identifiers |
| 19:02 |
T4im |
it's mostly (ab)used to reserve memory unintentionally until minetest is closed though |
| 19:03 |
T4im |
;) |
| 19:03 |
Nosrick |
Well, this is irritating. |
| 19:03 |
Nosrick |
Only Players have the is_player() function. |
| 19:03 |
Nosrick |
So I can't get call it on mobs. |
| 19:03 |
Hijiri |
there is is_player on all SAOs |
| 19:03 |
Hijiri |
it would be pointless if they were only on players |
| 19:04 |
Hijiri |
more accurately there is is_player on all ObjRefs |
| 19:04 |
Hijiri |
ObjectRefs |
| 19:05 |
Nosrick |
I tried that, but got a nil value. |
| 19:05 |
T4im |
Nosrick: ":" for calling things on ObjecrRefs |
| 19:05 |
thePalindrome |
is_player() returns nil for objectrefs |
| 19:05 |
T4im |
x) |
| 19:06 |
T4im |
nosrick: use ":" for calling things on objects, and "." for namespaces |
| 19:06 |
Nosrick |
Ah, thank you. |
| 19:06 |
Nosrick |
"Attempt to call 'is_player' (a nil value" |
| 19:06 |
Nosrick |
Why might that be? |
| 19:07 |
Hijiri |
I don't know, paste your code |
| 19:07 |
T4im |
are you calling it on the luaentity instead of the objectref? |
| 19:07 |
Hijiri |
(on a paste site) |
| 19:07 |
T4im |
you might have to do entity.object:is_player() |
| 19:07 |
Nosrick |
That's probably it. |
| 19:07 |
Nosrick |
As it's a self reference. |
| 19:09 |
Hijiri |
the self in entity callbacks is always a luaentity |
| 19:09 |
Nosrick |
Ah, okay. |
| 19:09 |
Nosrick |
Well, doing .object worked, either way. |
| 19:09 |
Nosrick |
Heroism now triggers! |
| 19:10 |
Nosrick |
Bonus damage, ahoy! |
| 19:10 |
T4im |
and if you want to make that proper log msg's look into minetest.log() |
| 19:10 |
T4im |
:) |
| 19:10 |
Nosrick |
Nah, I'm just debugging. |
| 19:13 |
|
Krock2 joined #minetest |
| 19:18 |
agaran |
something like table.empty() would be neat.. |
| 19:18 |
agaran |
i mean to check if table is empty |
| 19:19 |
T4im |
#mytable? |
| 19:19 |
T4im |
and next(mytable) |
| 19:19 |
T4im |
depending what type of table |
| 19:19 |
T4im |
i.e. that already exists :P |
| 19:19 |
agaran |
hmm.. returns 0 when there are no elements.. oh, I did not even know about next() |
| 19:19 |
T4im |
next is for key-balue pairs |
| 19:20 |
T4im |
essentialyl what pairs() uses |
| 19:20 |
agaran |
I mostly use pairs (or ipairs) |
| 19:20 |
rubenwardy |
wouldn't next() work on either? |
| 19:20 |
T4im |
it returns nil when there are no further left or the, well, next element (no guarantee of order) |
| 19:20 |
T4im |
hm |
| 19:20 |
T4im |
yea |
| 19:20 |
rubenwardy |
as arrays are just dictionaries with numeric indice |
| 19:20 |
rubenwardy |
+s |
| 19:20 |
T4im |
but if it's just a list, then # would probably be faster |
| 19:21 |
T4im |
since it's just a lookup of an index variable |
| 19:21 |
T4im |
not quite sure how next() handles it internally |
| 19:21 |
rubenwardy |
true |
| 19:21 |
Hijiri |
if next() is constant time it could be faster asymptotically |
| 19:21 |
Hijiri |
since # takes log time to find the highest index |
| 19:21 |
T4im |
hm? |
| 19:22 |
Hijiri |
I think it uses an exponential search |
| 19:22 |
T4im |
afaik # just looks up an index variable and doesn't search |
| 19:22 |
rubenwardy |
# could be constant time if the size is prestored |
| 19:22 |
T4im |
that variable is also used to assign the next entry for example |
| 19:22 |
Hijiri |
I thought it wasn't prestored |
| 19:22 |
T4im |
i think you could even access it before as "n" |
| 19:22 |
T4im |
i.e mytable.n x) |
| 19:23 |
Hijiri |
before, as in not anymore? |
| 19:23 |
agaran |
now you are speaking about lua magic, right? |
| 19:23 |
T4im |
i think it was deprecated, but let me look when, since 5.1. isn't so new either, everythign is possibel x) |
| 19:23 |
Hijiri |
lua size operator has strange behavior on tables with holes, because of its search algorithm |
| 19:24 |
shamoanjac |
how can Lua complain about a "global variable" being nil if it's clearly complaining about self.<variable> ? |
| 19:24 |
Hijiri |
shamoanjac: I think calls using : will search global variables if indexing the table finds nothing |
| 19:24 |
Hijiri |
maybe, I don't remember |
| 19:24 |
T4im |
ah, here, 5.0 removed the reference |
| 19:24 |
shamoanjac |
uh |
| 19:24 |
shamoanjac |
but my table does exist |
| 19:25 |
T4im |
so the index is accessable only by "#" |
| 19:25 |
Hijiri |
http://www.freelists.org/post/luajit/table-is-not-O1,9 |
| 19:25 |
shamoanjac |
invited_players = {} |
| 19:25 |
shamoanjac |
it's right there |
| 19:25 |
shamoanjac |
reeeeeeeeee |
| 19:25 |
Hijiri |
T4im: it's not an index, # has to compute the length |
| 19:25 |
T4im |
wouldn't that mean they removed the index entirely? |
| 19:25 |
T4im |
why would they do that :o |
| 19:25 |
Hijiri |
maybe it's a different index |
| 19:25 |
Hijiri |
for the total number of keys, rather than "array length" |
| 19:26 |
Hijiri |
I don't know exactly how the table is represented so I don't know whether it would make sense to have that |
| 19:27 |
T4im |
well, since insert, remove, ipairs all stop on a hole anyway, having a field increase or reduce on removal/insertion and # return wouldn't be the craziest idea |
| 19:28 |
T4im |
i don't think that # counts pass holes either, does it? |
| 19:28 |
Hijiri |
# is undefined for arrays with holes |
| 19:29 |
T4im |
past* |
| 19:29 |
Hijiri |
if you use exponential search, the search might find some non-nil value that is after some holes |
| 19:29 |
agaran |
so if array is list of nets, then if one net gets empty I should not remove it but instead assign empty array there, to preserve slot but with empty content? |
| 19:29 |
Hijiri |
It looks like the array portion has a preallocated amount though, so it probably uses ordinary binary search because it already has bounds |
| 19:29 |
Hijiri |
that could still find the wrong length if there are holes though |
| 19:30 |
Hijiri |
agaran: you could keep track of size yourself |
| 19:30 |
Hijiri |
or keep the list dense |
| 19:30 |
T4im |
actually it's defined: "The length of a table t is defined to be any integer index n such that t[n] is not nil and t[n+1] is nil" |
| 19:30 |
Hijiri |
oh |
| 19:30 |
agaran |
Hijiri: it is not problem with size in that case, but that I use ipairs() extensivelly.. so I want to keep them dense |
| 19:30 |
Hijiri |
well it's not fully-defined |
| 19:31 |
Hijiri |
but it's more defined than I implied |
| 19:31 |
T4im |
well there are more details where that stands |
| 19:31 |
Hijiri |
agaran: you could not rely on ipairs as much |
| 19:31 |
agaran |
Hijiri: true, but that need to get some better idea as an replacement |
| 19:32 |
Hijiri |
If it's a map from network IDs to network infos, you could just use pairs |
| 19:32 |
T4im |
no preallocation, Hijiri, but i think it indeed allocates for the array and the hash part individually, but not 100% sure about htat |
| 19:32 |
T4im |
it doubles the allocation each time it runs out |
| 19:32 |
Hijiri |
T4im: this SO answer: https://stackoverflow.com/questions/23590885/why-does-luas-length-operator-return-unexpected-values says it preallocates the next power of 2 |
| 19:32 |
Hijiri |
yes |
| 19:33 |
Hijiri |
agaran: If it is a map from IDs to infos you also don't want to compact the list, because the IDs will change |
| 19:33 |
Hijiri |
I don't know if that is how it is set up though |
| 19:34 |
agaran |
Hijiri: yep.. that too.. need to think how to do it in good way |
| 19:34 |
Hijiri |
you can have a separate map mapping IDs to actual indices in the dense list |
| 19:34 |
Hijiri |
then when you move things around you can change that |
| 19:34 |
T4im |
maybe this is another terminology problem, but wouldn't that be post allocation? I'd expect preallocation to be what you can do on the C side, "give me a table with 10 allocated entries" kind of thing |
| 19:35 |
T4im |
which is not exposed to lua, interestingly, although the functionality exists |
| 19:35 |
agaran |
basically I have list of nets, using index as netnumber that is kept in metadata of nodes that belong to that.. hmm.. two lists, but then searching for certain net-number may be slowish a bit? |
| 19:35 |
Hijiri |
T4im: I don't think preallocation is a technical term, but if we take its meaning as "allocating beforehand", then it is preallocating 2^whatever spaces |
| 19:36 |
Hijiri |
Would it not be preallocation if it was C saying to "give me a table with 2^whatever entries"? |
| 19:36 |
Hijiri |
(in some helper functions) |
| 19:36 |
agaran |
maybe I just try to keep current state, and if problems arise I'll try to work with them, because now I may get stuck in premature optimization.. |
| 19:36 |
T4im |
lua_createtable allows you to allocate more than 1 for an empty table, that's what i meant with preallocation |
| 19:36 |
Hijiri |
agaran: not two lists |
| 19:37 |
Hijiri |
agaran: One list to actually hold the nets, and another table that maps IDs to list indices |
| 19:37 |
Hijiri |
T4im: alright |
| 19:37 |
T4im |
"Creates a new empty table and pushes it onto the stack. The new table has space pre-allocated for narr array elements and nrec non-array elements." |
| 19:37 |
Hijiri |
that description doesn't say that it is the only valid usage of the term "pre-allocation", though |
| 19:37 |
Darkside_ |
almost sounds like partitioning a hardrive |
| 19:37 |
T4im |
well, my point being, on the lua side you can't quite do that :/ |
| 19:38 |
agaran |
Hijiri: hmm, that makes sense but I need to understand how I can code that.. |
| 19:38 |
Hijiri |
T4im: was there a point to that point? |
| 19:38 |
Hijiri |
my original reason for mentioning preallocation was to say that the length search already knows the bounds of the array |
| 19:38 |
Hijiri |
it doesn't matter if lua can do it |
| 19:39 |
Hijiri |
agaran: keep track of the last index (or you can calculate it using #), and when you insert a new element, insert into the list, but also make an entry in the map from the ID to the index |
| 19:39 |
Hijiri |
you will also need to keep track of which indices go to which network IDs |
| 19:39 |
Hijiri |
this can be in the network infos, or you could keep yet another table |
| 19:39 |
Hijiri |
another table would slightly increase memory usage, but would be faster |
| 19:40 |
Hijiri |
but also it would be uglier, though you will probably be abstracting this with functions anyway |
| 19:40 |
agaran |
Hijiri: I'll try, sounds promising and I guess since I have helpers already to add/remove net it is not that bad |
| 19:41 |
Hijiri |
agaran: alright, good luck |
| 19:41 |
agaran |
Hijiri: luck will be needed, some lua skills improvement I guess as well might help |
| 19:42 |
Darkside_ |
this channel helps learning and understanding it a bit :) |
| 19:42 |
Darkside_ |
and there guides too :) |
| 19:42 |
|
Arcelmi joined #minetest |
| 19:54 |
|
ElectronLibre joined #minetest |
| 19:54 |
|
Arcelmi joined #minetest |
| 19:54 |
T4im |
seems like next() also isn't O(1) either |
| 19:55 |
* T4im |
headscratches |
| 19:58 |
|
its100best joined #minetest |
| 20:01 |
Nosrick |
I have a cunning plan |
| 20:02 |
Nosrick |
I can iterate over the registered entity list, and change their on_punch to include my on_punch. |
| 20:02 |
T4im |
quick microbenchmark next vs # https://i.imgur.com/sOWRVlt.png up to tablesize of 1000 |
| 20:02 |
|
Void7 joined #minetest |
| 20:04 |
Hijiri |
I see, I guess I was wrong |
| 20:04 |
Hijiri |
well not technically, since I qualified my statement |
| 20:05 |
T4im |
you were right about "#" x) |
| 20:05 |
T4im |
just next seems to be pretty much doing the same thing |
| 20:05 |
Hijiri |
yeah, and probably has extra overhead from being a function call |
| 20:06 |
|
Darcidride joined #minetest |
| 20:06 |
Hijiri |
though in LuaJIT that might be optimized away (?) |
| 20:07 |
T4im |
possible, next does return more than an index though, it returns the actual entry |
| 20:07 |
T4im |
so there might actually be more work involved |
| 20:07 |
T4im |
but negligible |
| 20:07 |
|
Weedy joined #minetest |
| 20:08 |
Hijiri |
I don't think it would be more work. In the case of # you need to check if something is nil, so you end up grabbing the element anyway |
| 20:08 |
T4im |
ok, true |
| 20:09 |
T4im |
well, about half of that difference is actually from accidentally doing a global lookup on next, but even with it getting from the stack it looks pretty much the same (just a bit closer together) |
| 20:15 |
|
Markow joined #minetest |
| 20:18 |
|
Darcidride joined #minetest |
| 20:20 |
|
Darcidride joined #minetest |
| 20:39 |
|
Miner_48er joined #minetest |
| 20:44 |
|
agrecascino joined #minetest |
| 20:44 |
agrecascino |
hey shamoanjac, is the rewrite finished? |
| 20:50 |
|
theTroy joined #minetest |
| 20:52 |
shamoanjac |
hey agrecascino |
| 20:52 |
shamoanjac |
I'm fixing bugs |
| 20:53 |
shamoanjac |
you know how Lua can be with nil values |
| 20:53 |
|
est31 joined #minetest |
| 20:53 |
agrecascino |
shamoanjac, every language needs static typing |
| 20:53 |
shamoanjac |
yeah but |
| 20:53 |
shamoanjac |
Lua has been especially harsh on me today |
| 20:54 |
agrecascino |
make function for compairing to |
| 20:54 |
agrecascino |
comparing* |
| 20:54 |
agrecascino |
nil |
| 20:57 |
Nosrick |
Anyone here ever played Master of Magic? |
| 20:57 |
Darkside_ |
https://github.com/minetest-mods/lightning nice mod :) merged it with my own mod removed some lines of code for register_node fire:dying_flame to stop crash at startup |
| 20:58 |
Darkside_ |
merged another random_audio mod for extra thunderstorm sound effects, now i got nice thunderstorms with lightning going on :) |
| 20:59 |
Darkside_ |
Sofar did a nice job on that mod :) |
| 21:00 |
Nosrick |
I might use it for lightning bolts in my mod. |
| 21:05 |
Darkside_ |
it looks realy nice at night time as it lights up whole the sky, and you can actually get hit by lightning and be killed if low on hearts wich is a nice feature ;) |
| 21:05 |
|
davisonio joined #minetest |
| 21:06 |
Hijiri |
I thought it was a bit jarring when it occurs during daytime |
| 21:08 |
Darkside_ |
seems to function perfectly fine on mt 0.4.14 win32 emulated in linux :) |
| 21:09 |
thePalindrome |
? |
| 21:09 |
thePalindrome |
Why would you run it through wine? You a masochist or something? |
| 21:09 |
thePalindrome |
You probably use systemd too :P |
| 21:10 |
shamoanjac |
poettering |
| 21:10 |
shamoanjac |
putting the D in systemD |
| 21:11 |
thePalindrome |
Hey, my system doesn't have the d |
| 21:12 |
|
Ipos joined #minetest |
| 21:12 |
Darkside_ |
Microsoft windows is not working for me anymore got so sick of it now playing with Linux :) |
| 21:12 |
thePalindrome |
Minetest has a linux binary, besides, you should use your package manager :P |
| 21:14 |
Darkside_ |
i hated those pop-up balloons in windows most of all, always stating the obvious :/ |
| 21:14 |
thePalindrome |
heh |
| 21:15 |
|
Hinsbart joined #minetest |
| 21:15 |
|
xSmurf joined #minetest |
| 21:15 |
Nosrick |
I'm confused. I'm getting an attempt to call a nil value on a player object, when trying to call get_player_name() |
| 21:15 |
|
agrecascino joined #minetest |
| 21:15 |
Nosrick |
I've tried using . and : |
| 21:16 |
shamoanjac |
maybe player is nil |
| 21:16 |
Nosrick |
I've got a check for that. |
| 21:16 |
Nosrick |
It passes. |
| 21:16 |
shamoanjac |
maybe player is a string |
| 21:16 |
shamoanjac |
not an ObjectRef |
| 21:16 |
|
Ipos joined #minetest |
| 21:16 |
agrecascino |
try player.object? |
| 21:16 |
shamoanjac |
that's like the single most common source of calling nil values in my sources |
| 21:16 |
shamoanjac |
treating player strings as player objects |
| 21:17 |
|
xSmurf joined #minetest |
| 21:17 |
shamoanjac |
or faction strings as faction tables |
| 21:17 |
Nosrick |
Tried player.object, that's nil. |
| 21:17 |
Nosrick |
I think I see what I did wrong. Somewhere down the line, there's a : when there should be a . |
| 21:17 |
Nosrick |
So a self is polluting my parameters. |
| 21:18 |
Nosrick |
Yup, that was it! |
| 21:19 |
|
DMac-Garage joined #minetest |
| 21:22 |
|
Hinsbart joined #minetest |
| 21:25 |
|
DMac-Garage left #minetest |
| 21:37 |
|
Passant joined #minetest |
| 21:40 |
Darkside_ |
minetest.register_node("darkcraft:bloodstone", "darkcraft:witchstone", "darkcraft:goblinstone", { |
| 21:40 |
Darkside_ |
i wonder if node registration can be nested like that, gonna try it soon |
| 21:43 |
Hijiri |
no |
| 21:44 |
Darkside_ |
node description is gonna be difficult to add for each single node that way too, i would not know how heh |
| 21:46 |
shamoanjac |
question |
| 21:46 |
shamoanjac |
if I do |
| 21:46 |
shamoanjac |
factions.chunks[chunkpos] = self.name |
| 21:46 |
shamoanjac |
and the line right after than, I check #(factions.chunks) |
| 21:46 |
shamoanjac |
why is it 0? |
| 21:46 |
shamoanjac |
knowing that self.name isn't nil (checked) |
| 21:49 |
Nosrick |
Because it might have holes in it |
| 21:49 |
Nosrick |
I think |
| 21:49 |
Nosrick |
I'm not sure #table deals well with holes. |
| 21:51 |
shamoanjac |
3>factions.chunks[chunkpos] = self.name |
| 21:51 |
shamoanjac |
oops |
| 21:51 |
shamoanjac |
3>the length of a table t is only defined if the table is a sequence |
| 21:51 |
shamoanjac |
well |
| 21:51 |
shamoanjac |
ok |
| 21:51 |
shamoanjac |
nice, how do I check my bug now |
| 21:52 |
|
edaq joined #minetest |
| 21:53 |
shamoanjac |
values are not being stored in my table |
| 21:53 |
shamoanjac |
just, why |
| 21:54 |
|
nuzzle joined #minetest |
| 21:58 |
Nosrick |
How are you inserting them? |
| 21:58 |
shamoanjac |
factions.chunks[chunkpos] = self.name |
| 21:58 |
shamoanjac |
like that |
| 21:59 |
Nosrick |
And trying to access them in the same way doesn't return anything? |
| 21:59 |
shamoanjac |
yep |
| 21:59 |
shamoanjac |
it returns nil |
| 21:59 |
Nosrick |
Weird. |
| 21:59 |
shamoanjac |
I'm trying to see if the keys really match |
| 22:00 |
shamoanjac |
but so far it seems they are |
| 22:00 |
Nosrick |
Run this on your table: https://gist.github.com/Nosrick/94e6a811a9b225bcebf6540b028e20d7 |
| 22:00 |
shamoanjac |
as an anectod the keys are tables of 2 floats |
| 22:00 |
Nosrick |
>floats |
| 22:00 |
shamoanjac |
coordinates |
| 22:00 |
Nosrick |
There's your problem. |
| 22:00 |
shamoanjac |
it shouldn't |
| 22:00 |
shamoanjac |
someone here said keys could be anything |
| 22:00 |
Nosrick |
If I recall correctly, Lua doesn't actually have a very good float comparison. |
| 22:01 |
shamoanjac |
I guess I'll have to translate to a string every time |
| 22:01 |
Nosrick |
That might be the best way to do it. |
| 22:01 |
Nosrick |
If that doesn't work, it could be down to tiny rounding errors. |
| 22:01 |
Nosrick |
I think Python has the same problem. |
| 22:01 |
Nosrick |
And so does Godot. |
| 22:01 |
sfan5 |
shamoanjac: i have never seen anyone use anything else than integers or strings as table indexes |
| 22:02 |
sfan5 |
i would not rely on e.g. floats to index a table |
| 22:03 |
Hijiri |
shamoanjac: # gets the size of the "array" part of the table, which is the numerical keys part |
| 22:03 |
Hijiri |
and the length may not be too useful if there are holes in the array part |
| 22:04 |
Hijiri |
integer keys |
| 22:04 |
shamoanjac |
yay it works |
| 22:04 |
Nosrick |
Congrats! |
| 22:04 |
shamoanjac |
yeah that's what I read in the 5.2 doc |
| 22:05 |
shamoanjac |
kinda sucks |
| 22:05 |
Nosrick |
So did you use strings in the end? |
| 22:05 |
shamoanjac |
yes |
| 22:05 |
Nosrick |
Excellent. |
| 22:05 |
shamoanjac |
not a big fan of the solution, but heh, if it does the trick... |
| 22:05 |
Hijiri |
also the issue here isn't with floats but with using tables as keys |
| 22:06 |
sfan5 |
tables as keys? |
| 22:06 |
sfan5 |
wat |
| 22:06 |
Hijiri |
table values in lua are references to tables, so to be equal they have to point to the same table |
| 22:06 |
sfan5 |
could have told you from the start that it doesn't work |
| 22:07 |
Hijiri |
If you later construct another table with the same contents it will be a different table and using it as an index will take you somewhere else |
| 22:08 |
shamoanjac |
this language lacks tuples |
| 22:08 |
sfan5 |
you would have exactly the same problem with tuples |
| 22:08 |
agrecascino |
shamoanjac, |
| 22:08 |
sfan5 |
what it lacks is a way to hash objects |
| 22:08 |
shamoanjac |
no, tuples are immutable |
| 22:08 |
sfan5 |
which could then be used to index tables |
| 22:08 |
shamoanjac |
(at least in Python) |
| 22:08 |
sfan5 |
they may be |
| 22:08 |
shamoanjac |
agrecascino, |
| 22:08 |
agrecascino |
the math i did to get chunks previously was math.floor(pos.x/16.0),math.floor(pos.y/16.0) |
| 22:09 |
shamoanjac |
yes, I've got that |
| 22:09 |
sfan5 |
but creating two tuples with the same contents can still yield different objects |
| 22:09 |
shamoanjac |
now I think I've deleted the part where you cannot edit on the claimed chunks lel |
| 22:09 |
sfan5 |
!c id((1, 2, 3)) |
| 22:09 |
MinetestBot |
NameError: name 'id' is not defined |
| 22:09 |
shamoanjac |
yeah but the hash() is the same |
| 22:09 |
sfan5 |
!py id((1, 2, 3)) |
| 22:09 |
MinetestBot |
139660257270088 |
| 22:09 |
sfan5 |
!py id((1, 2, 3)) |
| 22:09 |
MinetestBot |
139660257166248 |
| 22:09 |
agrecascino |
!c print("kill yourself") |
| 22:09 |
MinetestBot |
NameError: name 'print' is not defined |
| 22:09 |
Void7 |
sfan5: hash? |
| 22:09 |
shamoanjac |
so I thought Lua would just hash() the tuples |
| 22:09 |
sfan5 |
^ shamoanjac same tuple different object |
| 22:10 |
Hijiri |
sfan5: it would depend on the semantics of lua tuples |
| 22:10 |
Void7 |
!py hash((1, 2, 3)) |
| 22:10 |
Hijiri |
they don't exist so we can't day anything about them |
| 22:10 |
Hijiri |
say* |
| 22:10 |
agrecascino |
!c |
| 22:10 |
MinetestBot |
agrecascino: Nothing to calculate. |
| 22:10 |
shamoanjac |
I've used tuples a couple times as map keys |
| 22:10 |
sfan5 |
i'd expect them to implement it the same as python |
| 22:10 |
sfan5 |
shamoanjac: yes |
| 22:10 |
agrecascino |
!py prnt("kys") |
| 22:10 |
sfan5 |
but what you need is not only immutable tuples |
| 22:10 |
agrecascino |
!py prnt("kys") |
| 22:11 |
sfan5 |
you also need hashing of objects |
| 22:11 |
shamoanjac |
!py """Test""" |
| 22:11 |
shamoanjac |
yeah |
| 22:11 |
Hijiri |
sfan5: Does equaltiy for tuples in python use id? |
| 22:11 |
sfan5 |
no |
| 22:11 |
shamoanjac |
that would be is |
| 22:11 |
sfan5 |
!c (1, 2, 3) == (1, 2, 3) |
| 22:11 |
MinetestBot |
True |
| 22:11 |
agrecascino |
i should really actually hold my keyboard while typing |
| 22:11 |
sfan5 |
!c (1, 2, 3) id (1, 2, 3) |
| 22:11 |
MinetestBot |
SyntaxError: invalid syntax (<string>, line 1) |
| 22:11 |
sfan5 |
!c (1, 2, 3) is (1, 2, 3) |
| 22:11 |
MinetestBot |
False |
| 22:11 |
sfan5 |
^ Hijiri |
| 22:11 |
Hijiri |
Lua tables follow that equal keys give the same value |
| 22:11 |
Hijiri |
so if tuples were similar it would do that |
| 22:13 |
Hijiri |
well maybe not if the __equal metamethod is used, but if tuples are primitive and use primitive ==, it should work like I meant |
| 22:13 |
shamoanjac |
agrecascino, how did you add protection for claiming? |
| 22:14 |
shamoanjac |
I can't find that line anymore |
| 22:14 |
agrecascino |
shamoanjac, err |
| 22:14 |
Hijiri |
You could even have tuple interning since they are immutable like strings |
| 22:14 |
Hijiri |
though that would differ from python |
| 22:14 |
agrecascino |
old_is_protected = minetest.is_protected |
| 22:14 |
agrecascino |
function minetest.is_protected(pos,name) |
| 22:14 |
agrecascino |
local player = minetest.get_player_by_name(name) |
| 22:14 |
agrecascino |
if factionsmod.testifallowed(pos,player) ~= true then |
| 22:14 |
agrecascino |
return true |
| 22:15 |
agrecascino |
end |
| 22:15 |
agrecascino |
return old_is_protected(pos,name) |
| 22:15 |
agrecascino |
end |
| 22:15 |
Hijiri |
use a paste site |
| 22:15 |
Hijiri |
shouldn't that be local old_is_protected |
| 22:15 |
Hijiri |
unless that is a table key or something |
| 22:15 |
agrecascino |
it should |
| 22:16 |
shamoanjac |
k thanks |
| 22:20 |
|
xSmurf joined #minetest |
| 22:20 |
shamoanjac |
ONCE AGAIN |
| 22:20 |
shamoanjac |
SELF.FIELD IS A NIL VALUE |
| 22:20 |
shamoanjac |
EVEN IF CLEARLY DECLARED |
| 22:21 |
shamoanjac |
oops no it wasn't |
| 22:21 |
shamoanjac |
lel |
| 22:33 |
|
popbob joined #minetest |
| 22:34 |
popbob |
eya, just a quick question, what's the purpose of minetest? Like we already have minecraft? im curious :) |
| 22:34 |
xunto |
popbob: mincraft is proprietary |
| 22:34 |
popbob |
So mostly for open-source crossplatform freedom? :) |
| 22:35 |
xunto |
Minecraft still have no modding api, as i know) |
| 22:35 |
popbob |
yea, that's pretty cool :P |
| 22:35 |
xunto |
popbob: mostly, I think, but it gives a lot. |
| 22:36 |
popbob |
Just played my first world, seems pretty cool, got a much better 'base' than minecrafts terrible java 'engine' I guess you could say |
| 22:36 |
shamoanjac |
agrecascino, claiming is now working |
| 22:36 |
xunto |
popbob: I even made some fixes myself. I wouldn't do it for minecraft, as example |
| 22:36 |
shamoanjac |
so do most commands |
| 22:36 |
shamoanjac |
now I just have to fix the load() function |
| 22:37 |
xunto |
popbob: but it's not ready yet( |
| 22:37 |
xunto |
Far from ready. |
| 22:37 |
popbob |
yea, I like it though :) |
| 22:38 |
xunto |
But it fits good for our comming roleplay server. So, I already like it. :D |
| 22:39 |
popbob |
hmm I like the idea behind it, I only know python though :c lol |
| 22:40 |
xunto |
You will hate lua after python if you try modding api :D |
| 22:41 |
shamoanjac |
can confirm |
| 22:41 |
popbob |
hahaha |
| 22:41 |
agrecascino |
shamoanjac, now we just need to make aconverter |
| 22:41 |
shamoanjac |
until now I had only used Python for scripting |
| 22:41 |
shamoanjac |
and some bash |
| 22:41 |
shamoanjac |
yes |
| 22:45 |
agrecascino |
shamoanjac, is the latest version on the github |
| 22:45 |
agrecascino |
? |
| 22:47 |
shamoanjac |
no |
| 22:47 |
shamoanjac |
and don't use the one I've PR'd, it's full of syntax errors |
| 22:48 |
shamoanjac |
not to mention the million bugs I've fixed the last hours |
| 22:51 |
|
GunshipPenguin joined #minetest |
| 23:02 |
shamoanjac |
now for some reason chunks are being stored as booleans |
| 23:02 |
shamoanjac |
oh, right |
| 23:02 |
shamoanjac |
AH |
| 23:02 |
shamoanjac |
GOT IT |
| 23:02 |
|
theTroy joined #minetest |
| 23:03 |
shamoanjac |
get rekt Lua |
| 23:03 |
shamoanjac |
I beat you once again |
| 23:03 |
shamoanjac |
with your nils |
| 23:03 |
shamoanjac |
and your tables |
| 23:03 |
shamoanjac |
.|. |
| 23:19 |
|
ElectronLibre joined #minetest |
| 23:32 |
Nosrick |
Quick question: how do I override the player's on_punch function? |
| 23:33 |
shamoanjac |
as a quick guess |
| 23:33 |
shamoanjac |
minetest.get_player_by_name("name").on_punch = function(whatever) [...] |
| 23:34 |
shamoanjac |
there must be a better way, though |
| 23:35 |
Nosrick |
I'm doing it on player join. Is that wise/safe? |
| 23:35 |
shamoanjac |
I'd say yes |
| 23:35 |
shamoanjac |
3>factions.lua:102: attempt to call method "on_unclaim_chunks" |
| 23:36 |
shamoanjac |
3>line 102 is "self:on_unclaim_chunk(chunkpos)" |
| 23:36 |
shamoanjac |
4just |
| 23:36 |
shamoanjac |
is it just not taking my file |
| 23:40 |
shamoanjac |
oh, I think I know |
| 23:40 |
nuzzle |
and that's why |
| 23:40 |
prrpx |
and that's why |
| 23:41 |
prrpx |
dynamically typing is a bad idea |
| 23:41 |
shamoanjac |
since I save the factions by serializing them, and I don't use metatables |
| 23:41 |
shamoanjac |
THEN |
| 23:41 |
prrpx |
and lua is a shit |
| 23:41 |
prrpx |
do you feel the pain now |
| 23:41 |
prrpx |
can you feel the pain |
| 23:41 |
shamoanjac |
THEN THE FUNCTIONS CODE IS SAVED |
| 23:41 |
shamoanjac |
SO I HAVE TO DELETE FACTIONS TO MODIFY A FUNCTION |
| 23:41 |
shamoanjac |
UNLESS I USE METATABLES |
| 23:41 |
shamoanjac |
I didn't want to |
| 23:41 |
shamoanjac |
I guess I have no choice |
| 23:41 |
T4im |
just use metatables then, its not rocket science |
| 23:41 |
prrpx |
can you feel the pain of dynamic typing |
| 23:41 |
prrpx |
can you feel the pain of _G |
| 23:41 |
T4im |
x) |
| 23:42 |
prrpx |
can you feel the pain of TABLES |
| 23:42 |
shamoanjac |
wtf i hate lua now |
| 23:42 |
prrpx |
how can you not like lua tables |
| 23:42 |
prrpx |
tables can do anything |
| 23:42 |
T4im |
everyone hates lua, i bet the lua developers hate it |
| 23:42 |
T4im |
no reason to give up |
| 23:42 |
prrpx |
T4im: there are only two lua developers |
| 23:42 |
shamoanjac |
why is Lua chosen for games? |
| 23:42 |
prrpx |
they're working in a bubble |
| 23:43 |
prrpx |
and don't give a shit about anyone else |
| 23:43 |
shamoanjac |
Lua = Portuguese = Brazil = StephenLynx = JavascriptChan |
| 23:43 |
thePalindrome |
Lua was chosen for the scripting language because it's cross-platform, safe, and not complete garbage |
| 23:43 |
shamoanjac |
I have some objection in respect to the "not complete garbage" part |
| 23:44 |
T4im |
you know the metatables are one of the nice things about it, shamoanjac :D |
| 23:44 |
xunto |
Just like python |
| 23:44 |
prrpx |
should've gone for lisp |
| 23:44 |
prrpx |
emacs lisp |
| 23:44 |
shamoanjac |
^ |
| 23:44 |
shamoanjac |
Scheme |
| 23:44 |
prrpx |
scheme is a mess |
| 23:44 |
shamoanjac |
stfu |
| 23:44 |
prrpx |
common lisp |
| 23:44 |
prrpx |
newlisp |
| 23:44 |
shamoanjac |
SICP = Scheme |
| 23:44 |
prrpx |
yea scheme has |
| 23:44 |
shamoanjac |
GNU Image Manipulation Program = Scheme |
| 23:44 |
prrpx |
literally a hundred standards tho |
| 23:44 |
shamoanjac |
Audacity = Scheme |
| 23:44 |
shamoanjac |
MIT Scheme |
| 23:44 |
shamoanjac |
obviously |
| 23:45 |
shamoanjac |
because Stallman |
| 23:45 |
shamoanjac |
RECAREDVS MATHEVS STALLMANVS REX SOFTVVARVM LIBERA |
| 23:50 |
Hijiri |
Nosrick: register_on_punchplayer |
| 23:50 |
Hijiri |
players don't have an on_punch like entities do |
| 23:51 |
Nosrick |
Ah, thank you! |
| 23:51 |
|
Void7 joined #minetest |
| 23:53 |
agrecascino |
why don't we just add a c++ api |
| 23:54 |
agrecascino |
and somehow compile on runtime |
| 23:55 |
prrpx |
haven't u heard |
| 23:55 |
prrpx |
c++ is obsolete |
| 23:56 |
prrpx |
also, sounds like a pain in the ass |
| 23:56 |
agrecascino |
rewrite it in borrow checker the language |
| 23:56 |
prrpx |
considering c++ ABI is a bi-itch |
| 23:56 |
agrecascino |
AMI RITE GUIS IS 2016 |
| 23:56 |
prrpx |
RIIR 4 life dude |
| 23:57 |
agrecascino |
i really love having a language where i want to die in the process of making global variables |
| 23:58 |
thePalindrome |
Not to mention that if you do that most minetest mods will be linux only |
| 23:58 |
thePalindrome |
Because windows is for dweebs |
| 23:58 |
thePalindrome |
It's also harder to sandbox |