[Mod] LATE [late]

User avatar
texmex
Member
 
Posts: 1590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] LATE [late]

by texmex » Mon Nov 19, 2018 10:26

It seems that my stop function has a bug in it. RAM usage is surging after a minute of using it in the sprint mod posted above. Can you advise?
Last edited by texmex on Mon Nov 19, 2018 12:12, edited 1 time in total.
 

User avatar
Pyrollo
Member
 
Posts: 325
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: [Mod] LATE [late]

by Pyrollo » Mon Nov 19, 2018 10:35

Condition type registration is now possible.

You can now add a key condition type calling late.register_condition_type.

Something like (Code not tested !):
Code: Select all
late.register_condition_type("keypressed", {
    check = function(data, target)
            local ctrl = player:get_player_control()
            if type(data) == 'table' then
                for _, key in ipairs(data) do
                    if not ctrl[key] then
                        return false
                    end
                end
            else
                return ctrl[data] or false
            end
            return true
        end,
})


But that would not trigger effect, only end it if key is released. So you still need a globalstep function
Code: Select all
local timer = 0
minetest.register_globalstep(function(dtime)
   timer = timer + dtime
   if timer >= 0.2 then
      for _,player in ipairs(minetest.get_connected_players()) do
         local ctrl = player:get_player_control()
         if ctrl.aux1 and ctrl.up and
            not late.get_effect_by_id(player, "sprint") then
               late.new_effect(player, {
                  id = "sprint",
                  raise = 1, fall = 1,
                  impacts = {
                     speed = 2,
                  },
                  hud = { label = "Sprint brah", icon = "character.png^[sheet:8x4:1,1" },
                  stop_on_death = true,
                  conditions = { keypressed = { "aux1", "up" } },
               })
            end
      end
   end
end)


I feel something should be done in LATE to automatically start effects. Even I feel this could be a bit tricky.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]
 

User avatar
texmex
Member
 
Posts: 1590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] LATE [late]

by texmex » Mon Nov 19, 2018 11:07

Cool! I’ll try it! But yes, as you say it’s natural to assume that a conditions feature both can start and stop an effect.
 

User avatar
texmex
Member
 
Posts: 1590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex
 

User avatar
Pyrollo
Member
 
Posts: 325
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: [Mod] LATE [late]

by Pyrollo » Wed Jun 12, 2019 07:02

Thanks texmex, sorry not having time now for investigating on your problem :(
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]
 

User avatar
texmex
Member
 
Posts: 1590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] LATE [late]

by texmex » Wed Jun 12, 2019 07:12

Pyrollo wrote:Thanks texmex, sorry not having time now for investigating on your problem :(

No problem, Pyrollo! I wasn't even trying to nudge you on that issue. It was just that I had a good development session thanks to your mod. LATE and keyevent are the biggest time-savers for me right now.
 

User avatar
texmex
Member
 
Posts: 1590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] LATE [late]

by texmex » Mon Aug 19, 2019 20:41

Hey pyrollo,
I want to use a function for determining the impact of an effect_in type of effect. Is that all possible? The function needs to check stuff for the individual player.
 

User avatar
StarNinjas
Member
 
Posts: 296
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1
 

User avatar
texmex
Member
 
Posts: 1590
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: texmex

Re: [Mod] LATE [late]

by texmex » Thu Sep 19, 2019 06:05

StarNinjas wrote:Are you able to register custom effects like on wuzzie's?

Yes.
 

User avatar
StarNinjas
Member
 
Posts: 296
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1
 

User avatar
Pyrollo
Member
 
Posts: 325
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: [Mod] LATE [late]

by Pyrollo » Sun Sep 22, 2019 09:21

texmex wrote:Hey pyrollo,
I want to use a function for determining the impact of an effect_in type of effect. Is that all possible? The function needs to check stuff for the individual player.


I think you can register_condition_type ("having") with a check function that returns true if the player has item given in the effect parameter table ?
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]
 

User avatar
StarNinjas
Member
 
Posts: 296
Joined: Wed Mar 14, 2018 00:32
Location: aincrad
GitHub: starninjas
IRC: StarNinjas
In-game: J1
 

Previous

Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 3 guests