HELP coffee machine

Discussion about Mods for Prison Architect

Moderator: NBJeff

DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sat Oct 24, 2015 12:06 am

aubergine18 wrote:Yes, you can define multiple slots on a 1x1 or any size object. I'm not sure if there are limitations in respect to proximity of slots.

If you're using base-game sprite (defined in objects.spritebank and the image either in objects.png or people.png) then you're in for a world of pain when it comes to customising anything to do with the sprite or it's slot markers; namely you'll have to clone the whole objects.spritebank file to your mod - you then get three major problems:

1. Only one mod at a time can replace objects.spritebank - so your mod will conflict with any others that do the same
2. As Trixi found recently, if multiple active mods try to change objects.spritebank it can cause game crash
3. If a game update changes the vanilla objects.spritebank the altered version in your mod will be out of sync with the base game

That being said, I still don't see why having two slots in same place would cause a problem - that would in theory only change the way things look on screen, but shouldn't affect the game data as to what can go in each slot.

Can you upload your mod to github.com so I can take a proper look at it all in one place and send pull requests if I spot any errors?


You cant have 2 slots used at same time in a 1by1 item (im using default drink machine sprite)... its kinda stupid...

I changed W to 2 and SpriteScale to 0.5 and it works

* How do i move the sprite down a little?
* How do i change slots position?
* When i rotate the object the W2H1 remains?!?
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: HELP coffee machine

Postby aubergine18 » Sat Oct 24, 2015 12:40 am

I'm still documenting markers, but seeing as you are using a sprite from the base game you'll need to clone objects.spritebank (this will make your mod highly incompatible with other mods that do the same), Here is the documentation I have so far on markers in that file:

https://github.com/aubergine10/Prison-A ... nk#markers
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sat Oct 24, 2015 2:28 pm

aubergine18 wrote:I'm still documenting markers, but seeing as you are using a sprite from the base game you'll need to clone objects.spritebank (this will make your mod highly incompatible with other mods that do the same), Here is the documentation I have so far on markers in that file:

https://github.com/aubergine10/Prison-A ... nk#markers


Im kinda confused.

Im drawing my own machine in file sprites.png

inside materials.txt i have

Code: Select all

BEGIN Object     
    Name                 DECoffeeMachine
    Width                2
    Height               1
    ConstructionTime     5.0
    Toughness            20.0
    MoveSpeedFactor      0.3
    Price                -1500
    NumSlots             2
    AttachToWall         true
    Group                StaticObject
    BlockedBy            Wall
    BlockedBy            StaticObject
    BlockedBy            UtilityStation
    SpriteScale          1.0
    ToolbarSprite        DrinkMachineToolbar
    RenderDepth          1
    MadeOf               Composite
    Properties           StaticObject
   Properties           Scripted
    Research             PrisonLabour
    AutoOrder            DECoffeeBox
    AutoOrderQuantity    30
   
    BEGIN  Sprite
       x 0
       y 0
       w 3
       h 3
       RotateType 3
    END
END


It kinda works. my problem is that the Width 2 and Height 1 should be
* W1H2 when the machine is facing N or S
* W2H1 when the machine is facing W or E

However the machine always ocuppy W2H1 in all rotations.

About the slot markers? Their definded inside the BEGIN Object ?
I want 2 slots, machine is W2. I want slot0 inside the first tile and slot1 inside the second.
Can you give me an example?

Edited:
The snack version
Still need to replace the yellow squares with snacks image.

Image

Once i finish everything im gonna add some kind of lightning effect to the images.
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: HELP coffee machine

Postby aubergine18 » Sat Oct 24, 2015 7:07 pm

The markers get defined inside the "BEGIN Sprite ... " block, eg. on the line after RotateType. Check out my Circuit Isolator mod where the main cabinet defines 3 markers.

As for the rotation issue, try RotateType 1 (which rotates around horizontal axis; RotateType 3 rotates around the vertical axis).
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sat Oct 24, 2015 8:30 pm

aubergine18 wrote:The markers get defined inside the "BEGIN Sprite ... " block, eg. on the line after RotateType. Check out my Circuit Isolator mod where the main cabinet defines 3 markers.

As for the rotation issue, try RotateType 1 (which rotates around horizontal axis; RotateType 3 rotates around the vertical axis).


Code: Select all

        BEGIN Marker
            x               2.140625
            y               2.9375
            orientation.x   0
            orientation.y   -1
            Index           0
        END
        BEGIN Marker
            x               1.050000
            y               1.00000
            orientation.x   0
            orientation.y   0
            Index           1
        END
        BEGIN Marker
            x               2.550000
            y               1.00000
            orientation.x   0
            orientation.y   0
            Index           2
        END
        BEGIN Marker
            x               3.480000
            y               1.00000
            orientation.x   0
            orientation.y   0
            Index           3
        END


Each marker sets lthe location of each slot (since ur cicuit isolator have 4 slots)
OR
Each marker sets the location based on rotation? N, S, E and W?
X and y is the offset distance from the center of object?
Orientation ? Rotation of the slot?
Index? No idea what this is
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: HELP coffee machine

Postby aubergine18 » Sat Oct 24, 2015 10:58 pm

The "Index" within a marker is the slot number (first slot is 0, so marker with Index 0 relates to that slot).

The x and y of a marker is the offset from the origin of the sprite ( in my case the sprite origin is roughly the middle of the main cabinet ). In other words, this sets the position of the slot marker in relation to your object. In theory you can even put the slot marker outside your object, but I've not tested that.

The orientation defines which way something will face when in or using the slot. x>0 = face north, x<0 = face south, y>0 = face east, y<0 = face west. See this guide for more infos: http://chadsmods.rdkf.net/how-to-use-ma ... ientation/
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sat Oct 24, 2015 11:30 pm

