Skip to content

Commit

Permalink
Moved where we call empty_stomach, and made whether it kills the stom…
Browse files Browse the repository at this point in the history
…ach contents a function parameter.
  • Loading branch information
rkettering committed Jul 2, 2015
1 parent 7c3e96f commit a5f57f1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion data/object_prototypes/door.cfg
Expand Up @@ -10,7 +10,7 @@ properties: {
if(possible_key is obj padlock_key,
if(lock.color = possible_key.color,
[fire_event(lock, 'unlock'),
if(frogatto.swallowed_object != null and frogatto.swallowed_object = possible_key, frogatto.empty_stomach, remove_object(possible_key))]))) where frogatto = (obj frogatto_playable <- level.player)",
if(frogatto.swallowed_object != null and frogatto.swallowed_object = possible_key, frogatto.empty_stomach({kill_contents: true}), remove_object(possible_key))]))) where frogatto = (obj frogatto_playable <- level.player)",


_player_opened: { type: "bool", default: false, persistent: false },
Expand Down
30 changes: 19 additions & 11 deletions data/objects/playable/frogatto_playable.cfg
Expand Up @@ -331,26 +331,33 @@ properties: {

super_acidshot_fire_projectile: "commands :: spawn('${self.type}.super_acidshot', mid_x, mid_y, facing)",

shoot_spit_attack: "commands :: [if(not animation = 'spit', [animation('spit'), schedule(8, [spit_attack_fire_projectile,set(is_currently_fat, false),set(variations, [])]) ]),
]",
shoot_spit_attack: "commands :: if(not animation = 'spit', [animation('spit'), schedule(8, spit_attack_spew_projectile)])",

empty_stomach: "commands :: [set(is_currently_fat, false),set(variations, []), set(swallowed_object, null)]",
empty_stomach: "def({kill_contents: bool} a) -> commands
[
set(is_currently_fat, false),
set(variations, []),
if(underwater, set(has_feet, false)),
set(swallowed_object, null),
if(a.kill_contents, set(swallowed_object.hitpoints, 0))
] asserting swallowed_object is obj throwable | {message:q(swallowed_object is allowed to be null most of the time, but we definitely want a runtime error if we're ever trying to empty the player's stomach, and we've somehow managed to get in a state where there's actually nothing in there.)}",

spit_attack_fire_projectile: "commands ::
spit_attack_spew_projectile: "commands ::
if(swallowed_object,
[if(swallowed_object.type = 'padlock_key', standard_spit_attack,
switch( ability_list[current_ability],
'firebreath', if(ability_is_charged_up('super_fireball'),
[super_fireball_fire_projectile, use_mana_for_ability('super_fireball'), set(swallowed_object, null), do_sound],
[super_fireball_fire_projectile, use_mana_for_ability('super_fireball'), set(swallowed_object, null), do_sound, empty_stomach({kill_contents: true})],
standard_spit_attack),
'energyshot', if(ability_is_charged_up('super_energyshot'),
[super_energyshot_fire_projectile, use_mana_for_ability('super_energyshot'), set(swallowed_object, null), do_sound],
[super_energyshot_fire_projectile, use_mana_for_ability('super_energyshot'), set(swallowed_object, null), do_sound, empty_stomach({kill_contents: true})],
standard_spit_attack),
'homingshot', if(ability_is_charged_up('super_homingshot'),
[super_homingshot_fire_projectile, use_mana_for_ability('super_homingshot'), set(swallowed_object, null), do_sound],
[super_homingshot_fire_projectile, use_mana_for_ability('super_homingshot'), set(swallowed_object, null), do_sound, empty_stomach({kill_contents: true})],
standard_spit_attack),
'acidbreath', if(ability_is_charged_up('super_acidshot'),
[super_acidshot_fire_projectile, use_mana_for_ability('super_acidshot'), set(swallowed_object, null), do_sound],
[super_acidshot_fire_projectile, use_mana_for_ability('super_acidshot'), set(swallowed_object, null), do_sound, empty_stomach({kill_contents: true})],
standard_spit_attack),
'tongue', standard_spit_attack))
Expand All @@ -375,7 +382,8 @@ properties: {
add_object(swallowed_object),
fire_event(swallowed_object, 'spat'),
if(underwater, set(has_feet, false)),
empty_stomach({kill_contents: false}),
map(filter(level.active_chars, value is obj standing_npc), if(can_see(me,value), commands<- eval(value.consider_object, {me: value, obj: swallowed_object, level: level}))),
],
Expand All @@ -395,8 +403,8 @@ properties: {
asserting item_name != '' | {message:'Attempting to set an item in inventory, but the item type given is an empty string.', name:item_name, count:count}",

do_key_check: "commands :: if(swallowed_object is obj padlock_key, if( size(swallowed_object.valid_levels) > 0, if(not level.id in swallowed_object.valid_levels,
[set(me.variations, []), set(me.swallowed_object, null),transient_speech_dialog(250, level.player, [~I better put this key back where it came from.~]),
empty_stomach]
[transient_speech_dialog(250, level.player, [~I better put this key back where it came from.~]),
empty_stomach({kill_contents: true})]
)))",
#-------------------------- movement commands --------------------------#

Expand Down
2 changes: 1 addition & 1 deletion data/objects/props-interactive/misc/treasure_chest.cfg
Expand Up @@ -14,7 +14,7 @@ properties: {
if(possible_key is obj padlock_key,
if(lock.color = possible_key.color,
[fire_event(lock, 'unlock'),
if(frogatto.swallowed_object != null and frogatto.swallowed_object = possible_key, frogatto.empty_stomach, remove_object(possible_key))]))) where frogatto = (obj frogatto_playable <- level.player)",
if(frogatto.swallowed_object != null and frogatto.swallowed_object = possible_key, frogatto.empty_stomach({kill_contents: true}), remove_object(possible_key))]))) where frogatto = (obj frogatto_playable <- level.player)",

treasure_already_taken: "bool :: (level.player.get_stored_event(event_name) = 1)",

Expand Down

0 comments on commit a5f57f1

Please sign in to comment.