User:TehRealSalt/Gamma

From SRB2 Wiki
Jump to navigation Jump to search

Mapping

Things

ID Name Description
1789 Bustable Wall Dynamite These objects will bust FOFs when they are destroyed. Give the bomb the same angle as the FOF linedef's tag to link them together. If multiple bombs have the same tag, they will all need destroyed to bust the FOF.

They can be used to let Gamma destroy horizontal bustable walls, or to let them destroy a normally unbustable wall to give them their own path split.

In UDMF, you would use the thing's actual tag, instead of it's angle.

1790 Extra Time Monitor When popped, gives Gamma 30 seconds of extra time. Does nothing for other characters, except in Co-op where time can be shared.

Header

Field Description Example
Lua.GammaTimeLimit Sets the length of Gamma's time limit for this map, in seconds. 0 removes the time limit. -1 uses a default time limit generated by looking at the stage's elements. Lua.GammaTimeLimit = 180 sets a 3 minute time limit.

Lua

Hooks

This is a list of custom hooks available for scripters to fine-tune Gamma's interactions with their objects. The get function can be used to retrieve the result of any of these hooks, while the set function is used to supply your own behavior. The function format gives an example of what the set function expects to receive, while allowed return values is a list of all of the valid return values of this function. These hooks can return nil to fallback to a default behavior. This default behavior has been replicated as a function for example purposes, but aren't necessary to copy into your project as returning nil does the same thing.

Get Set Function format Allowed return values Description Default behavior replicated
Gamma.GetTargetFunc(MT_ constant type) Gamma.SetTargetFunc(MT_ constant type, function func) function(mobj_t mobj, table aimList, mobj_t owner) boolean or nil Determines whenever or not the lock-on laser is able to target an object. mobj is the object that the laser is attempting to target. aimList is a table containing information on all of the targets the laser has already targeted (see also: Gamma.AimListContains). owner is the Gamma player's mobj_t that the laser is coming from.

Returning true or false sets if the laser can target this object. Returning nil falls back to the default behavior.

Note that any object with MF_NOBLOCKMAP will not be able to be locked-on, regardless of return value, because the laser uses blockmap searching to find objects efficiently.

This is used frequently by Gamma to make multi-object enemies require every piece targeted before the main body can be attacked, as well as allow them to target the new destructible decoration.

local function DefaultTargetFunc(mobj, aimList, owner)
    local canTarget = false;

	if (mo.flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_MISSILE|MF_PUSHABLE))
		canTarget = true;
	end

	if (mo.flags2 & MF2_INVERTAIMABLE)
		canTarget = (not canTarget);
	end

	return canTarget;
end
Gamma.GetDamageFunc(MT_ constant type) Gamma.SetDamageFunc(MT_ constant type, function func) function(mobj_t target, table bullet, mobj_t owner) Gamma.SHOT_EXPLODE, Gamma.SHOT_ABSORB, Gamma.SHOT_REFLECT, or nil Determines behavior when the target object is being damaged by Gamma's projectiles. bullet is the object causing the damage. It can either be a MT_GAMMA_SHOT for the bullet itself, or a MT_GAMMA_BLASTEREXPLOSION_CENTER for the Laser Blaster upgrade explosion. owner is the Gamma player's mobj_t that the bullet came from.

The return type determines the kind of death animation to give the bullet. Gamma.SHOT_EXPLODE uses the standard explosion animation. Gamma.SHOT_ABSORB makes the shot use the fizzle animation. Gamma.SHOT_REFLECT makes the bullet bounce off and flicker away. Returning nil falls back to the default behavior.

Only Gamma.SHOT_EXPLODE gives time bonuses, and spawns the Laser Blaster upgrade's explosion for the bullet itself.

This is used frequently by Gamma to control damage states, and create new unique death animations.

local function DefaultDamageFunc(target, bullet, owner)
	local pushed = false;
	if (dest.flags & MF_PUSHABLE)
	or ((mobjinfo[dest.type].flags & MF_PUSHABLE) and dest.fuse) -- Allows pushing rollout rocks while they're being ridden
		Gamma.ShotPush(dest, mo);
		pushed = true;
	end

	-- Attempt to cause damage!!
	if (dest.flags & MF_SHOOTABLE)
		-- Standard damage
		P_DamageMobj(dest, mo, owner);
		return Gamma.SHOT_EXPLODE;
	elseif (dest.flags & MF_MISSILE)
		-- Projectile clashing
		P_ExplodeMissile(dest);
		return Gamma.SHOT_EXPLODE;
	end

	if (pushed == true)
		return Gamma.SHOT_EXPLODE;
	end

	return Gamma.SHOT_ABSORB;
end
Gamma.GetPointsFunc(MT_ constant type) Gamma.SetPointsFunc(MT_ constant type, function func) function(mobj_t mobj) number >= 0, or nil Sets how many seconds this object gives. By default, this is set to scale based on the health the object spawns with for enemies (see also: Gamma.HealthToPoints), and to give no time for anything else. Returning nil falls back to this default behavior.

This is used frequently by Gamma to make specific objects give 1 second, that would otherwise give 0.

local function DefaultPointsFunc(mobj)
	if (mobj.flags & (MF_ENEMY|MF_BOSS))
		-- Combo points depends on health
		return Gamma.HealthToPoints(mobj.info.spawnhealth);
	end

	-- Does not add to combo
	return 0;
end

Useful Functions

This is a list of other useful functions for developing Gamma hooks.

Function Return values Description
Gamma.AimListContains(table aimList, mobj_t mobj) boolean Returns if an object is already being aimed at by Gamma.
Gamma.HealthToPoints(number hp) number Returns the number of seconds an enemy is meant to give for their starting health, scaled for time that multi-hit enemies would spend in MF2_FRET.