1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
[object_type]
id=gate
zorder=-8
has_feet=no
always_active=yes
solid_dimensions=player,common,~thrown
collide_dimensions="key"
adjust_feet_on_animation_change=false
[editor_info]
category=props
[var]
name=is_locked
value="0"
type=boolean
[/var]
[/editor_info]
timer_frequency=5
#if we fail to change the animation like we desire, we revert to our
#previous animation, and then schedule another attempt to change the
#animation next cycle.
on_change_animation_failure="[animation(previous_animation), schedule(1, animation(animation))]"
on_create="[if(is_locked, animation('locked'), animation('unlocked')), spawn('gate_porticullis', midpoint_x, midpoint_y, facing, [set_var('is_locked', vars.is_locked), set_var('desired_y',y-120), set_var('desired_y2',y), set_var('origin_y',y)]), spawn('gate_overlay',midpoint_x,midpoint_y,facing)]"
on_end_locked_anim="if(is_locked,animation('locked'),[animation('opening'), fire_event( vars.porticullis,'unlock'),sound('DoorShut.ogg')])"
on_end_unlocked_anim="if(is_locked,[animation('closing'),fire_event( vars.porticullis,'lock'),sound('DoorShut.ogg')],animation('unlocked'))"
on_end_closing_anim="animation('locked')"
on_end_opening_anim="animation('unlocked')"
on_lock="set(is_locked,1)"
on_unlock="set(is_locked,0)"
on_button_pressed="fire_event('unlock')"
on_button_released="fire_event('lock')"
on_child_spawned="switch(child.type,
'gate_porticullis', set(vars.porticullis, child) )"
[base:animation]
image=props/gate.png
pad=3
gate_area=all
[/animation]
[animation]
id=locked
solid_area=7,20,21,85
rect=2,2,39,104
frames=1
duration=30
[/animation]
[animation]
id=opening
solid_area=7,20,21,40
rect=2,2,39,104
frames=1
duration=28
[/animation]
[animation]
id=closing
solid_area=7,20,21,40
rect=2,2,39,104
frames=1
duration=24
play_backwards=yes
[/animation]
[animation]
id=unlocked
solid_area=7,20,21,30
rect=2,2,39,104
frames=1
duration=30
[/animation]
[/object_type]
|