Skip to content
Permalink
Browse files

Added the chance for the scoop to damage items that it picks up, and …

…used the bonus attribute in the part definition to limit the volume of items picked up
  • Loading branch information...
epsilon-phase committed Aug 7, 2015
1 parent 5d5ae0c commit 7569da95f74263518c367681d722a8f6bc24da8c
Showing with 12 additions and 1 deletion.
  1. +2 −0 data/json/vehicle_parts.json
  2. +2 −0 doc/JSON_FLAGS.md
  3. +8 −1 src/vehicle.cpp
@@ -5346,6 +5346,8 @@
"durability" : 100,
"epower" : -50,
"size":400,
"bonus":10,
"damage_modifier":10,
"item" : "v_scoop_item",
"difficulty" : 1,
"flags": ["SCOOP","CARGO","OBSTACLE"],
@@ -428,6 +428,8 @@ These branches are also the valid entries for the categories of `dreams` in `dre
- ```POWER_TRANSFER``` Transmits power to and from an attached thingy (probably a vehicle)
- ```INITIAL_PART``` When starting a new vehicle via the construction menu, this vehicle part will be the initial part of the vehicle (if the used item matches the item required for this part).
- ```SCOOP``` Pulls items from underneath the vehicle to the cargo space of the part. Also mops up liquids.
- Uses the ```bonus``` tag to determine the maximum size of the item picked up
- Uses the ```damage_modifier``` tag to determine the chance of damaging the items picked up(the lower the more likely).

## Ammo

@@ -3776,6 +3776,8 @@ void vehicle::operate_scoop()
std::vector<int> scoops = all_parts_with_feature( "SCOOP" );
auto veh_points = get_points();
for( int scoop : scoops ) {
int chance_to_damage_item = parts[scoop].info().dmg_mod;
int max_pickup_size = parts[scoop].info().bonus;
const char *sound_msgs[] = {"Whirrrr", "Ker-chunk", "Swish", "Cugugugugug"};
sounds::sound( global_pos3() + parts[scoop].precalc[0], rng( 20, 35 ), sound_msgs[rng( 0, 3 )] );
for( const tripoint &position : veh_points ) {
@@ -3785,12 +3787,17 @@ void vehicle::operate_scoop()
const map_stack q = g->m.i_at( position );
size_t itemdex = 0;
for( auto it : q ) {
if( it.weight() < 10000 && it.volume() < 10 ) {
if( it.volume() < max_pickup_size ) {
break;
}
itemdex++;
}
that_item_there = g->m.item_from( position, itemdex );
if( one_in( chance_to_damage_item ) &&
that_item_there->damage < 4){//The scoop will not destroy the item, but it may damage it a bit.
that_item_there->damage += 1;
sounds::sound( position, 50, _("BEEEThump") );//The scoop gets a lot louder when breaking an item.
}
const int battery_deficit = discharge_battery( that_item_there->weight() * scoop_epower / rng( 8, 15 ) );
if( battery_deficit != 0
&& add_item( scoop, *that_item_there ) ) {

0 comments on commit 7569da9

Please sign in to comment.
You can’t perform that action at this time.