• Lua for Minecraft
    378 replies, posted
[QUOTE=bootv2;32109031]couldn't you make the player automatically spawn on the last position if no position is passed?[/QUOTE] That's a hook, not a function.
[QUOTE=Chrisaster;32109196]That's a hook, not a function.[/QUOTE] oh, nevermind, too used to c++ I guess.
awesome work stoned :D
Ladies and Gents, v5 is live! Changelog: [code] Block:GetResistance() Block:SetResistance(num) Block:GetHardness() Block:SetHardness(num) Block:Unbreakable(true / false) Block:Break() Player(name) -- returns a player object Player:Name() Player:Send(str / colorcode) -- send him a message, color codes optional Player:Op(true / false) Player:IsOp() Player:Kick([reason]) Player:Ban([reason]) Player:Alive() Player:Kill() Player:Health() Player:GetHealth() Player:SetHealth(num) Player:GetPos() Player:SetPos(vec) Player:IsBurning() Player:SetBurning(true / false) Player:NoClip(true / false) Player:Dimension() -- returns the dimension Player:IsMounted() Player:IsCrouching() Player:IsAttacked() Player:InWater() Player:GetAir() Player:SetAir() Player:Drop() -- drops the current item Player:Trace() -- returns a vector if the trace hits something tostring(Player) Updated most of the hooks to contain the player object[/code] Got any ideas or suggestions? Feel free to post them down below. €dit: The best feature is probably ply:Trace() :v:
If it's not much trouble could we have a key press hook or something similar?
[QUOTE=victormeriqui_1;32139871]If it's not much trouble could we have a key press hook or something similar?[/QUOTE] I'm sorry, but key-events are handled in the client.
[QUOTE=Arni;32143786]I'm sorry, but key-events are handled in the client.[/QUOTE] Can't they be passed server side?, how does player.rightclick work then?
That event is already sent from the client to the server for using of items.
ah ok my mistake
Would you be able to add a player damage hook? Would be useful if you could return false to stop it from being taken
[QUOTE=techtuts0;32153125]Would you be able to add a player damage hook? Would be useful if you could return false to stop it from being taken[/QUOTE] Good idea! It will be added in v6 (I already implemented it now). The update should come in ~10 hours (tomorrow morning).
As I promised yesterday, v6 is ready: Download: [url]http://luastoned.com/LuaServer.rar[/url] Changelog: [code] Added player.damage (ply, damage) Added player.placeblock (ply, position) Added Block GetLightValue Added World Object Fixed Block Break[/code] [url=http://wiki.luastoned.com]Plus we got a shiny new Wiki! Feel free to contribute![/url]
Just some ideas i stumbled uppon: Do stuff with the blocks material, like setIsTranslucent, setBurning setLightValue might be a fun feature to add as well. - Edit after thinking If we change something in a Material it will be changed in ALL the blocks. Maybe a bit too dangerous
Light value changes won't appear on the client.
Are there events for the player touching blocks, pressing buttons, etc?
Just wanted to ask, does Block:Break() breaks the block and drops the stuff that you would get by normally breaking it with a tool/etc. or does it just remove the block?
It breaks it like it would if it broke normally.
[QUOTE=LEETNOOB;32176247]Just wanted to ask, does Block:Break() breaks the block and drops the stuff that you would get by normally breaking it with a tool/etc. or does it just remove the block?[/QUOTE] [QUOTE=BlackAwps;32176492]It breaks it like it would if it broke normally.[/QUOTE] Plus if you return a value from 0 to 1 it'll use it as the drop chance (0 -> 100%).
I don't understand any of this shit, but if people make things smiler to the Addons we got in GMod, a million winner ratings to you, sir.
[QUOTE=LEETNOOB;32000836]Honestly, after seeing what Genesis999 is doing to LuaServer, I'd rather use this instead.[/QUOTE] What is Genesis999 doing with it? Havnt read much in the LuaServer thread
It seems like Genesis is getting pounded on, well...? Everyone should give some recognition to Genesis999 for his great (and original) idea on incorporating lua into Minecraft, but everything has its ups and downs. Kudos to LuaStoned and Genesis for making this kind of stuff possible! Keep up the great work! Genesis, don't be discouraged by everyone pounding you about how bad it is, you were the [U]first[/U] to do this!
[url=http://notch.tumblr.com/post/140146373/lua-or-java-api]So original[/url] Also, he's getting flack because of the inconsistencies and just plane bad implementation.
[QUOTE=BlackAwps;32192719][url=http://notch.tumblr.com/post/140146373/lua-or-java-api]So original[/url] Also, he's getting flack because of the inconsistencies and just plane bad implementation.[/QUOTE] Plain* Criticism is criticism. Genesis should look at this as an opportunity to improve on his mistakes to become a better programmer. Everybody's going to hit a speed bump in their lives, which is why we should give constructive criticism on why we don't like his project. I think everybody here did a good job at being half decent while doing it, too.
[QUOTE=yuriman;32181193]What is Genesis999 doing with it? Havnt read much in the LuaServer thread[/QUOTE] He's over-complicating it like fuck. Instead of adding in a separate function for separate stuff to do (SetHealth, GetHealth, AddHealth, etc.) he just condenses it all into one function. Hell, might as well remove everything and add in Server.DoAction(millions of arguments here to do a simple thing). Not to mention, instead of fleshing out the basic functions that it SHOULD have, he adds in useless stuff that most people won't even use at this time, thus making the creation of various useful mods impossible. I mean, come on. At first it was Hooks.Add, then it became Hook.Add (thus breaking every single plugin that was developed for older versions of it) then he kept on changing functions name almost every single build (MORE plugins broken in the process), and then he said "fuck that, I want to over-complicate this and just slap 3 functions into one big function!". Then he added in access to metatables. And guess what? It didn't even work properly on blocks/players/etc. It's pretty much like WireMod for Garry's Mod - extremely over-complicated and useless in most aspects of it.
Pretty much sums it all up on why this project even started. Anyway, so far, this is what we have done for the next update.. [code]Fixed include to give a proper error Added player.command hook ( ply, arguments table ) Added hook player.portaled ( ply, vec ) Changed player.disconnect hook not being called when the player gets kicked and added reason argument Changed player.authenticate allow for a custom kick message ( return a string ) Changed player.chat to accept a string or table return override and will no longer override chat commands -> use player.command hook Changed Player:Send() to Player:Msg() Added file.CreateDir( directory ) Added file.Find( directory, search ) Added file.Size( file ) Added world:IsNightTime() Added Player:Drop( count ) argument Added player:GetEyePos() Added player:GetEyeHeight() Added player:Give( itemid, amount ) Added Player:OnGround() Added Player:OnLadder() Added ItemStack object ItemStack:GetMaxSize() ItemStack:IsDamageable() ItemStack:HasSubtypes() ItemStack:IsDamaged() ItemStack:GetDamage() ItemStack:GetMaxDamage() ItemStack:SetDamage() ItemStack:GetSize() ItemStack:GetID() Added Player:GetInventory() Added Player:GetEquipment() Added Player:GetSlotStack( slot number )[/code]
Leetnoob: I'd have more pity for you regarding name changes to libraries if You had to do more than ctrl+f replace all. Takes about five seconds As to features that I haven't implemented that you deem vital... If I don't get people requesting something in particular i can't know that it is needed. Blocks were never meant to have metatables. And since their implementation player tables have always worked. As to condensing functions like gethealth, sethealth and such into one function health I made that change due to someone saying it would be good. If you think otherwise you need to bring it to my attention. To make a long story short if you don't like the way something works stop bitching about it and bring it to my attention where I will see it. I didn't setup things like forums and the like for nothing.
Finally I can make a DarkRP server in Minecraft! But seriously, it looks amazing. Keep up the good work gents.
[QUOTE=Genesis999;32222563]Leetnoob: I'd have more pity for you regarding name changes to libraries if You had to do more than ctrl+f replace all. Takes about five seconds As to features that I haven't implemented that you deem vital... If I don't get people requesting something in particular i can't know that it is needed. Blocks were never meant to have metatables. And since their implementation player tables have always worked. As to condensing functions like gethealth, sethealth and such into one function health I made that change due to someone saying it would be good. If you think otherwise you need to bring it to my attention. To make a long story short if you don't like the way something works stop bitching about it and bring it to my attention where I will see it. I didn't setup things like forums and the like for nothing.[/QUOTE] Yeah, I think I'm going to use this instead of changing function names/hook names/whatever you decide to change every new build. Thanks for at least adding Lua to Minecraft, though.
If I can get MCP to work right, I can remake my client lua mod and help you get client-server interaction with lua.
[QUOTE=Map in a box;32229067]If I can get MCP to work right, I can remake my client lua mod and help you get client-server interaction with lua.[/QUOTE] Sounds awesome, a friend of mine is looking into that already but two people are always better than one.
Sorry, you need to Log In to post a reply to this thread.