Code Monkey home page Code Monkey logo

w3ts's People

Contributors

anachron avatar cipherxof avatar gohagga avatar halithor avatar jejanim avatar promises avatar ttay24 avatar voces avatar z-machine 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  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

w3ts's Issues

Question: source mapping for the output Lua file

Hi @cipherxof,

Do you know if there is already some kind of source mapping done with TypeScript2Lua? I'd be keen to set up an environment where runtime errors in the Lua environment are parsed through a source map that relays back to the user which TypeScript module it came from. I think this would also significantly enhance the quality of Lua debugging anyway, since currently only being able to get line numbers during runtime is not helpful, hence the complexities of things like Eikonium's DebugUtils.

Change constructor to protected instead of private in MapPlayer

Hey,

I'm trying to Extend the MapPlayer class but am unable to because the constructor is set up to private. Would you be able to change it to protected instead? Then, I'd be able to extend it properly and it wouldn't change in reality it is hidden.

Trigger addCondition(() => boolean) does not work

It is not clear to me how I am supposed to use the addCondition properly.
There are two types available as the parameter:
image
Since I don't know what a boolexpr is or how to create one (there is no constructor or initializer I could find), I gave the callback a try which, as the title implies, does not work.

My code looks like this and the action w/o any condition fires properly but as soon as a callback is provided it does not (regardless of the return value.

ts

// main trigger for killing missiles
  const destroyMissileTrigger = new Trigger()
  destroyMissileTrigger.registerAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED)
  destroyMissileTrigger.addCondition(() => true)
  destroyMissileTrigger.addAction(() => {
    const attacker = Unit.fromHandle(GetAttacker())
    Log.Debug(`Attacking missile "${attacker.name}" killed`)
    attacker.kill()
  })

generated lua

Click to expand
     local destroyMissileTrigger = __TS__New(Trigger)
       destroyMissileTrigger:registerAnyUnitEvent(EVENT_PLAYER_UNIT_ATTACKED)
       destroyMissileTrigger:addCondition(
         function()
            return true
         end
    )
   destroyMissileTrigger:addAction(
        function()
            local attacker = Unit:fromHandle(
                GetAttacker()
            )          
            Log.Debug(
                ("Attacking missile \"" .. tostring(attacker.name)) .. "\" killed"
            )
            attacker:kill()
        end
    )

While trying to get the example code up and running using your template, I noticed I could not get any trigger action to run (it works in my other map though).

first build fails

I just started messing with this and I get the following:

PS C:\Users\Rasmus\Desktop\wc3-ts-template-master> npm install
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

> [email protected] postinstall C:\Users\Rasmus\Desktop\wc3-ts-template-master
> tsc --outDir null -p node_modules/mdx-m3-viewer/tsconfig.json

node_modules/mdx-m3-viewer/src/viewer/handlers/mdx/eventobjectsnd.ts:18:9 - error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?

18     if (viewer.enableAudio && scene.audioEnabled) {
           ~~~~~~~~~~~~~~~~~~


Found 1 error.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] postinstall: `tsc --outDir null -p node_modules/mdx-m3-viewer/tsconfig.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Rasmus\AppData\Roaming\npm-cache\_logs\2021-02-24T15_14_18_030Z-debug.log

I followed the guide here:
https://cipherxof.github.io/w3ts/docs/getting-started

and used the Download option. I am using the latest LTS Nodejs.

Split "Unit" to "Hero"?

I've realized a ton of stuff in Unit is actually about Hero, which might not always be needed.
Would it make sense to split it?

Unit.getItemInSlot() crashes if the slot is empty.

I recently updated from 2.1.3 and noticed that when calling Unit.getItemInSlot() on an empty inventory slot, the call crashes. I expect this to have something to do with the change that made this function return an instance of Item instead of a handle.

Is this behavior intended?
The only way to circumvent this now is a try/catch block.

image

Group hasUnit & typo

Group is missing a hasUnit function and also this function should be renamed I guess?

public GroupEnumUnitsInRangeCounted(x: number, y: number, radius: number, filter: boolexpr, countLimit: number) {

GroupEnumUnitsInRangeCounted(this.handle, x, y, radius, filter, countLimit);

}

Also I'm willing to contribute. Are there any plans to make this resource easier for contribution (create w3ts org) or should I open PRs for my changes for now?

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.