[mod]Lua Entities Overrider [WIP][entity_override]

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

[mod]Lua Entities Overrider [WIP][entity_override]

by taikedz » Fri Sep 16, 2016 11:24

Github: https://github.com/taikedz/minetest-override
License: LGPLv3

Demo video: https://www.youtube.com/watch?v=36VhUWrMjQY

Minetest: Lua Entity Override

Override behaviour of Lua entities.

Why this mod?

This mod is intended to provide a small framework to redefine Lua entities without touching the original mods' Lua files directly - instead, the properties are changed at runtime, during load.

This goes some ways to reduce technical debt - a state where every update to the original or supporting code causes you to need to maintain/reapply your changes.

This way, you can keep up to date with regularly changing mods without having to untangle merge conflicts from your customizations.

Its main use will be to override mob behaviours, but can be used for any entity in the minetest.registered_entities list.

How to use this mod

    Create a new mod for your customizations
    Add a dependency on this mod, as well as the mods you want to override
    Create your Lua files using the simple API structure

Example

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local demofunction = function(self,clicker)
        minetest.chat_send_player(clicker:get_player_name(),"You right-clicked a "..self.name)
        return true
end

local genrewrite = {
        type="npc",
        hp_max = {
                check=function(oldval) return oldval < 30 end,
                value=30, --  new value to assign, if above check of the old value returned true
        },
        on_rightclick = {
                fchain_type = "before",
                fchain_func = demofunction
        }
}

override:rewrite("dmobs:panda",genrewrite)
override:rewrite("dmobs:fox",genrewrite)

-- make a bigger, stronger orc whilst leaving the normal one alone

override.clone("dmobs:orc","mydmobs:orc")
override.rewrite("mydmobs:orc",{reach=4,armor=80,visual_size={ value={x=5,y=5} }})


To Do

    * Allow some way of de-registering entities altogether
    * provide an ABM canceller
    * proof of concept code for overriding some mobs_redo functions (example of adding functionality without packaging a modified API file - e.g. as do NSSM or ESMOBS currently)
Last edited by taikedz on Fri Sep 23, 2016 10:01, edited 6 times in total.
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: [mod][wip] Lua Override [override]

by taikedz » Fri Sep 16, 2016 14:54

An example of this being in use can be found here https://github.com/taikedz/vivarium/blo ... g/init.lua
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: [mod][wip] Lua Override [override]

by azekill_DIABLO » Sat Sep 17, 2016 09:15

nice!
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
TheReaperKing
Member
 
Posts: 493
Joined: Sun Nov 22, 2015 21:36

Re: [mod][wip] Lua Override [override]

by TheReaperKing » Sat Sep 17, 2016 12:47

This is super useful!! I have to take lava out for my students and this will make life much easier updating the minetest_game. I was wondering, is there a reason to use LGPL 3 instead of LGPL 2.1 like minetest uses? I'm not sure if it matters but it might make life easier for people if it shared the same license as minetest since I believe the main difference is that with the LGPL 3 you have to provide the install instructions.
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com

Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com

Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: [mod][wip] Lua Override [override]

by taikedz » Sat Sep 17, 2016 15:43

TheReaperKing wrote:This is super useful!! I have to take lava out for my students and this will make life much easier updating the minetest_game.


Thanks - hope it makes life easier for you!

TheReaperKing wrote:I was wondering, is there a reason to use LGPL 3 instead of LGPL 2.1 like minetest uses? I'm not sure if it matters but it might make life easier for people if it shared the same license as minetest since I believe the main difference is that with the LGPL 3 you have to provide the install instructions.


TL;DR = it's actually more useful and clearer to distribute under LGPLv3 than LGPLv2.1, and no extra requirements or duties are asked of users or implementors.

Long story is:

There are no extra duties or burdens from LGPLv2.1 to LGPLv3 that I noticed, though v3 is, in my mind, lexically clearer. v2.1 refers to the licensed software as a "Library" (which can cause problems in later legal interpretations - would you call the full Minetest package a "Library", and if not can the license even be meaningfully applied), and adds some strange requirements (written offer of source code, etc) that don't really mesh with modding and application distribution.

LGPLv2.1 wrote:A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.


Compare against

LGPLv3 wrote:“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.


I am no lawyer, but in the way I interpret the text, the later version is more manageable and usable.

The section on installation instructions is conditional on its applicability, generally to perpetuate installation instructions in a re-distributed and modified form, and does not refer so much to an installation guide as it does to documenting the prerequisite requirements and expected environment:

LGPLv3 wrote:Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL


The corresponding GPL version states:

GPLv3_sec6 wrote:"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.

If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
 

User avatar
TheReaperKing
Member
 
Posts: 493
Joined: Sun Nov 22, 2015 21:36

Re: [mod][wip] Lua Override [override]

by TheReaperKing » Sat Sep 17, 2016 15:58

Thanks for that insight! Looks like you've definitely done your research :) Easier to read is definitely a good thing!
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com

Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com

Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [mod][wip] Lua Override [override]

by rubenwardy » Sat Sep 17, 2016 16:35

Really, as a library, it might be worth licensing this mod under a permissive license such as MIT. Making it copyleft stops permissive mods and subgames such as Pixture from using this. It's much more useful to have one shared library that everyone can use, rather than forcing permissive games to make their own version - given that the active code is 60 lines ish long, wouldn't be that hard.

Also, I feel like the mod name should have "entity" in it, like "lib_entity_overrider" or something like that, and the title should contain entity too.

Assuming that you don't want to change the mod name, this would be a better title:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
[Mod] LuaEntity Member Function Override [WIP] [override]
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: [mod][wip] Lua Override [override]

by taikedz » Sat Sep 17, 2016 16:53

Thanks rubenwardy. I'll do a proper rename as per your suggestion once back on laptop.

As for LGPL, It doesn't force anyone to rewrite an implementation and can be linked to without making any licensing demands on someone else's larger body of work (aside from direct changes to my code) -- it is specifically designed to allow other people to even make proprietary apps whilst still using the LGPL'd code. I feel this is amply permissive, keeping to my choice of keeping my own code Free whilst still allowing anyone else to license the rest of their work as they please.....
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: [mod]Lua Entities Overrider [WIP][entity_override]

by taikedz » Thu Sep 22, 2016 23:37

Added table concatenation

Did a demo video https://www.youtube.com/watch?v=36VhUWrMjQY
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 9 guests

cron