Giter Club home page Giter Club logo

sif's Introduction

Archived

This repository is archived. The only reason this fork exists is to fix a couple of very minor compatibility issues to bootstrap a build of Scavenge and Survive with sampctl. Aside from that, don't use this library. Instead, use the packages in the ScavengeSurvive org.


SIF - Southclaw's Interaction Framework

SIF is a collection of high-level include scripts to make the development of interactive features easy for the developer while maintaining quality front-end gameplay for players.

The Libraries

SIF Comes with 5 main libraries (and a couple of internally used extras), each of which can be individually included and their dependencies will be managed automatically.

There is also a debug library with some basic runtime debugging functions that are used in all SIF libraries.

button.inc

A simple framework using streamer areas and key checks to give the in-game effect of physical buttons that players must press instead of using a command. It was created as an alternative to the default GTA:SA spinning pickups for a few reasons:

  1. A player might want to stand where a pickup is but not use it (if the pickup is a building entrance or interior warp, he might want to stand in the doorway without being teleported.)

  2. Making hidden doors or secrets that can only be found by walking near the button area and seeing the textdraw. (or spamming F!)

  3. Spinning objects don't really add immersion to a role-play environment!

door.inc

A simple object movement manager that supports buttons as the default method of interacting. Doors support multiple buttons, so a button on the inside and outside of a door is possible. Doors can be opened and closed manually by calling OpenDoor or CloseDoor. The door state change callbacks can be used to restrict the use of doors by returning 1.

item.inc

A complex and flexible script to replace the use of pickups as a means of displaying objects that the player can pick up and use. Item offers picking up, dropping and even giving items to other players. Items in the game world consist of static objects combined with buttons from SIF/Button to provide a means of interacting.

Item aims to be an extremely flexible script offering a callback for almost every action the player can do with an item. The script also allows the ability to add the standard GTA:SA weapons as items that can be dropped, given and anything else you script items to do.

When picked up, items will appear on the character model bone specified in the item definition. This combines the visible aspect of weapons and items that are already in the game with the scriptable versatility of server created and scriptable entities.

inventory.inc

Offers extended item functionality using the virtual item feature in SIF/Item. This enables multiple items to be stored by players and retrieved when needed. It contains functions and callbacks for complete control from external scripts over inventory actions by players.

container.inc

A complex script that allows 'virtual inventories' to be created in order to store items in. Containers can be interacted with just like anything else with a button or a virtual container can be created without a way of interacting in the game world so the contents of if can be shown from a script function instead.

This script hooks a lot of Inventory functions and uses the interface functions to allow players to switch between a container item list and their own inventory to make swapping items or looting quick and easy.

core.inc

A fundamental library with features used by multiple SIF scripts.

debug.inc

Basic debugging library offering runtime debug functions used throughout SIF.

Extensions

Extension scripts are smaller modules not essential to the core functionality but offer some useful additions to the existing SIF libraries.

ContainerDialog

Offers functions that represent the contents of containers with dialogs. Also includes dynamic menu options for each item in the container.

Craft

Basic two-item combination crafting script. Offers a function for binding two items then the rest is done through container menu options.

DebugLabels

Entity labelling library used throughout SIF. Debug labels can be enabled and disabled in runtime and display various pieces of useful information.

InventoryDialog

Offers a method of viewing player inventory contents with dialogs. Also contains dynamic menu options for each item in the inventory.

InventoryKeys

Basically just assigns a key to opening inventory and adding items to it.

ItemArrayData

Extends the amount of data available to store with items. Includes functions for setting, getting and appending the data.

ItemList

Data library for compacting a list of items into a long string of item's types and array data as well as other pieces of information. Used mainly for storage.

Usage

git clone the repo into your includes path then:

#include <SIF/SIF>

Or you can include individual scripts:

#include <SIF/item>
#include <SIF/extensions/item-array0data>

You are welcome to fork, submit issues and improve the code any way you like!

sif's People

Contributors

amyrahmady avatar eidorian avatar gitter-badger avatar inlife avatar kolor4do avatar southclaws avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sif's Issues

Todo: Rewrite item size system

