Skip to content

Commit

Permalink
Add ammoitem entrywrapper sealed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
snipercup committed Sep 19, 2023
1 parent 1d52273 commit 9d889d1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
47 changes: 45 additions & 2 deletions object_creator/item_group_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,31 @@ creator::itemGroupEntry::itemGroupEntry( QWidget* parent, QString entryText, boo
tooltipText = "The container that the item spawns in.";
tooltipText += "\nWill override the item's default container.";
containerItem_frame->setToolTip( tooltipText );


ammoItem_frame = new simple_property_widget( this, QString( "ammo-item" ),
property_type::LINEEDIT, this );
ammoItem_frame->hide();
ammoItem_frame->allow_hiding( true );
tooltipText = "Can be specified for guns and magazines in the entries ";
tooltipText += "\narray to use a non-default ammo type.";
ammoItem_frame->setToolTip( tooltipText );

entryWrapper_frame = new simple_property_widget( this, QString( "entry-wrapper" ),
property_type::LINEEDIT, this );
entryWrapper_frame->hide();
entryWrapper_frame->allow_hiding( true );
tooltipText = "Used for spawning lots of non-stackable items inside a container. ";
tooltipText += "\nInstead of creating a dedicated itemgroup for that, you can use this field to ";
tooltipText += "\ndefine that inside an entry. Note that you may want to set ";
tooltipText += "\ncontainer-item to null to override the item's default container.";
entryWrapper_frame->setToolTip( tooltipText );

sealed_frame = new simple_property_widget( this, QString( "sealed" ),
property_type::BOOLEAN, this );
sealed_frame->hide();
sealed_frame->allow_hiding( true );
tooltipText = "If true, a container will be sealed when the item spawns. Default is true.";
sealed_frame->setToolTip( tooltipText );

if( !group ) {
variant_frame = new simple_property_widget( this, QString( "variant" ),
Expand All @@ -760,7 +784,8 @@ creator::itemGroupEntry::itemGroupEntry( QWidget* parent, QString entryText, boo
"contents-item", "contents-group" } );
} else {
add_property->addItems( QStringList{ "Add property", "count", "charges", "damage",
"contents-item", "contents-group", "container-item", "variant" } );
"contents-item", "contents-group", "container-item", "ammo-item",
"entry-wrapper", "sealed", "variant" } );
}
add_property->setMaximumWidth( 120 );
connect( add_property, QOverload<int>::of( &QComboBox::activated ),
Expand All @@ -781,6 +806,9 @@ creator::itemGroupEntry::itemGroupEntry( QWidget* parent, QString entryText, boo
flowLayout->addWidget( contentsItem_frame );
flowLayout->addWidget( contentsGroup_frame );
flowLayout->addWidget( containerItem_frame );
flowLayout->addWidget( ammoItem_frame );
flowLayout->addWidget( entryWrapper_frame );
flowLayout->addWidget( sealed_frame );

//Variant only applies to items, not groups
if ( !group ) {
Expand Down Expand Up @@ -845,6 +873,12 @@ void creator::itemGroupEntry::add_property_changed() {
contentsGroup_frame->show();
} else if ( prop == "container-item" ){
containerItem_frame->show();
} else if ( prop == "ammo-item" ){
ammoItem_frame->show();
} else if ( prop == "entry-wrapper" ){
entryWrapper_frame->show();
} else if ( prop == "sealed" ){
sealed_frame->show();
} else if ( prop == "variant" ){
variant_frame->show();
}
Expand Down Expand Up @@ -900,6 +934,15 @@ void creator::itemGroupEntry::get_json( JsonOut &jo ) {
if( !containerItem_frame->isHidden() ) {
containerItem_frame->get_json( jo );
}
if( !ammoItem_frame->isHidden() ) {
ammoItem_frame->get_json( jo );
}
if( !entryWrapper_frame->isHidden() ) {
entryWrapper_frame->get_json( jo );
}
if( !sealed_frame->isHidden() ) {
sealed_frame->get_json( jo );
}
if( this->objectName() == "item" ) {
if( !variant_frame->isHidden() ) {
variant_frame->get_json( jo );
Expand Down
3 changes: 3 additions & 0 deletions object_creator/item_group_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ namespace creator
simple_property_widget* contentsItem_frame;
simple_property_widget* contentsGroup_frame;
simple_property_widget* containerItem_frame;
simple_property_widget* ammoItem_frame;
simple_property_widget* entryWrapper_frame;
simple_property_widget* sealed_frame;
simple_property_widget* damage_frame;
simple_property_widget* charges_frame;
simple_property_widget* count_frame;
Expand Down

0 comments on commit 9d889d1

Please sign in to comment.