static
new
(
string
game_id
= ""
)
static
new
(
string
game_id
= ""
,
string
def_name
)
__gc
(
)
__eq
(
am.item
rhs
)
->
(
boolean
)
static
from_def
(
string
def_name
)
->
(
Item
)
clone
(
)
->
(
am.item
)
graphic
(
)
->
(
am.sprite
)
graphic
(
am.sprite
graphic
,
boolean
calc_size
= false
)
->
(
am.item
)
graphic
(
string
asset_name
,
boolean
calc_size
= false
)
->
(
am.item
)
ground_graphic
(
)
->
(
am.sprite
)
ground_graphic
(
am.sprite
graphic
)
->
(
am.item
)
ground_graphic
(
string
asset_name
)
->
(
am.item
)
item_type
(
)
->
(
string
)
item_type
(
string
item_type
)
->
(
am.item
)
inventory_size
(
)
->
(
integer
,
integer
)
inventory_size
(
integer
width
,
integer
height
)
->
(
am.item
)
item_location
(
)
->
(
)
item_location
(
string
location
)
->
(
am.item
)
quest_item_id
(
)
->
(
integer
)
quest_item_id
(
integer
quest_id
)
->
(
am.item
)
is_quest_item
(
)
->
(
boolean
)
item_name
(
)
->
(
string
)
item_name
(
string
name
)
->
(
am.item
)
description
(
)
->
(
string
)
description
(
string
description
)
->
(
am.item
)
prefix
(
)
->
(
string
)
prefix
(
string
prefix
)
->
(
am.item
)
postfix
(
)
->
(
string
)
postfix
(
string
postfix
)
->
(
am.item
)
item_fullname
(
)
->
(
string
)
item_fullname
(
string
main_name
,
string
prefix
= ""
,
string
postfix
= ""
)
->
(
am.item
)
set_item_from
(
am.item
other
)
->
(
am.item
)
stat_modifiers
(
)
->
(
am.stats_modifiers
)
stat_modifiers_self
(
)
->
(
am.stats_modifiers
)
width
(
)
->
(
number
)
height
(
)
->
(
number
)
name
(
)
->
(
string
)
item_value
(
)
->
(
integer
)
item_value
(
integer
value
)
->
(
am.item
)
location
(
)
->
(
number
,
number
)
location
(
number
x
,
number
y
)
->
(
am.item
)
grid_location
(
)
->
(
integer
,
integer
)
grid_location
(
integer
x
,
integer
y
)
->
(
am.item
)
game_id
(
number
x
,
number
y
)
->
(
am.item
)
game_id
(
integer
x
,
integer
y
)
->
(
am.item
)
game_id
(
string
id
)
->
(
boolean
)
game_id
(
am.game_object
talkee
)
->
(
boolean
)
game_id
(
)
->
(
boolean
)
game_id
(
boolean
fixed
)
->
(
am.item
)
game_id
(
)
->
(
am.map
)
game_id
(
am.map
map
)
->
(
am.item
)
game_id
(
)
->
(
am.map
)
game_id
(
am.map
map
)
->
(
am.item
)
game_id
(
am.tile_type
tile_type
)
->
(
am.item
)
game_id
(
string
tile_type_name
)
->
(
am.item
)
game_id
(
am.tile_type
tile_type
)
->
(
am.item
)
game_id
(
)
->
(
am.item
)
game_id
(
am.tile_type
tile_type
)
->
(
boolean
)
game_id
(
)
->
(
table
)
game_id
(
)
->
(
am.dialogue_component
)
game_id
(
am.dialogue_component
comp
,
boolean
set_attached
= true
)
->
(
)
game_id
(
)
->
(
string
)
game_id
(
string
game_id
)
->
(
boolean
)
interact_with
(
)
->
(
function
)
interact_with
(
function
func
)
->
(
am.item
)
interact_dialogue
(
am.game_object
interacter
,
bool
by_movement
)
->
(
am.code
)
on
(
string
event_type
,
function
listener
,
table
content
= nil
)
->
(
boolean
)
off
(
string
event_type
,
function
listener
,
table
context
= nil
)
->
(
boolean
)
has_event_listener
(
string
event_type
)
->
(
boolean
)
static
find
(
string
game_id
)
->
(
am.item
)
attrs
(
boolean
create_table
= false
)
->
(
am.data_table
)
attrs
(
am.data_table
attr_table
)
->
(
am.item
)
add_body_type
(
string
part_type
)
->
(
am.item
)
remove_body_type
(
string
part_type
)
->
(
am.item
)
has_body_type
(
string
part_type
)
->
(
boolean
)
get_body_types
(
)
->
(
table
)
static
new
(
string
game_id
= ""
)
static
new
(
string
game_id
= ""
,
string
def_name
)
__gc
(
)
__eq
(
am.item
rhs
)
->
(
boolean
)
static
from_def
(
string
def_name
)
->
(
Item
)
Example (a test map Lua file):
item = am.item.from_def("wooden:sword") if (item ~= nil) item:name("Fred's Sword") end
In "data/defs/wooden.lua":
game = am.engine.game() item = am.item.new() item:item_type("sword") :graphic(am.sprite.new("item/sword")) :groundGraphic(am.sprite.new("item/swordGround")) -- Here the npc is registered with the name "sword" and "wooden:" will -- automatically be prepended because of the filename. game:item_def("sword", item)
clone
(
)
->
(
am.item
)
graphic
(
)
->
(
am.sprite
)
graphic
(
am.sprite
graphic
,
boolean
calc_size
= false
)
->
(
am.item
)
graphic
(
string
asset_name
,
boolean
calc_size
= false
)
->
(
am.item
)
ground_graphic
(
)
->
(
am.sprite
)
ground_graphic
(
am.sprite
graphic
)
->
(
am.item
)
ground_graphic
(
string
asset_name
)
->
(
am.item
)
item_type
(
)
->
(
string
)
item_type
(
string
item_type
)
->
(
am.item
)
inventory_size
(
)
->
(
integer
,
integer
)
inventory_size
(
integer
width
,
integer
height
)
->
(
am.item
)
item_location
(
)
->
(
)
item_location
(
string
location
)
->
(
am.item
)
quest_item_id
(
)
->
(
integer
)
quest_item_id
(
integer
quest_id
)
->
(
am.item
)
is_quest_item
(
)
->
(
boolean
)
item_name
(
)
->
(
string
)
item_name
(
string
name
)
->
(
am.item
)
description
(
)
->
(
string
)
description
(
string
description
)
->
(
am.item
)
prefix
(
)
->
(
string
)
prefix
(
string
prefix
)
->
(
am.item
)
postfix
(
)
->
(
string
)
postfix
(
string
postfix
)
->
(
am.item
)
item_fullname
(
)
->
(
string
)
item_fullname
(
string
main_name
,
string
prefix
= ""
,
string
postfix
= ""
)
->
(
am.item
)
set_item_from
(
am.item
other
)
->
(
am.item
)
stat_modifiers
(
)
->
(
am.stats_modifiers
)
stat_modifiers_self
(
)
->
(
am.stats_modifiers
)
width
(
)
->
(
number
)
height
(
)
->
(
number
)
name
(
)
->
(
string
)
item_value
(
)
->
(
integer
)
item_value
(
integer
value
)
->
(
am.item
)
location
(
)
->
(
number
,
number
)
location
(
number
x
,
number
y
)
->
(
am.item
)
grid_location
(
)
->
(
integer
,
integer
)
grid_location
(
integer
x
,
integer
y
)
->
(
am.item
)
game_id
(
number
x
,
number
y
)
->
(
am.item
)
game_id
(
integer
x
,
integer
y
)
->
(
am.item
)
game_id
(
string
id
)
->
(
boolean
)
game_id
(
am.game_object
talkee
)
->
(
boolean
)
game_id
(
)
->
(
boolean
)
game_id
(
boolean
fixed
)
->
(
am.item
)
game_id
(
)
->
(
am.map
)
game_id
(
am.map
map
)
->
(
am.item
)
game_id
(
)
->
(
am.map
)
game_id
(
am.map
map
)
->
(
am.item
)
game_id
(
am.tile_type
tile_type
)
->
(
am.item
)
game_id
(
string
tile_type_name
)
->
(
am.item
)
game_id
(
am.tile_type
tile_type
)
->
(
am.item
)
game_id
(
)
->
(
am.item
)
game_id
(
am.tile_type
tile_type
)
->
(
boolean
)
game_id
(
)
->
(
table
)
game_id
(
)
->
(
am.dialogue_component
)
game_id
(
am.dialogue_component
comp
,
boolean
set_attached
= true
)
->
(
)
game_id
(
)
->
(
string
)
game_id
(
string
game_id
)
->
(
boolean
)
interact_with
(
)
->
(
function
)
interact_with
(
function
func
)
->
(
am.item
)
interact_dialogue
(
am.game_object
interacter
,
bool
by_movement
)
->
(
am.code
)
did_interact | Interaction occured, perform no further actions. |
did_not_interact | Interaction did not occur, can perform further actions. |
do_not_interact | Interaction did not occur, but do not perform any further actions. |
on
(
string
event_type
,
function
listener
,
table
content
= nil
)
->
(
boolean
)
item:on("talkTo", function(event) am_log("Character talked to") end)
off
(
string
event_type
,
function
listener
,
table
context
= nil
)
->
(
boolean
)
function talkToOnce(event) am_log("Character talked to once") item:off("talkTo", talkToOnce) end item:on("talkTo", talkToOnce)
has_event_listener
(
string
event_type
)
->
(
boolean
)
static
find
(
string
game_id
)
->
(
am.item
)
attrs
(
boolean
create_table
= false
)
->
(
am.data_table
)
attrs
(
am.data_table
attr_table
)
->
(
am.item
)
add_body_type
(
string
part_type
)
->
(
am.item
)
remove_body_type
(
string
part_type
)
->
(
am.item
)
has_body_type
(
string
part_type
)
->
(
boolean
)
get_body_types
(
)
->
(
table
)