Allow des.object "trapped" field to be a boolean
I thought there were more object fields that currently only accept ints but ought to accept booleans, but when I checked I found that most of them do already, and the ones that take ints are the ones that the number carries meaning (spe, recharged, etc). Except for trapped. In struct obj, otrapped is a 1-bit flag, so there's no good reason for the level parser to treat it as a type error if someone intuitively makes a des.object call with trapped=true or trapped=false. Change it to an optional boolean argument, like the other boolean flags (locked, greased, etc). Note that get_table_boolean_opt still accepts ints, so existing uses of trapped=0 or trapped=1 won't be affected.
This commit is contained in:
@@ -3557,7 +3557,7 @@ lspo_object(lua_State *L)
|
||||
tmpobj.lit = get_table_boolean_opt(L, "lit", 0);
|
||||
tmpobj.eroded = get_table_int_opt(L, "eroded", 0);
|
||||
tmpobj.locked = get_table_boolean_opt(L, "locked", -1);
|
||||
tmpobj.trapped = get_table_int_opt(L, "trapped", -1);
|
||||
tmpobj.trapped = get_table_boolean_opt(L, "trapped", -1);
|
||||
tmpobj.recharged = get_table_int_opt(L, "recharged", 0);
|
||||
tmpobj.greased = get_table_boolean_opt(L, "greased", 0);
|
||||
tmpobj.broken = get_table_boolean_opt(L, "broken", 0);
|
||||
|
||||
Reference in New Issue
Block a user