Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed dropping gold on random rooms #1708

Merged
merged 3 commits into from Jul 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 18 additions & 11 deletions src/thing_shots.c
Expand Up @@ -312,8 +312,7 @@ SubtlCodedCoords process_dig_shot_hit_wall(struct Thing *thing, long blocked_fla
{
if (diggertng->creature.gold_carried > 0)
{
struct Thing* gldtng = drop_gold_pile(diggertng->creature.gold_carried, &diggertng->mappos);
diggertng->creature.gold_carried = 0;
struct Thing* gldtng;
struct Room* room;
room = get_room_xy(stl_x, stl_y);
if (!room_is_invalid(room))
Expand All @@ -322,12 +321,15 @@ SubtlCodedCoords process_dig_shot_hit_wall(struct Thing *thing, long blocked_fla
{
if (room->owner == diggertng->owner)
{
gldtng = drop_gold_pile(diggertng->creature.gold_carried, &diggertng->mappos);
diggertng->creature.gold_carried = 0;
gold_being_dropped_at_treasury(gldtng, room);
return result;
}
}
}
}
// Room pillars cannot be dug
return result;
}

// Doors cannot be dug
Expand Down Expand Up @@ -476,16 +478,21 @@ TbBool shot_hit_wall_at(struct Thing *shotng, struct Coord3d *pos)
apply_damage_to_thing(doortng, i, shotst->damage_type, -1);
} else
{
struct SlabMap* slb = get_slabmap_for_subtile(stl_num_decode_x(hit_stl_num), stl_num_decode_y(hit_stl_num));
if ( ( (old_health <= slb->health) && (slb->kind != SlbT_GEMS) ) || (!digging) )
{
efftng = create_shot_hit_effect(&shotng->mappos, shotng->owner, shotst->hit_generic.effect_model, shotst->hit_generic.sndsample_idx, shotst->hit_generic.sndsample_range);
}
else
short eff_kind = shotst->hit_generic.effect_model;
short smpl_idx = shotst->hit_generic.sndsample_idx;
unsigned char range = shotst->hit_generic.sndsample_range;
if (digging)
{
struct Thing *diggertng = thing_get(shotng->parent_idx);
efftng = create_shot_hit_effect(&diggertng->mappos, diggertng->owner, shotst->dig.effect_model, shotst->dig.sndsample_idx, shotst->dig.sndsample_range);
struct SlabMap* slb = get_slabmap_for_subtile(stl_num_decode_x(hit_stl_num), stl_num_decode_y(hit_stl_num));
if ((old_health > slb->health) || (slb->kind == SlbT_GEMS))
{
smpl_idx = shotst->dig.sndsample_idx;
range = shotst->dig.sndsample_range;
eff_kind = shotst->dig.effect_model;
}
}
efftng = create_shot_hit_effect(&shotng->mappos, shotng->owner, eff_kind, smpl_idx, range);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't the rubble go into the wall if we use shotng->mappos?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks very nice, coming from where you hit the wall instead of from where your feet are.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I noticed that the rocks sometimes go into the wall, which we don't want, surely?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nicer if the rocks fell, but the bigger rocks from destroying dirt also get stuck in neighboring dirt slabs. It seems more correct to me then rocks spawning at the feet, with further improvement possible to make effect elements not stay stuck in walls, but that's for blood splats and everything too.

I still prefer how this looks. Do you not share this view?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In instf_dig, the rocks spawn at the digger's location, though that's probably because it can't spawn anywhere else as there's technically no shot.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, and you can't really notice it anyway, since you're watching from above.


if (!shotst->hit_generic.withstand) {
destroy_shot = 1;
}
Expand Down