• LuaCraft | Minecraft with a taste of Lua
    383 replies, posted
[QUOTE=vandooz;35890146]Thanks, last question of today: is there a function to check around a radius of an entity/block/player? if not take it as an request.[/QUOTE] What to check? Entities? I'd guess you could use ents.GetClosestToEntity(ent, radius)
Also, I asked before but didn't get an answer. Would it be possible to make blocks/entities react as if they had just been pushed by a piston? To create invisible pistons etc.
[QUOTE=LuaStoned;35890733]What to check? Entities? I'd guess you could use ents.GetClosestToEntity(ent, radius)[/QUOTE] I think i ment for blocks, not entities.
[QUOTE=Lexic;35890968]Also, I asked before but didn't get an answer. Would it be possible to make blocks/entities react as if they had just been pushed by a piston? To create invisible pistons etc.[/QUOTE] Never saw that question, will look into it (something like block:Push(dir) .. seems ok) [QUOTE=vandooz;35891217]I think i ment for blocks, not entities.[/QUOTE] I am not quite sure what you want :x sorry.
[QUOTE=LuaStoned;35892050]Never saw that question, will look into it (something like block:Push(dir) .. seems ok) I am not quite sure what you want :x sorry.[/QUOTE] Ok, look i ment radius, something like GetClosestToBlock(block, radius).
[QUOTE=vandooz;35892166]Ok, look i ment radius, something like GetClosestToBlock(block, radius).[/QUOTE] ents.GetClosestToVector(vec, radius) €dit: @Lexi [lua]_R.Block.Push = function(self, vec, len) if (vec.x ~= 0 and (vec.y ~= 0 or vec.z ~= 0)) then return false end if (vec.y ~= 0 and (vec.x ~= 0 or vec.z ~= 0)) then return false end if (vec.z ~= 0 and (vec.x ~= 0 or vec.y ~= 0)) then return false end len = len or 12 local dir = Vector(math.Clamp(vec.x, -1, 1), math.Clamp(vec.y, -1, 1), math.Clamp(vec.z, -1, 1)) local id, meta = self:GetID(), self:GetMeta() local prev_id, prev_meta = id, meta self:SetID(0) for i = 1, len do local pos = self:GetPos() + dir * i local block = Block(pos) id, meta = block:GetID(), block:GetMeta() block:SetID(prev_id) block:SetMeta(prev_meta) if (id == 0) then break end if (pos.z <= 0 or pos.z >= 256) then break end prev_id, prev_meta = id, meta end end[/lua]
[QUOTE=LuaStoned;35892432]ents.GetClosestToVector(vec, radius) €dit: @Lexi [lua]_R.Block.Push = function(self, vec, len) if (vec.x ~= 0 and (vec.y ~= 0 or vec.z ~= 0)) then return false end if (vec.y ~= 0 and (vec.x ~= 0 or vec.z ~= 0)) then return false end if (vec.z ~= 0 and (vec.x ~= 0 or vec.y ~= 0)) then return false end len = len or 12 local dir = Vector(math.Clamp(vec.x, -1, 1), math.Clamp(vec.y, -1, 1), math.Clamp(vec.z, -1, 1)) local id, meta = self:GetID(), self:GetMeta() local prev_id, prev_meta = id, meta self:SetID(0) for i = 1, len do local pos = self:GetPos() + dir * i local block = Block(pos) id, meta = block:GetID(), block:GetMeta() block:SetID(prev_id) block:SetMeta(prev_meta) if (id == 0) then break end if (pos.z <= 0 or pos.z >= 256) then break end prev_id, prev_meta = id, meta end end[/lua][/QUOTE] I think he wants the animation of the block moving along the floor, just like a piston pushed it.
Welp, multi-world support is taking a lot longer than I thought it would. So far I can create the world and get it to run, but I can't actually get the player into it yet. :v: This is how you would create a world though. [lua] local world = world.Create( { name = "test_world", -- The name of the folder in which the world will reside in gamemode = CREATIVE, -- The default gamemode provider = WORLD, -- The type of world this is (WORLD,END,NETHER) type = WORLD_TYPE_DEFAULT, -- The type of world to be generated (WORLD_TYPE_DEFAULT,WORLD_TYPE_FLAT) viewdist = 10, -- Maximum view distance difficulty = 1, -- Difficulty level seed = "This be a test seed", -- The worlds seed animals = false, -- Spawn animals monsters = false, -- Spawn monsters structures = false, -- Spawn structures } ) [/lua]
[img]http://gyazo.breakpointservers.com/5b5ca843cfd2858679997c2ec6a0874f.png[/img] Eek!
I've tried this: [lua]-- Experminal scripty #2 Msg("start experminal regrowscript") -- Vars n shit regrow_id = 0 hook.Add("player.breakblock", "regrow_breakblock", function(ply, block) if block:GetID() == 16 then -- coal print(block) --debug block:SetID(7) timer.Simple( 15, regrow_func, block, 16 ) Msg("digcode ... OK") regrow_id = regrow_id + 1 return false end end) local function regrow_func(block, blockid) if block:GetID(7) then block:SetID(blockid) Msg("digtimer ... OK") end end[/lua] got: [quote]Timer Error: lua/extensions/timer.lua:69: attempt to call nil[/quote]
i am currently making a (amateur) HUD, but i have some issues with the experience bar, as in this example: [lua]print(LocalPlayer():GetExperience())[/lua] all it returns is: 0 for now i had to do with other solutions, as well as just not adding it for now i tested the function in both single- and multiplayer am i doing something wrong, won't it work clientside, or does this still have to be fixed? what i want, i as the wiki mentions: GetExperience() Return value: Number:exp Information: Returns a players experience for their current level
Could PropertyManager be added to the client? I use it in a server addon that would work just as well for the client, but I manage my data with PropertyManager. May as well cross post on the forums.
[QUOTE=Kogitsune;35925539]Could PropertyManager be added to the client? I use it in a server addon that would work just as well for the client, but I manage my data with PropertyManager. May as well cross post on the forums.[/QUOTE] Committed PropertyManager to the client. [QUOTE=cvbbot;35923842]i am currently making a (amateur) HUD, but i have some issues with the experience bar, as in this example: [lua]print(LocalPlayer():GetExperience())[/lua] all it returns is: 0 for now i had to do with other solutions, as well as just not adding it for now i tested the function in both single- and multiplayer am i doing something wrong, won't it work clientside, or does this still have to be fixed? what i want, i as the wiki mentions: GetExperience() Return value: Number:exp Information: Returns a players experience for their current level[/QUOTE] I think I can fix this.
[QUOTE=BlackAwps;35929335]Committed PropertyManager to the client. I think I can fix this.[/QUOTE] Awesome thanks
A little late, but it's fixed and ready for the update. [img]http://puu.sh/upe1[/img] This update also includes some more precise errors. [img]http://puu.sh/upeM[/img]
[QUOTE=BlackAwps;35933412]A little late, but it's fixed and ready for the update. [img]http://puu.sh/upe1[/img] This update also includes some more precise errors. [img]http://puu.sh/upeM[/img][/QUOTE] great, still is don't understand how GetExperience() would return 0.3333345, as in your example
[QUOTE=cvbbot;35936725]great, still is don't understand how GetExperience() would return 0.3333345, as in your example[/QUOTE] I'd assume that it would be the progress from one level to the next. That would be a third of the way through, 33%.
Shouldn't be the error message "bad argument #1 to 'InBed' (Player expected, got nil)", in order to be consistent with the rest of Lua?
[QUOTE=helifreak;35936800]I'd assume that it would be the progress from one level to the next. That would be a third of the way through, 33%.[/QUOTE] oh okay great
[QUOTE=Gran PC;35937060]Shouldn't be the error message "bad argument #1 to 'InBed' (Player expected, got nil)", in order to be consistent with the rest of Lua?[/QUOTE] It would be pretty hard to add function names.
[QUOTE=Map in a box;35940302]It would be pretty hard to add function names.[/QUOTE] Not really. There's luaL_checktype( long state, int index, LuaTypes expected ), and barring that you can pull the information off the stack with lua_getinfo( state, "n", debugobject ) and use debugobject.name. I don't know what their implementation offers, though, so it may be harder than that - but the C api easily supports it.
I pushed the update so PropertyManager for the client is live along with the GetExp fix and other stuff, hope you enjoy it!
[QUOTE=Kogitsune;35940875]Not really. There's luaL_checktype( long state, int index, LuaTypes expected ), and barring that you can pull the information off the stack with lua_getinfo( state, "n", debugobject ) and use debugobject.name. I don't know what their implementation offers, though, so it may be harder than that - but the C api easily supports it.[/QUOTE] You have to remember that this is lua emulated in pure java.. :v: Some things are missing. I will look and see if I can do it, however.
I've always wondered, can we install Minecraft Mods (ModLoader, TooManyItems) in LuaCraft ?
[QUOTE=Fleskhjerta;35976228]I've always wondered, can we install Minecraft Mods (ModLoader, TooManyItems) in LuaCraft ?[/QUOTE] Dont know that, "would bukkit work on luaserver?" is one of those that is in my mind right now. I believe that it was answered some time ago, but i cant find it.
[QUOTE=Fleskhjerta;35976228]I've always wondered, can we install Minecraft Mods (ModLoader, TooManyItems) in LuaCraft ?[/QUOTE] Why would you? Just recode them in Lua.
So now, because of the update, font:DrawText()'s first argument needs to be a string, i can't use a number anymore? kind of ridiculous that i just have to store the value with tostring() before using it with DrawText
[QUOTE=T3hGamerDK;35976666]Why would you? Just recode them in Lua.[/QUOTE] A very BIG majority of them would be too long, hard, or even impossible to recode in LuaCraft due to is limits.
There is no way to make Bukkit work alongside LuaCraft in the same server binary. There's also no way to install standard minecraft mods (such as modloader etc) into the LuaCraft client. This is because LuaCraft overrides many of the same classes that Bukkit and modloader do, and there would be conflicts. I wonder how viable it would be to use Lua to "emulate" a java environment and load in existing Bukkit or modloader plugins though...
[QUOTE=T3hGamerDK;35976666]Why would you? Just recode them in Lua.[/QUOTE] I'll give you $10 to make an acceptable clone of [url=https://github.com/sk89q/worldedit]WorldEdit[/url] in Lua. Should be an easy enough job eh?
Sorry, you need to Log In to post a reply to this thread.