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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
[prototype]
feet_width="4"
friction="1000"
hitpoints="1"
id="thunder_melon"
mass="5"
object_level_collisions="true"
on_add_object_fail="[if(collide_with.team != team and collide_with.get_hit_by, collide_with.get_hit_by(me)), die()]"
on_bounced_on="die()"
on_change_animation_failure="fire_event('solidity_fail')"
on_change_solid_dimensions_fail="fire_event('solidity_fail')"
on_collide_level="die()"
on_collide_object_body="if(collide_with_area in ['body', 'thrown'], die())"
on_collide_object_thrown="[if(collide_with_area = 'body' and collide_with.team != team and vars.damage > 0,
[if(collide_with.get_hit_by, [collide_with.get_hit_by(me)]), die()])]"
on_die="[spawn('explosion_big_harmful',midpoint_x,midpoint_y,facing),sound('BombExplode.wav')]"
on_end_hurt_anim="animation('normal')"
on_end_normal_anim="animation('normal')"
on_enter_anim="set(tmp, 'already_hit', [])"
on_solidity_fail="if(tmp.in_solidity_fail, die(),
[set(tmp.in_solidity_fail, 1),
resolve_solid(me,0,-1,60),
resolve_solid(me,2,-1,250),
resolve_solid(me,-2,-1,250),
resolve_solid(me,0,-1,500),
set(tmp.in_solidity_fail, 0)
])"
on_spat="set(vars.has_been_spat, 1)"
on_surface_damage="die()"
springiness="100"
tags="swallowable"
timer_frequency="2"
traction="1000"
traction_in_air="1000"
zorder="0"
[consts]
basic_type="'thunder_melon'"
flinch_threshold="3"
normal_damage="1"
springiness="0"
thrown_damage="5"
[/consts]
[properties]
attack_damage="0"
attack_knockback="0"
cause_flinch="def(collide_with) execute(me, [add(me.velocity_x,me.hurt_velocity_x * sign(collide_with.midpoint_x - me.midpoint_x)),
add(me.velocity_y,me.hurt_velocity_y)])"
damage_cooldown="0"
display_hurt_visuals="def() execute(me,
[if('hurt' in available_animations,set(me.animation, 'hurt')),
hurt_flash_sequence()
])"
display_posthit_invincibility_flash_sequence="def() if(consts.posthit_invicibility_period,
map(range(consts.posthit_invicibility_period/2), 'step' ,schedule(step*2, if(step%2=0,set(alpha,50),set(alpha,255)) ) ) )"
flash_bright="def() [set(me.brightness, 1023)]"
flash_off="def() [set(me.brightness, 255),set(me.red, 255),set(me.green, 255), set(me.blue, 255)]"
flash_red="def() [set(me.red, 255),set(me.green, 100), set(me.blue, 100)]"
get_hit_by="def(collide_with) execute(me, [
if((not is_invincible) and (collide_with.attack_damage > 0) and (collide_with.attack_damage > consts.armor) and (collide_with.damage_cooldown < (cycle - vars.time_last_hit)),
[display_hurt_visuals(),
display_posthit_invincibility_flash_sequence(),
handle_flinch(collide_with),
handle_damage(collide_with),
set(vars.time_last_hit, me.cycle)]),
handle_damage_type(collide_with),
handle_knockback(collide_with)])"
handle_damage="def(collide_with) execute(me,add(me.hitpoints, - collide_with.attack_damage))"
handle_damage_type="def(collide_with) null() #virtual#"
handle_flinch="def(collide_with)
execute(me, if(collide_with.attack_damage > consts.flinch_threshold, cause_flinch(collide_with)))"
handle_knockback="def(collide_with) execute(me,add(velocity_x, collide_with.facing * collide_with.attack_knockback))"
hurt_flash_sequence="def() [ flash_bright(),
schedule(3, flash_red()),
schedule(6, flash_bright()),
schedule(9, flash_red()),
schedule(12, flash_bright()),
schedule(15, flash_off())]"
hurt_velocity_x="-200"
hurt_velocity_y="-400"
is_invincible="if(invincible or level.in_dialog or is_invincible_posthit, 1, 0)"
is_invincible_posthit="if(vars.time_last_hit and (abs(vars.time_last_hit - me.cycle) < consts.posthit_invicibility_period), 1, 0)"
[/properties]
[vars]
damage="1"
has_been_spat="0"
points_value="1"
[/vars]
[properties]
hurt_velocity_x="0"
hurt_velocity_y="0"
team="'evil'"
[/properties]
[animation]
accel_y="00"
body_area="all"
duration="1000"
frame_info="0,0,0,0,988,716,16,16"
frames="1"
id="normal"
image="compiled-2.png"
rect="988,716,1003,731"
[/animation]
[animation]
accel_y="80"
body_area="none"
duration="1000"
frame_info="0,0,0,0,988,716,16,16"
frames="1"
id="thrown"
image="compiled-2.png"
rect="988,716,1003,731"
thrown_area="all"
[/animation]
[animation]
duration="18"
frames="1"
id="hurt"
[/animation]
[editor_info]
category="plants"
[/editor_info]
[properties]
team="if(has_been_spat,'player','neutral')"
[/properties]
[/prototype]
|