Page 1 of 1

Addons Support, requests from modders

Posted: Fri Nov 11, 2011 10:56 am
by darkgod
Hello

I'm adding addon supports to modules & tome. Currently you can override existing files or dynamically change them but this wont cut it for everything. So I decided to add a hook & events system.
Example, when the player is hit it would trigger a "mod.class.Player:takeHit" event and addons can register on this event, ie:

Code: Select all

myaddon:registerHook("mod.class.Player:takeHit", function(self, value)
    game.log("Arg I've been hit for %d!!!!", value)
end)
So my question is to people that wish to make addons: which hooks would you need/want/wish for ?
I have some that I'll add myself for they are obvious but there probably will be many more that are needed, so ask away!

Re: Addons Support, requests from modders

Posted: Fri Nov 11, 2011 5:01 pm
by Goblinz
Okay great to see addons coming to life. Here are some functions that I use often when making stuff

the damage projector
actor:act()
actor:move()
actor:onTakehit()
actor:die()
I am sure there are lots more actor functions but those are the ones i have used
combat:attackTarget() and attack target with weapon
combat:checkHit()
combat:combatcrit()

THese are the functions I have modified for some reason or other. I have not done anything with items so things can be missing.

Re: Addons Support, requests from modders

Posted: Tue Dec 13, 2011 5:14 pm
by bricks
I'm curious, what hooks are currently available? actor:actBase() (I think that is it) is one I'd like to have, currently just for the sake of making calls to sustained talent's functions.

Re: Addons Support, requests from modders

Posted: Sun Dec 18, 2011 7:24 pm
by darkgod
DamageProjector:base
DamageProjector:final
Actor:takeHit
Combat:attackTarget
Combat:attackTargetWith
ToME:load

Re: Addons Support, requests from modders

Posted: Tue Mar 06, 2012 4:18 am
by Hirumakai
I would like to request the dam variable in attackTargetWith in combat.lua be passed to hooks, if possible.

Instead of:

local hd = {"Combat:attackTargetWith", hitted=hitted, target=target, weapon=weapon, damtype=damtype, mult=mult}
if self:triggerHook(hd) then hitted = hd.hitted end

replace with:

local hd = {"Combat:attackTargetWith", hitted=hitted, target=target, weapon=weapon, damtype=damtype, mult=mult, dam=dam}
if self:triggerHook(hd) then hitted = hd.hitted end

This allows hooks to take into account the amount of damage actually done by the weapon.

Re: Addons Support, requests from modders

Posted: Fri Mar 09, 2012 8:06 pm
by darkgod
done