From c5e76e73f323e3e5a08b68d28f0f6babb6e8a7e7 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 24 Mar 2013 18:53:48 +0000 Subject: [PATCH] Lunatic t.: don't error on changing stat/sect of sprite not in the game world. git-svn-id: https://svn.eduke32.com/eduke32@3598 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/lunatic/con_lang.lua | 4 ++-- polymer/eduke32/source/lunatic/defs_common.lua | 8 ++++---- polymer/eduke32/source/lunatic/lunacon.lua | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/source/lunatic/con_lang.lua b/polymer/eduke32/source/lunatic/con_lang.lua index 65a9fd3b6..354b7de2b 100644 --- a/polymer/eduke32/source/lunatic/con_lang.lua +++ b/polymer/eduke32/source/lunatic/con_lang.lua @@ -454,8 +454,8 @@ for member, code in pairs(ActorLabels) do end -- Sprites set stat- and sectnum via sprite.change{stat,sect} functions. -ActorLabels.sectnum[2] = "sprite.changesect(%s,%%s)" -ActorLabels.statnum[2] = "sprite.changestat(%s,%%s)" +ActorLabels.sectnum[2] = "sprite.changesect(%s,%%s,true)" +ActorLabels.statnum[2] = "sprite.changestat(%s,%%s,true)" local PL = function(memb) return "player[%s]"..memb end -- Access to DukePlayer_t's bool members: they must be read as numbers. diff --git a/polymer/eduke32/source/lunatic/defs_common.lua b/polymer/eduke32/source/lunatic/defs_common.lua index d5e8e6b64..13ff4c43e 100644 --- a/polymer/eduke32/source/lunatic/defs_common.lua +++ b/polymer/eduke32/source/lunatic/defs_common.lua @@ -651,20 +651,20 @@ sms._nextspritestat = creategtab(ffiC.nextspritestat, ffiC.MAXSPRITES, 'nextspri sms._prevspritesect = creategtab(ffiC.prevspritesect, ffiC.MAXSPRITES, 'prevspritesect[]') sms._prevspritestat = creategtab(ffiC.prevspritestat, ffiC.MAXSPRITES, 'prevspritestat[]') -function static_members.sprite.changesect(spritenum, sectnum) +function static_members.sprite.changesect(spritenum, sectnum, noerr) check_sprite_idx(spritenum) check_sector_idx(sectnum) - if (ffiC.changespritesect(spritenum, sectnum)==-1) then + if (ffiC.changespritesect(spritenum, sectnum)==-1 and not noerr) then error("cannot change sector number of sprite not in the game world", 2) end end -function static_members.sprite.changestat(spritenum, statnum) +function static_members.sprite.changestat(spritenum, statnum, noerr) check_sprite_idx(spritenum) if (statnum >= ffiC.MAXSTATUS+0ULL) then error("invalid status number "..statnum, 2) end - if (ffiC.changespritestat(spritenum, statnum)==-1) then + if (ffiC.changespritestat(spritenum, statnum)==-1 and not noerr) then error("cannot change status number of sprite not in the game world", 2) end end diff --git a/polymer/eduke32/source/lunatic/lunacon.lua b/polymer/eduke32/source/lunatic/lunacon.lua index 2d859a929..1840e4c15 100644 --- a/polymer/eduke32/source/lunatic/lunacon.lua +++ b/polymer/eduke32/source/lunatic/lunacon.lua @@ -2165,9 +2165,9 @@ local Cinner = { canseespr = cmd(R,R,W) / "%3=_con._canseespr(%1,%2)", changespritesect = cmd(R,R) - / "sprite.changesect(%1,%2)", + / "sprite.changesect(%1,%2,true)", changespritestat = cmd(R,R) - / "sprite.changestat(%1,%2)", + / "sprite.changestat(%1,%2,true)", displayrand = cmd(W) / "%1=_con._displayrand(32767)", displayrandvar = cmd(W,D)