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

Easy way to change inventory textures #364

Open
selinanatschke opened this issue Jul 10, 2023 · 0 comments
Open

Easy way to change inventory textures #364

selinanatschke opened this issue Jul 10, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@selinanatschke
Copy link

Please make sure you talk to the community before creating an issue.

Is your feature request related to a problem? Please describe.
It is not related to a problem.

Describe the solution you'd like
I would like to suggest that you can also choose animated sprites for inventory items. This way it would be easy to change their texture as you can do it already with different textures for normal ESCItems.

Describe alternatives you've considered
I programmed with your help a new command that changes the inventory texture, but it only works if you remove the item before calling the command and adding it again to the inventory afterwards.

Additional context
I'll provide my code:

to call the command:
set_item_inventory_texture smartphone "res://items/smartphone/score_textures/score_2.png" inventory_add smartphone say mannequin "Oh wir können jetzt unseren Score sehen"

the script:
`extends ESCBaseCommand
class_name SetItemInventoryTextureCommand

func configure() -> ESCCommandArgumentDescriptor:
return ESCCommandArgumentDescriptor.new(
2,
[TYPE_STRING, TYPE_STRING],
[null, null]
)

func validate(arguments: Array) -> bool:
if not escoria.object_manager.has(arguments[0]):
escoria.logger.report_errors(
"change_texture: invalid item",
["Item %s not registered" % arguments[0]]
)
return false

return .validate(arguments)

func run(command_params: Array) -> int:
var item_id = command_params[0]
var texture_path = command_params[1]

var item = escoria.object_manager.get_object(item_id)
if item != null:
	item.node.inventory_texture = load(texture_path)
	return ESCExecution.RC_OK

escoria.logger.report_errors(
	self,
	"Item %s not found" % item_id
)
return ESCExecution.RC_FAIL

`

@selinanatschke selinanatschke added the enhancement New feature or request label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant