Lunatic: add example toggling forcefield wall to test.lua.

git-svn-id: https://svn.eduke32.com/eduke32@4224 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-12-28 17:04:18 +00:00
parent aa37d8c82f
commit 2442b107f7
2 changed files with 26 additions and 5 deletions

View file

@ -566,10 +566,12 @@ spr.cstat = CS.TRANS1 + CS.BLOCK
----------
one could proceed as follows for the sake of example:
* `spr.cstatbits:set(CS.TRANS2)`, make the sprite 66% translucent now
* `spr.cstatbits:flip(CS.BLOCK + CS.HITSCAN)`, make it hitscan-sensitive but
not blocking
* `spr.cstatbits:test(CS.FLIP_BITMASK)`, check whether it is flipped (no)
[source]
----------
spr.cstatbits:set(CS.TRANS2) -- make the sprite 66% translucent now
spr.cstatbits:flip(CS.BLOCK + CS.HITSCAN) -- make it hitscan-sensitive and non-blocking
local isflipped = spr.cstatbits:test(CS.FLIP_BITMASK) -- is it x- or y-flipped? (no)
----------
==========
Engine-side composites

View file

@ -18,6 +18,8 @@ local hitscan = hitscan
local assert, error, print, tostring = assert, error, print, tostring
local D = require("CON.DEFS")
print('---=== ELua Test script ===---')
local function printf(fmt, ...)
@ -108,6 +110,24 @@ gameevent
end
}
gameevent
{
"JUMP",
function()
print("tweaking forcefield with lotag 34 (E2L1)")
for w=0,gv.numwalls-1 do
local wal = wall[w]
if (wal.overpicnum == D.W_FORCEFIELD or wal.overpicnum == D.W_FORCEFIELD+1) then
if (wal.lotag==34) then
wal.cstat = wal.cstatbits:test(85) and 0 or 85
end
end
end
end
}
local unsafe = pcall(function() string.UNSAFE=true; end)
checkfail("tostring = nil", "attempt to write into the global environment")
@ -252,7 +272,6 @@ gameevent
}
--]]
local D = require("CON.DEFS")
local WEAPON = gv.WEAPON
-- Bad hack to test out pitch/roll: EVENT_GAME is discouraged from Lunatic.