User:Monster Iestyn/Lua scripting tutorial/Freeslots and Object resources

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.

Declaring freeslots in Lua

SOC-style definition Lua-style definition
Freeslot
MT_OBJECTTYPE
S_STATENAME
SPR_SPRT
sfx_custom
freeslot(
"MT_OBJECTYPE",
"S_STATENAME",
"SPR_SPRT",
"sfx_custom"
)

Object types

SOC-style definition Lua-style definition (longhand) Lua-style definition (shorthand)
Object MT_PLAYER
MapThingNum = -1
SpawnState = S_PLAY_STND
SpawnHealth = 1
SeeState = S_PLAY_RUN1
SeeSound = sfx_None
ReactionTime = 0
AttackSound = sfx_thok
PainState = S_PLAY_PAIN
PainChance = MT_THOK
PainSound = sfx_None
MeleeState = S_NULL
MissileState = S_PLAY_ATK1
DeathState = S_PLAY_DIE
XDeathState = S_NULL
DeathSound = sfx_None
Speed = 1
Radius = 16*FRACUNIT
Height = 48*FRACUNIT
DispOffset = 0
Mass = 1000
Damage = MT_THOK
ActiveSound = sfx_None
Flags = MF_SOLID|MF_SHOOTABLE
RaiseState = MT_THOK
mobjinfo[MT_PLAYER] = {
        doomednum = -1,
        spawnstate = S_PLAY_STND,
        spawnhealth = 1,
        seestate = S_PLAY_RUN1,
        seesound = sfx_None,
        reactiontime = 0,
        attacksound = sfx_thok,
        painstate = S_PLAY_PAIN,
        painchance = MT_THOK,
        painsound = sfx_None,
        meleestate = S_NULL,
        missilestate = S_PLAY_ATK1,
        deathstate = S_PLAY_DIE,
        xdeathstate = S_NULL,
        deathsound = sfx_None,
        speed = 1,
        radius = 16*FRACUNIT,
        height = 48*FRACUNIT,
        dispoffset = 0,
        mass = 1000,
        damage = MT_THOK,
        activesound = sfx_None,
        flags = MF_SOLID|MF_SHOOTABLE,
        raisestate = MT_THOK
}
mobjinfo[MT_PLAYER] = {
	-1,
	S_PLAY_STND,
	1,
	S_PLAY_RUN1,
	sfx_None,
	0,
	sfx_thok,
	S_PLAY_PAIN,
	MT_THOK,
	sfx_None,
	S_NULL,
	S_PLAY_ATK1,
	S_PLAY_DIE,
	S_NULL,
	sfx_None,
	1,
	16*FRACUNIT,
	48*FRACUNIT,
	0,
	1000,
	MT_THOK,
	sfx_None,
	MF_SOLID|MF_SHOOTABLE,
	MT_THOK
}

States

SOC-style definition Lua-style definition (longhand) Lua-style definition (shorthand)
State S_FLAMEJETFLAMEB1
SpriteName = DFLM
SpriteFrame = FF_FULLBRIGHT|TR_TRANS40|B
Duration = 1
Action = A_MoveRelative
Var1 = 0
Var2 = 5
Next = S_FLAMEJETFLAMEB2
states[S_FLAMEJETFLAMEB1] = {
        sprite = SPR_DFLM,
        frame = FF_FULLBRIGHT|TR_TRANS40|B,
        tics = 1,
        action = A_MoveRelative,
        var1 = 0,
        var2 = 5,
        nextstate = S_FLAMEJETFLAMEB2
}
states[S_FLAMEJETFLAMEB1] = {SPR_DFLM, FF_FULLBRIGHT|TR_TRANS40|B, 1, A_MoveRelative, 0, 5, S_FLAMEJETFLAMEB2}

Sounds

SOC-style definition Lua-style definition (longhand) Lua-style definition (shorthand)
Sound sfx_rumble
Singular = 0
Priority = 64
Flags = SF_X4AWAYSOUND|SF_X8AWAYSOUND
sfxinfo[sfx_rumble] = {
        singular = false,
        priority = 64,
        flags = SF_X4AWAYSOUND|SF_X8AWAYSOUND
}
sfxinfo[sfx_rumble] = {false, 64, SF_X4AWAYSOUND|SF_X8AWAYSOUND}