aubergine18 wrote:The "Index" within a marker is the slot number (first slot is 0, so marker with Index 0 relates to that slot).

The x and y of a marker is the offset from the origin of the sprite ( in my case the sprite origin is roughly the middle of the main cabinet ). In other words, this sets the position of the slot marker in relation to your object. In theory you can even put the slot marker outside your object, but I've not tested that.

The orientation defines which way something will face when in or using the slot. x>0 = face north, x<0 = face south, y>0 = face east, y<0 = face west. See this guide for more infos: http://chadsmods.rdkf.net/how-to-use-ma ... ientation/


Thats what i have done... and it looks good with first rotation only...

object is 2w and 1h
0 slot in left side
1 slot in left right side

default rotation

Facing south:

Code: Select all

SS
01


Facing north:

Code: Select all

01
NN


Facing east:

Code: Select all

E
E01


Facing west:

Code: Select all

  E
01E


the slot position and the offset x,y doesn't seem to reverse between N/S or W/E

Code: Select all

y -0.3

When the item is facing south this moves the slot 0.3 up...
when the item is facing north this still moves the slot 0.3 up... it should be reversed O.o
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: HELP coffee machine

Postby aubergine18 » Sun Oct 25, 2015 12:02 am

I've no idea why it does that. My sprite isn't rotatable so I never ran in to that problem. I'd suggest looking at Chad's Drinks Mod as I'm pretty sure he had things with slots that could be rotated and hopefully there will be something in his mod that shows how to solve the problem.
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sun Oct 25, 2015 12:13 am

aubergine18 wrote:I've no idea why it does that. My sprite isn't rotatable so I never ran in to that problem. I'd suggest looking at Chad's Drinks Mod as I'm pretty sure he had things with slots that could be rotated and hopefully there will be something in his mod that shows how to solve the problem.


BEGIN Marker
x 0
y 0
orientation.x 0
orientation.y 0
Index 0
END
BEGIN Marker
x 3
y 3
orientation.x 0
orientation.y 0
Index 1
END


Doesnt matter how much i change x and y of index 0... the location of the slot is not changed... gonna try to look at chads mod now

Edited:
Chad seems to have 6 markers for 2 slots.
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: HELP coffee machine

Postby aubergine18 » Sun Oct 25, 2015 1:12 am

Maybe the game looks to see which part of the sprite the marker is over, and then works out which rotation that relates to, and only applies markers for the current rotation. Is his mod using the same Index for multiple markers? *goes to check* Yes, he is. So it seems you have to define the markers for each slot for each rotation type and the game will work out which markers to use based on the segment of the sprite being used for the current rotation.
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sun Oct 25, 2015 2:08 am

I quit all the designs... made a simple one thats working fine.

1 slot where stacks of coffee beans are loaded..
Spawn a coffee mug 1 tile away from the machine (based on rotation) and decrease stack by one...
Prisoners go use the coffee mug. The coffee mug fills their need of sleep and changes the machine (the one that spawned the mug) this.cash before deleting itself,

Works and its simple.

Edited:
The machine is the "mother" and the mug is the "son"
If u dismantle or dump the machine (the mother) the coffee mug (the son) spawns 1 stack of beans at this.Pos.x/this.Posy and this.Delete()
If u dump the coffee mug (the son) the machine will spawn another coffee mug.

Edited:

I cant find any option to upload the mod into steam workshop...
How is it done?!?

Edited:

Code: Select all

BEGIN Job
   Name               DECashColletion
   JobTime             10
   Tool               JailKeys
   Worker               Accountant
END


Accountant cant do jobs? :/
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sun Oct 25, 2015 5:38 pm

Almost everything done for alpha release.

Have 3 small issues:

# Issue 1:

Needs.txt

Code: Select all

BEGIN Provider
    Action           DEBuyingSnacks
    ProviderType   Object
    Object           DESnack
    PrimaryNeed       Food
    PrimaryRate       0.0
    ActionType       Use
    Slot            0
    Flags           UsesEntireObject
    Flags           RequiresCash
    Priority        1.05
END

BEGIN Provider
    Action           DEBuyingCoffee
    ProviderType   Object
    Object           DESnack
    PrimaryNeed       Sleep
    PrimaryRate       0.0
    ActionType       Use
    Slot            0
    Flags           UsesEntireObject
    Flags           RequiresCash
    Priority        1.05
END


Language/base-language.txt

Code: Select all

action_DEBuyingSnacks                Buying Snacks
action_DEBuyingCoffee                  Buying Coffee


For some reason the actions arent getting translated O.o
What I'm doing wrong?

# Issue 2:

manifest.txt

Code: Select all

Name                 "DarknessEyes Machines"
Author               DarknessEyes
Description          "Adds vending machines."
IsTranslation        false 
FileID               ??
UpdateTime        Unixtime value
SteamAuthor    ??


What do i write there?

# Issue 3:

How the hell do i upload mods into steam workshop?!?
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sun Oct 25, 2015 6:41 pm

The mod is now uploaded in steam workshop!

http://steamcommunity.com/sharedfiles/f ... =541882498
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Sun Oct 25, 2015 11:19 pm

Now gonna try to make an hire able Riot Police thats detects prisoners rioting :)
DarknessEyes
level2
level2
Posts: 105
Joined: Sat Apr 26, 2014 11:47 pm

Re: HELP coffee machine

Postby DarknessEyes » Mon Oct 26, 2015 11:04 pm

I decoded markers...

The X and Y offset doesnt change the X/Y of the slot related to the object position in game.
The X and Y offset are related to the sprite.bmp file

Still trying to figure out the correct math to get the values

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 5 guests