This NEEDS improvement ASAP. 4 hardcoded sizes is not good enough. A size value will likely be the replacement with a "carry" option for carryable items (so item size is not linked to the way the item is held).

This also requires a rewrite of the container/inventory code, most notable WillItemFitInContainer and the dialog listing. A container needs a size max as well as a slot max so each item fills 1 slot as well as x amount of size slots for the item size.

Empty container with 4 slots:

  • []
  • []
  • []
  • []

Add ONE item with a size of 2:

  • [item x]
  • []
  • []

It removes 2 listitems as it's worth 2 in terms of size.

Expose access to streamer "extra ID" field on all entities

Compiling latest release

E:\pawno\include\SIF\extensions\InventoryDialog.pwn(279) : warning 209: function "dialog_SIF_PlayerInventory" should return a value
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(395) : warning 200: symbol "dialog_SIF_PlayerInventoryOptio" is truncated to 31 characters
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(395) : warning 200: symbol "dialog_SIF_PlayerInventoryOptio" is truncated to 31 characters
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(399) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(407) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(409) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(411) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(412) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(413) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(417) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(418) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(423) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(425) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(427) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(428) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(430) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(432) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(436) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(437) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(442) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(444) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(446) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(447) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(449) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(451) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(455) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(456) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(461) : error 017: undefined symbol "playerid"
E:\pawno\include\SIF\extensions\InventoryDialog.pwn(464) : warning 209: function "dialog_SIF_PlayerInventoryOptio" should return a value
E:\pawno\include\easyDialog.inc(34) : error 021: symbol already defined: "@dialog_format"

YSI

Why SIF include is #include <YSI_4\y_hooks> not #include <YSI\y_hooks>

Missing "extensions" folder

Could you update the SIF, or upload the "extensions" folder please? Because i can't compile the SS without that. Thank you!

Issue with the Button library

pawno\include\SIF\Button.pwn(418) : error 001: expected token: ";", but found "-identifier-"
pawno\include\SIF\Button.pwn(424) : error 010: invalid function or declaration
pawno\include\SIF\Button.pwn(428) : error 021: symbol already defined: "Iterator@"
pawno\include\SIF\Button.pwn(447) : error 017: undefined symbol "Iterator@btn_CurrentlyNearIndex"
pawno\include\SIF\Button.pwn(447) : warning 215: expression has no effect
pawno\include\SIF\Button.pwn(447) : error 001: expected token: ";", but found "]"
pawno\include\SIF\Button.pwn(447) : error 029: invalid expression, assumed zero
pawno\include\SIF\Button.pwn(447) : fatal error 107: too many error messages on one line

I am using the latest release.

Todo: Rewrite itemlist to support dynamic item data types

An itemlist should contain a format specifier for the list which determines which pieces of data are stored with each item, something like:

"txyzwia"
Would correspond to: type, posx, posy, posz, world, interior, array data

Then I can build an item damage module that stores damage in a separate script but can still be accessed for saving in itemlists.

Generic string representation for item types + array data

SetItemTypeMaxArrayData should implement a "schema" in the form of an sscanf format specifier which defines the structure for item type array data.

A format for itemtype+data strings will be defined as <ItemType unique name>:<data> where <data> is a comma-delimited string of the item's array data. A function will be provided that will process one of these itemtype "descriptions" and spit out the ItemType and associated array data or maybe even create the item and apply the data simultaneously.

For example, the following string describes (using Scavenge and Survive item definitions) an AK-47 item with 7 rounds in the magazine, 30 in the reserve and ammo item type 186 (7.62mm FMJ).

AK47Rifle:7,30,186 - (sscanf: "ddd")

And this string describes a note item with some text attached:

Note:This is a message - (sscanf: "s[256]")

More complex items, such as a torso will require some work due to comma delimiters:

Torso:0,1477951012,9,Southclaw,26,They were beaten to death. - (sscanf: "ddds[24]ds[128]")

Missing those

SIF/extensions/InventoryDialog
SIF/extensions/InventoryKeys
SIF/extensions/ContainerDialog

Can you upload them please?

Reorganise for CI

Repo should be updated as a sampctl Pawn package with a pawn.json file.

Unit tests should be run via sampctl and TravisCI can be set up to run unit tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.