Add "Tech Finesse Lock" modes and some other improvements (#946)

* Improve Tech FInesse modes and add new player hooks

* Add Tech Finesse[+] Lock into mode map

* Credit PopUpWaffles

* Rearrange mode map
This commit is contained in:
NOT_A_ROBOT
2023-08-23 15:12:42 +07:00
committed by GitHub
parent 51968741ea
commit 9769b33deb
20 changed files with 567 additions and 336 deletions

View File

@@ -242,14 +242,28 @@ local function _mergeFuncTable(f,L)
end
return L
end
local hooks = {
'mesDisp',
'hook_left',
'hook_left_manual',
'hook_left_auto',
'hook_right',
'hook_right_manual',
'hook_right_auto',
'hook_rotLeft',
'hook_rotRight',
'hook_rot180',
'hook_drop',
'hook_die',
'task'
}
local function _applyGameEnv(P)-- Finish gameEnv processing
local ENV=P.gameEnv
-- Apply events
ENV.mesDisp=_mergeFuncTable(ENV.mesDisp,{})
ENV.hook_drop=_mergeFuncTable(ENV.hook_drop,{})
ENV.hook_die=_mergeFuncTable(ENV.hook_die,{})
ENV.task=_mergeFuncTable(ENV.task,{})
for i=1,#hooks do
ENV[hooks[i]]=_mergeFuncTable(ENV[hooks[i]],{})
end
-- Apply eventSet
if ENV.eventSet and ENV.eventSet~="X" then
@@ -257,12 +271,7 @@ local function _applyGameEnv(P)-- Finish gameEnv processing
local eventSet=require('parts.eventsets.'..ENV.eventSet)
if eventSet then
for k,v in next,eventSet do
if
k=='mesDisp' or
k=='hook_drop' or
k=='hook_die' or
k=='task'
then
if TABLE.find(hooks,k) then
_mergeFuncTable(v,ENV[k])
elseif type(v)=='table' then
ENV[k]=TABLE.copy(v)

View File

@@ -226,8 +226,10 @@ function Player:act_moveLeft(auto)
end
if self.cur then
if self.cur and not self:ifoverlap(self.cur.bk,self.curX-1,self.curY) then
self:_triggerEvent('hook_left')
self:_triggerEvent('hook_left_'..(auto and 'auto' or 'manual'))
self:createMoveFX('left')
self.curX=self.curX-1
self.curX=self.curX+self.movDir
self:freshBlock('move')
if not auto then
self.moving=0
@@ -248,8 +250,10 @@ function Player:act_moveRight(auto)
end
if self.cur then
if self.cur and not self:ifoverlap(self.cur.bk,self.curX+1,self.curY) then
self:_triggerEvent('hook_right')
self:_triggerEvent('hook_right_'..(auto and 'auto' or 'manual'))
self:createMoveFX('right')
self.curX=self.curX+1
self.curX=self.curX+self.movDir
self:freshBlock('move')
if not auto then
self.moving=0
@@ -267,6 +271,7 @@ function Player:act_rotRight()
if self.cur then
self.ctrlCount=self.ctrlCount+1
self:spin(1)
self:_triggerEvent('hook_rotRight')
self.keyPressing[3]=false
end
end
@@ -275,6 +280,7 @@ function Player:act_rotLeft()
if self.cur then
self.ctrlCount=self.ctrlCount+1
self:spin(3)
self:_triggerEvent('hook_rotLeft')
self.keyPressing[4]=false
end
end
@@ -283,6 +289,7 @@ function Player:act_rot180()
if self.cur then
self.ctrlCount=self.ctrlCount+2
self:spin(2)
self:_triggerEvent('hook_rot180')
self.keyPressing[5]=false
end
end