SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > SRB2 Discussion > Bug Reports

Closed Thread
 
Thread Tools Search this Thread
Old 04-09-2016   #1
FuriousFox
AKA FuriousFox
Developer
 
FuriousFox's Avatar
Default [Fixed for 2.2] A_Boss1Laser doesn't work properly when set by Lua

1. Load the attached Lua file (test.lua)
2. Go to MAP03 (Greenflower Zone, Act 3)
3. Wait for the boss to fire

Expected Result:
Boss should fire a laser along the ground that rises towards the player.

Actual Result:
Boss fires laser directly into the ground. On subsequent attacks, the boss fires directly at the player.

Note:
The settings in the Lua file are the default settings for those two states, as stated by info.c and the SRB2 Wiki. Using SOCs works fine, it just seems to be Lua that's having a problem.
Attached Files
File Type: lua test.lua (448 Bytes, 90 views)

Last edited by Monster Iestyn; 2 Weeks Ago at 07:16 PM.
FuriousFox is offline  
Old 04-11-2016   #2
FuriousFox
AKA FuriousFox
Developer
 
FuriousFox's Avatar
Default

After testing it a little further, it looks like it only fires for one tic, and MT_EGGMOBILE_TARGET doesn't spawn on subsequent attacks. Not sure why, though.

Last edited by FuriousFox; 04-11-2016 at 01:23 AM.
FuriousFox is offline  
Old 04-11-2016   #3
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

That sounds very strange indeed. Any idea if anything weird could be going on with MT_EGGMOBILE_TARGET the first time?

BTW A_Boss1Laser is a weird action that is run for every single tic the state that called it lasts, through some MF2_FIRING hack or something. In case it helps to know these things.
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.
Monster Iestyn is offline  
Old 04-11-2016   #4
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Wait, hang on a sec, what happens if you put quotation marks around A_Boss1Laser in the Lua script? Just checked lua_infolib.c (the source code file where Lua handles state/mobjinfo modification) and I think I suspect what's going on here now.
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.
Monster Iestyn is offline  
Old 04-11-2016   #5
FuriousFox
AKA FuriousFox
Developer
 
FuriousFox's Avatar
Default

Huh, that actually works. A bunch of other functions I've been using work without quotations, though.
FuriousFox is offline  
Old 04-11-2016   #6
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

Yeah, that's it then. Supplying one of the names for actions that already exist as a string actually makes the game look for the action function that goes with that string. Supplying anything else (whether it be a custom function or a pre-existing C function) will make Lua think you're supplying a custom Lua action of some sort, which is handled by some special source-code exclusive action called "A_Lua". This action then runs whatever function you supplied as the state's action when it is called on changing state. However, this causes the code to run A_Boss1Laser again and again for the rest of the state to fail, since the state's action is now A_Lua and not A_Boss1Laser directly!

No other action in the source code needs to be run for the rest of the state's duration like A_Boss1Laser does, this is why A_Boss1Laser is the only one that fails without quote marks. =V

EDIT: If that was too much to read, have this instead: when you supply names for actions without quote marks, the state's action actually becomes A_Lua, which in turn runs the action. A_Boss1Laser's code for running after the state's first tic requires the state's action to actually BE A_Boss1Laser, which is where the problems come from.
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.

Last edited by Monster Iestyn; 04-11-2016 at 01:38 PM.
Monster Iestyn is offline  
Old 04-11-2016   #7
JTE
 
JTE's Avatar
Default

Sorry for the inconvenience, FuriousFox. You happened upon a previously undiscovered edge case consequence of my crazy programming. We'll figure out how to fix it for the next version, for now the quotation marks workaround will suffice.
__________________
<Chimera> jte you're scaring me <Chimera> jte stop <Mystic> too much catnip
JTE is offline  
Old 2 Weeks Ago   #8
Monster Iestyn
Friendly Neighbour-Hood
Moderator
 
Monster Iestyn's Avatar
Default

This has been fixed for 2.2, just so you guys know. =P
__________________
My page stuffed full of MIDI goodness!
The Hitchhiker's Guide to the Robo-Hoodiverse
Timeline of Sonic Robo Blast History!

That's an uppercase i, not a lowercase L, for the record.
Monster Iestyn is offline  
Closed Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:29 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.